Deviation v5.0.0 build with latest protocols

More
16 Dec 2016 08:45 - 23 Dec 2016 10:36 #56879 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Add CX20 format option to Flysky protocol

Goebish


(16.12.2016) Firmware DFU file only, you can get other components from official v5.0.0 release.
www.deviationtx.com/downloads-new/category/398-deviation-5-0-0



Files deleted, see below...
Last edit: 23 Dec 2016 10:36 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 12:33 - 16 Dec 2016 12:42 #56883 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
victzh,

If I comment out TELEMETRY_SetTypeByProtocol at pages\common\_model_page.c, and change protocol, telemetry type do not changed up to:
1) reboot Tx
2) reload model
3) press Bind button

it's not convenient for model setup.

If I comment out TELEMETRY_SetTypeByProtocol at config\model.c, at first glance it's look like nothing changed.

I don't see sense to change anything with TELEMETRY_SetTypeByProtocol.
Last edit: 16 Dec 2016 12:42 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 17:38 #56891 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols

victzh wrote: We really need to test dropping out the call to TELEMETRY_SetTypeByProtocol, it should work for everything except FrSky - they for some reason do not set the type themselves.


By the way, if I comment out TELEMETRY_SetTypeByProtocol at config\model.c, FrSky telemetry type not established at all. So, FrSky telemetry type established by reading modelXX.ini file only.

I think it's incorrect handling.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 18:44 #56892 by victzh
Usage of TELEMETRY_SetTypeByProtocol violates DRY principle - Don't Repeat Yourself. Any piece of information should be coded only in one place and not repeated - otherwise there is high potential for errors as already happened when some telemetry settings were not saved. It was TELEMETRY_SetTypeByProtocol coded improperly.

So in the long term we better get rid of it leaving only setting of telemetry type from inside of the protocol. We better investigate why protocol is not being initialized upon being set on the page and when you leave this page. There should be call to protocol initialization, otherwise it is left in some strange state - model page shows you one thing and in reality another protocol is active. All other settings work this way - they become active as soon as set, only some rare pages have "Save" button.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 18:46 #56893 by victzh
And yes, FrSky is coded incorrectly in this aspect. They should set telemetry type before using telemetry structures.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 19:11 #56894 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Now I think that at both cases TELEMETRY_SetTypeByProtocol is required. If I comment out TELEMETRY_SetTypeByProtocol at config\model.c, sometimes model loaded without telemetry box at main screen. It disappears.

I think that the PB used this function no accidentally.

Please Log in or Create an account to join the conversation.

More
16 Dec 2016 19:15 #56895 by victzh
I did not say it is accidental - it apparently compensates for other design decisions.

Maybe it's time to reconsider some of these decisions - if you call protocol initialization earlier then it will set the telemetry type. I will look into it.

Please Log in or Create an account to join the conversation.

More
17 Dec 2016 09:56 #56910 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
By the way, PROTOCOL_Load() has limit for modular protocols 4096 bytes:
char *ptr = (char *)loaded_protocol;
    while(size < 4096) {
        len = fread(buf, 1, 256, fh);
        if(len) {
            memcpy(ptr, buf, len);
            ptr += len;
        }
        size += len;
        if (len != 256)
            break;
    }

Nevertheless, targets for DevoF4, DevoF7 and DevoF12E have memory limit for modular protocols = 8K (protocol.ld):
MEMORY
{
	ram (rwx) : ORIGIN = 0x20004000, LENGTH = 8K
}

Or I'm wrong?

Please Log in or Create an account to join the conversation.

More
17 Dec 2016 21:35 #56922 by victzh
Nice catch, Vlad. F12E does not need this at all - it has 256K MCU. Devo F4 and F7 have the same MCU as 7E, so should not be different from it.

Please Log in or Create an account to join the conversation.

More
18 Dec 2016 06:59 #56934 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Game over. I can't add new protocol Q303, it doesn't fit to Devo7e.

Please Log in or Create an account to join the conversation.

