Merge branch 'bsongis/Issue592_sticky_switches' into next

Conflicts:
	radio/src/gui/menu_model.cpp
This commit is contained in:
Andre Bernet
2014-02-07 23:39:28 +01:00
61 changed files with 2604 additions and 2383 deletions
+12 -9
View File
@@ -196,15 +196,18 @@ void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
#if defined(PCBTARANIS)
int ConvertSwitch_215_to_216(int swtch)
{
if (swtch < SWSRC_ON)
if (swtch <= SWSRC_LAST_SWITCH)
return swtch;
else
return swtch + (2*6); // 2 * 6-pos pots added as switches
return swtch + (2*4) + (2*6); // 4 trims and 2 * 6-pos added as switches
}
#else
inline int ConvertSwitch_215_to_216(int swtch)
{
return swtch;
if (swtch <= SWSRC_LAST_SWITCH)
return swtch;
else
return swtch + (2*4) + 1; // 4 trims and REa added
}
#endif
@@ -219,7 +222,7 @@ void ConvertModel_215_to_216(ModelData &model)
// Custom Switches: better precision for x when A comes from telemetry
// Main View: altitude in top bar
// Mixes: GVARS in weight moved from 512 to 4096 and -512 to -4096, because GVARS may be used in limits [-1250:1250]
// Switches: two 6-pos pots added
// Switches: two 6-pos pots added, REa added to Sky9x
TRACE("Model conversion from v215 to v216");
@@ -378,13 +381,13 @@ void ConvertModel_215_to_216(ModelData &model)
#if defined(PCBTARANIS)
CustomSwData * cs = &g_model.customSw[i];
uint8_t cstate = cswFamily(cs->func);
if (cstate == CS_VOFS || cstate == CS_VCOMP || cstate == CS_VDIFF) {
if (cstate == CS_FAMILY_OFS || cstate == CS_FAMILY_COMP || cstate == CS_FAMILY_DIFF) {
if (cs->v1 > 0) cs->v1 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
if (cs->v1 > MIXSRC_GVAR1+4) cs->v1 += 4;
}
if (cstate == CS_VOFS || cstate == CS_VDIFF) {
if (cstate == CS_FAMILY_OFS || cstate == CS_FAMILY_DIFF) {
if (cs->v1 >= MIXSRC_FIRST_TELEM) {
switch (cs->v1) {
switch ((uint8_t)cs->v1) {
case MIXSRC_FIRST_TELEM + TELEM_TM1-1:
case MIXSRC_FIRST_TELEM + TELEM_TM2-1:
cs->v2 = (cs->v2+128) * 3;
@@ -426,7 +429,7 @@ void ConvertModel_215_to_216(ModelData &model)
}
}
}
if (cstate == CS_VCOMP) {
if (cstate == CS_FAMILY_COMP) {
if (cs->v2 > 0) cs->v2 += MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
if (cs->v2 > MIXSRC_GVAR1+4) cs->v2 += 4;
}
@@ -435,7 +438,7 @@ void ConvertModel_215_to_216(ModelData &model)
for (uint8_t i=0; i<32; i++) {
g_model.funcSw[i] = oldModel.funcSw[i];
CustomFnData *sd = &g_model.funcSw[i];
if (CFN_FUNC(sd) == FUNC_PLAY_VALUE || CFN_FUNC(sd) == FUNC_VOLUME || (IS_ADJUST_GV_FUNCTION(sd) && CFN_GVAR_MODE(sd) == FUNC_ADJUST_GVAR_SOURCE)) {
if (CFN_FUNC(sd) == FUNC_PLAY_VALUE || CFN_FUNC(sd) == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(CFN_FUNC(sd)) && CFN_GVAR_MODE(sd) == FUNC_ADJUST_GVAR_SOURCE)) {
#if defined(PCBTARANIS)
CFN_PARAM(sd) += 1 + MAX_INPUTS + MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS;
#endif