More
18 Dec 2016 09:03 - 22 Dec 2016 14:01 #56937 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Add Q303 protocol

Goebish


Devo7e excluded from these builds.

(18.12.2016) Firmware DFU file only, you can get other components from official v5.0.0 release.
www.deviationtx.com/downloads-new/category/398-deviation-5-0-0



Files deleted, see below...
Last edit: 22 Dec 2016 14:01 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
20 Dec 2016 18:10 - 20 Dec 2016 18:33 #57051 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
I can get rid from TELEMETRY_SetTypeByProtocol(), the telemetry initialization and set telemetry type performed only at PROTOCOL_Load(), but it do not compacting Devo7e code, it will be even slightly larger. But protocol modules (with telemetry) will be slightly smaller.

void PROTOCOL_Load(int no_dlg)
{
....

    if (PROTOCOL_GetTelemetryState() != PROTO_TELEM_UNSUPPORTED) {
        memset(&Telemetry, 0, sizeof(Telemetry));
        TELEMETRY_SetType(PROTOCOL_GetTelemetryType());
    }
}
....
int PROTOCOL_GetTelemetryType()
{
    int telem_type = TELEM_DEVO;
    if(Model.protocol != PROTOCOL_NONE && PROTOCOL_LOADED)
        telem_type = (long)PROTO_Cmds(PROTOCMD_TELEMETRYTYPE);
    return telem_type;
}
        case PROTOCMD_TELEMETRYSTATE:
            return (void *)(long)(Model.proto_opts[PROTOOPTS_TELEMETRY] == TELEM_ON ? PROTO_TELEM_ON : PROTO_TELEM_OFF);
        case PROTOCMD_TELEMETRYTYPE: 
            return (void *)(long) TELEM_DSM;
        default: break;

So I'm not sure it's worth to do.
Last edit: 20 Dec 2016 18:33 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
22 Dec 2016 14:04 - 23 Dec 2016 10:37 #57122 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Nothing brand new, reworked "set telemetry type" to simplify things for protocol developers. Partially you can see that above.
github.com/DeviationTX/deviation/pull/85/files

vladislavy


Standard Devo7e excluded from these builds.

(21.12.2016) Firmware DFU file only, you can get other components from official v5.0.0 release.
www.deviationtx.com/downloads-new/category/398-deviation-5-0-0



Files deleted, see below...
Last edit: 23 Dec 2016 10:37 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
23 Dec 2016 10:40 - 05 Jan 2017 08:05 #57150 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Nothing brand new, compacted binary to fit devo7e

vladislavy


Devo7e with us again !!!


(23.12.2016) Firmware DFU file only, you can get other components from official v5.0.0 release.
www.deviationtx.com/downloads-new/category/398-deviation-5-0-0


Files deleted, see below...
Last edit: 05 Jan 2017 08:05 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
30 Dec 2016 09:05 #57355 by SeByDocKy
Replied by SeByDocKy on topic Deviation v5.0.0 build with latest protocols
Something have been changed recently in the last NB concerning the Multimodule ? coz I installed the last 12-23 build and got a missing "Multimodule" while for deviation-devo10-v5.0.0-7df3df6 is still working fine

Please Log in or Create an account to join the conversation.

More
30 Dec 2016 09:20 - 30 Dec 2016 09:22 #57356 by SeByDocKy
Replied by SeByDocKy on topic Deviation v5.0.0 build with latest protocols
I tested all recent NB. The last working is the 12-18, the first faulty for multimodule is from 12-20....

EDIT for the Devo10
Last edit: 30 Dec 2016 09:22 by SeByDocKy.

Please Log in or Create an account to join the conversation.

More
30 Dec 2016 12:28 #57359 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
I don't understand.

If it related to master branch "Nightly Builds", you can ask victzh, at 19-20 December he done many changes.

If it related to my "Deviation v5.0.0 build with latest protocols", I don't know, I change nothing related to Multimodule.

Please Log in or Create an account to join the conversation.

More
30 Dec 2016 12:41 #57360 by SeByDocKy
Replied by SeByDocKy on topic Deviation v5.0.0 build with latest protocols
Sorry .... I believed both were related ... I will contact him

Please Log in or Create an account to join the conversation.

More
05 Jan 2017 08:07 - 07 Jan 2017 07:39 #57548 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
Rewrite of ESky150 protocol to include binding, from TheRealMoeder
Add Cheerson CX35 format to Q303 protocol, from goebish


(05.01.2017) Firmware DFU file only, you can get other components from official v5.0.0 release.
www.deviationtx.com/downloads-new/category/398-deviation-5-0-0



Files deleted, see below...
Last edit: 07 Jan 2017 07:39 by vlad_vy.

Please Log in or Create an account to join the conversation.

More
06 Jan 2017 17:14 - 06 Jan 2017 17:15 #57596 by vlad_vy
Replied by vlad_vy on topic Deviation v5.0.0 build with latest protocols
I'm looking into "Add Cheerson CX35 format to Q303 protocol", from goebish, at master branch, and I have some consideration about sound:

at target\common\devo\sound.c in case the pause at music we have division by zero for "period" ({"xx", 0})
void SOUND_SetFrequency(unsigned frequency, unsigned volume)
{
    if (volume == 0) {
        //We need to keep the timer running (for the vibration motor, but also in case there is a pause in the music)
        //But don't want the buzzer running
        timer_disable_oc_output(_SOUND_TIM, _SOUND_TIM_OC);
    } else {
        timer_enable_oc_output(_SOUND_TIM, _SOUND_TIM_OC);
    }
    /* volume is between 0 and 100 */
    /* period = 14400000 / frequency */
    /* A Period of 65535 gives a ~ 220Hz tone */
    /* The Devo buzzer reaches max-volume with a pw ~ 100us.  That is max volume */
    /* use quadratic to approximate exponential volume control */
    u32 period = 14400000 / frequency;
    /* Taylor series: x + x^2/2 + x^3/6 + x^4/24 */
    u32 duty_cycle = (period >> 1) * (u32)volume / 100 * volume / 100 * volume / 100;
    timer_set_period(_SOUND_TIM, period);
    timer_set_oc_value(_SOUND_TIM, _SOUND_TIM_OC, duty_cycle);
}

so will be better to change code:
void SOUND_SetFrequency(unsigned frequency, unsigned volume)
{
    if(frequency == 0) {
        volume = 0;
        frequency = 220;
    }
    if (volume == 0) {
        //We need to keep the timer running (for the vibration motor, but also in case there is a pause in the music)
        //But don't want the buzzer running
        timer_disable_oc_output(_SOUND_TIM, _SOUND_TIM_OC);
    } else {
        timer_enable_oc_output(_SOUND_TIM, _SOUND_TIM_OC);
    }
    /* volume is between 0 and 100 */
    /* period = 14400000 / frequency */
    /* A Period of 65535 gives a ~ 220Hz tone */
    /* The Devo buzzer reaches max-volume with a pw ~ 100us.  That is max volume */
    /* use quadratic to approximate exponential volume control */
    u32 period = 14400000 / frequency;
    /* Taylor series: x + x^2/2 + x^3/6 + x^4/24 */
    u32 duty_cycle = (period >> 1) * (u32)volume / 100 * volume / 100 * volume / 100;
    timer_set_period(_SOUND_TIM, period);
    timer_set_oc_value(_SOUND_TIM, _SOUND_TIM_OC, duty_cycle);
}

and revert change at music.c:
static const struct NoteMap note_map[] = {
#ifdef EMULATOR    
    {"xx",   0},    // 10 Hz tone makes the emulator crash
#else
    {"xx",   10},   // 0 Hz doesn't work well on actual hardware
#endif
    {"a",  220}, {"ax", 233}, {"b",  247},
Last edit: 06 Jan 2017 17:15 by vlad_vy.

Please Log in or Create an account to join the conversation.

Time to create page: 0.110 seconds
Powered by Kunena Forum