Revamped switch state checking
This commit is contained in:
+10
-10
@@ -116,20 +116,20 @@ static inline void check_struct()
|
|||||||
CHKSIZE(TrainerData, 16);
|
CHKSIZE(TrainerData, 16);
|
||||||
|
|
||||||
#if defined(PCBXLITES)
|
#if defined(PCBXLITES)
|
||||||
CHKSIZE(RadioData, 862);
|
|
||||||
CHKSIZE(ModelData, 6158);
|
|
||||||
#elif defined(PCBXLITE)
|
|
||||||
CHKSIZE(RadioData, 860);
|
CHKSIZE(RadioData, 860);
|
||||||
CHKSIZE(ModelData, 6158);
|
CHKSIZE(ModelData, 6159);
|
||||||
|
#elif defined(PCBXLITE)
|
||||||
|
CHKSIZE(RadioData, 858);
|
||||||
|
CHKSIZE(ModelData, 6159);
|
||||||
#elif defined(PCBX7)
|
#elif defined(PCBX7)
|
||||||
CHKSIZE(RadioData, 866);
|
CHKSIZE(RadioData, 864);
|
||||||
CHKSIZE(ModelData, 6158);
|
CHKSIZE(ModelData, 6159);
|
||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
CHKSIZE(RadioData, 962);
|
CHKSIZE(RadioData, 954);
|
||||||
CHKSIZE(ModelData, 6615);
|
CHKSIZE(ModelData, 6611);
|
||||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||||
CHKSIZE(RadioData, 900);
|
CHKSIZE(RadioData, 896);
|
||||||
CHKSIZE(ModelData, 6605);
|
CHKSIZE(ModelData, 6603);
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
#if defined(PCBX10)
|
#if defined(PCBX10)
|
||||||
CHKSIZE(RadioData, 921);
|
CHKSIZE(RadioData, 921);
|
||||||
|
|||||||
@@ -571,27 +571,12 @@ typedef uint32_t swarnstate_t;
|
|||||||
#elif defined(PCBX9E)
|
#elif defined(PCBX9E)
|
||||||
typedef uint64_t swconfig_t;
|
typedef uint64_t swconfig_t;
|
||||||
typedef uint64_t swarnstate_t;
|
typedef uint64_t swarnstate_t;
|
||||||
typedef uint32_t swarnenable_t;
|
|
||||||
#elif defined(PCBX9D) || defined(PCBX9DP)
|
#elif defined(PCBX9D) || defined(PCBX9DP)
|
||||||
typedef uint32_t swconfig_t;
|
typedef uint32_t swconfig_t;
|
||||||
typedef uint32_t swarnstate_t;
|
typedef uint32_t swarnstate_t;
|
||||||
typedef uint16_t swarnenable_t; // TODO remove it in 2.4
|
#else
|
||||||
#elif defined(PCBTARANIS)
|
|
||||||
typedef uint16_t swconfig_t;
|
typedef uint16_t swconfig_t;
|
||||||
typedef uint16_t swarnstate_t;
|
typedef uint32_t swarnstate_t;
|
||||||
typedef uint8_t swarnenable_t; // TODO remove it in 2.4
|
|
||||||
#else
|
|
||||||
typedef uint8_t swarnstate_t;
|
|
||||||
typedef uint8_t swarnenable_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(COLORLCD)
|
|
||||||
#define SWITCHES_WARNING_DATA \
|
|
||||||
NOBACKUP(swarnstate_t switchWarningState CUST(r_swtchWarn,w_swtchWarn));
|
|
||||||
#else
|
|
||||||
#define SWITCHES_WARNING_DATA \
|
|
||||||
swarnstate_t switchWarningState CUST(r_swtchWarn,w_swtchWarn); \
|
|
||||||
swarnenable_t switchWarningEnable; // TODO remove it in 2.4
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(COLORLCD) && defined(BACKUP)
|
#if defined(COLORLCD) && defined(BACKUP)
|
||||||
@@ -664,8 +649,8 @@ PACK(struct ModelData {
|
|||||||
FlightModeData flightModeData[MAX_FLIGHT_MODES] FUNC(fmd_is_active);
|
FlightModeData flightModeData[MAX_FLIGHT_MODES] FUNC(fmd_is_active);
|
||||||
|
|
||||||
NOBACKUP(uint8_t thrTraceSrc CUST(r_thrSrc,w_thrSrc));
|
NOBACKUP(uint8_t thrTraceSrc CUST(r_thrSrc,w_thrSrc));
|
||||||
|
CUST_ATTR(switchWarningState, r_swtchWarn, w_swtchWarn);
|
||||||
SWITCHES_WARNING_DATA
|
NOBACKUP(swarnstate_t switchWarningState SKIP);
|
||||||
|
|
||||||
GVarData gvars[MAX_GVARS];
|
GVarData gvars[MAX_GVARS];
|
||||||
|
|
||||||
|
|||||||
@@ -657,7 +657,6 @@ void menuModelSetup(event_t event)
|
|||||||
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLE_WARNING, attr, event);
|
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLE_WARNING, attr, event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
case ITEM_MODEL_SETUP_SWITCHES_WARNING2:
|
case ITEM_MODEL_SETUP_SWITCHES_WARNING2:
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
if (CURSOR_MOVED_LEFT(event))
|
if (CURSOR_MOVED_LEFT(event))
|
||||||
@@ -666,10 +665,8 @@ void menuModelSetup(event_t event)
|
|||||||
menuVerticalOffset++;
|
menuVerticalOffset++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_SWITCHES_WARNING1:
|
case ITEM_MODEL_SETUP_SWITCHES_WARNING1:
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
{
|
{
|
||||||
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
#define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length
|
||||||
uint8_t switchWarningsCount = getSwitchWarningsCount();
|
uint8_t switchWarningsCount = getSwitchWarningsCount();
|
||||||
@@ -705,10 +702,18 @@ void menuModelSetup(event_t event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
case EVT_KEY_LONG(KEY_ENTER):
|
||||||
if (menuHorizontalPosition < 0 || menuHorizontalPosition >= switchWarningsCount) {
|
if (menuHorizontalPosition < 0 ||
|
||||||
|
menuHorizontalPosition >= switchWarningsCount) {
|
||||||
START_NO_HIGHLIGHT();
|
START_NO_HIGHLIGHT();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
g_model.switchWarningState = switches_states;
|
// Mask switches enabled for warnings
|
||||||
|
swarnstate_t sw_mask = 0;
|
||||||
|
for(uint8_t i=0; i<NUM_SWITCHES; i++) {
|
||||||
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
|
if (g_model.switchWarningState & (0x07 << (3 * i)))
|
||||||
|
sw_mask |= (0x07 << (3 * i));
|
||||||
|
}
|
||||||
|
g_model.switchWarningState = switches_states & sw_mask;
|
||||||
AUDIO_WARNING1();
|
AUDIO_WARNING1();
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
@@ -722,80 +727,37 @@ void menuModelSetup(event_t event)
|
|||||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
div_t qr = div(current, MAX_SWITCH_PER_LINE);
|
||||||
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && attr && l_posHorz == current && old_posHorz >= 0) {
|
if (!READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER) && attr &&
|
||||||
g_model.switchWarningEnable ^= (1 << i);
|
l_posHorz == current && old_posHorz >= 0) {
|
||||||
|
uint8_t curr_state = (states & 0x07);
|
||||||
|
// remove old setting
|
||||||
|
g_model.switchWarningState &= ~(0x07 << (3 * i));
|
||||||
|
// add the new one
|
||||||
|
g_model.switchWarningState |= ((curr_state + 1) & 0x03)
|
||||||
|
<< (3 * i);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
#if defined(PCBXLITE)
|
#if defined(PCBXLITE)
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
|
c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
||||||
c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
lcdDrawSizedText(
|
||||||
// lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, attr && (menuHorizontalPosition==current) ? INVERS : 0);
|
MODEL_SETUP_2ND_COLUMN + qr.rem * ((2 * FW) + 1),
|
||||||
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN + qr.rem*((2*FW)+1), y+FH*qr.quot, FIRSTSW_STR+(i*length)+3, 1, attr && (menuHorizontalPosition==current) ? INVERS : 0);
|
y + FH * qr.quot, FIRSTSW_STR + (i * length) + 3, 1,
|
||||||
if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c);
|
attr && (menuHorizontalPosition == current) ? INVERS : 0);
|
||||||
|
lcdDrawChar(lcdNextPos, y + FH * qr.quot, c);
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
states >>= 2;
|
states >>= 3;
|
||||||
}
|
}
|
||||||
if (attr && ((menuHorizontalPosition < 0) || menuHorizontalPosition >= switchWarningsCount)) {
|
if (attr && ((menuHorizontalPosition < 0) ||
|
||||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 8*(2*FW+1), 1+FH*((current+4)/5));
|
menuHorizontalPosition >= switchWarningsCount)) {
|
||||||
|
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN - 1, y - 1,
|
||||||
|
8 * (2 * FW + 1), 1 + FH * ((current + 4) / 5));
|
||||||
}
|
}
|
||||||
#else // PCBTARANIS
|
|
||||||
{
|
|
||||||
lcdDrawTextAlignedLeft(y, STR_SWITCHWARNING);
|
|
||||||
swarnstate_t states = g_model.switchWarningState;
|
|
||||||
char c;
|
|
||||||
if (attr) {
|
|
||||||
s_editMode = 0;
|
|
||||||
if (!READ_ONLY()) {
|
|
||||||
switch (event) {
|
|
||||||
case EVT_KEY_BREAK(KEY_ENTER):
|
|
||||||
if (menuHorizontalPosition < NUM_SWITCHES-1) {
|
|
||||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EVT_KEY_LONG(KEY_ENTER):
|
|
||||||
if (menuHorizontalPosition == NUM_SWITCHES-1) {
|
|
||||||
START_NO_HIGHLIGHT();
|
|
||||||
getMovedSwitch();
|
|
||||||
g_model.switchWarningState = switches_states;
|
|
||||||
AUDIO_WARNING1();
|
|
||||||
storageDirty(EE_MODEL);
|
|
||||||
}
|
|
||||||
killEvents(event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < NUM_SWITCHES-1/*not on TRN switch*/; i++) {
|
|
||||||
uint8_t swactive = !(g_model.switchWarningEnable & (1u << i));
|
|
||||||
uint8_t swattr = 0;
|
|
||||||
|
|
||||||
if (IS_3POS(i)) {
|
|
||||||
c = '0' + (states & 0x03);
|
|
||||||
states >>= 2u;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ((states & 0x01) && swactive)
|
|
||||||
swattr = INVERS;
|
|
||||||
c = *(STR_VSWITCHES - 2 + 9 + (3*(i+1)));
|
|
||||||
states >>= 1u;
|
|
||||||
}
|
|
||||||
if (attr && (menuHorizontalPosition == i)) {
|
|
||||||
swattr = BLINK | INVERS;
|
|
||||||
}
|
|
||||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, swactive ? c : '-', swattr);
|
|
||||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, "<]", (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? attr : 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
|
||||||
case ITEM_MODEL_SETUP_POTS_WARNING:
|
case ITEM_MODEL_SETUP_POTS_WARNING:
|
||||||
lcdDrawTextAlignedLeft(y, STR_POTWARNING);
|
lcdDrawTextAlignedLeft(y, STR_POTWARNING);
|
||||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0);
|
||||||
@@ -842,7 +804,6 @@ void menuModelSetup(event_t event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case ITEM_MODEL_SETUP_BEEP_CENTER:
|
case ITEM_MODEL_SETUP_BEEP_CENTER:
|
||||||
lcdDrawTextAlignedLeft(y, STR_BEEPCTR);
|
lcdDrawTextAlignedLeft(y, STR_BEEPCTR);
|
||||||
|
|||||||
@@ -679,7 +679,14 @@ void menuModelSetup(event_t event)
|
|||||||
if (menuHorizontalPosition < 0) {
|
if (menuHorizontalPosition < 0) {
|
||||||
START_NO_HIGHLIGHT();
|
START_NO_HIGHLIGHT();
|
||||||
getMovedSwitch();
|
getMovedSwitch();
|
||||||
g_model.switchWarningState = switches_states;
|
// Mask switches enabled for warnings
|
||||||
|
swarnstate_t sw_mask = 0;
|
||||||
|
for(uint8_t i=0; i<NUM_SWITCHES; i++) {
|
||||||
|
if (SWITCH_WARNING_ALLOWED(i))
|
||||||
|
if (g_model.switchWarningState & (0x07 << (3 * i)))
|
||||||
|
sw_mask |= (0x07 << (3 * i));
|
||||||
|
}
|
||||||
|
g_model.switchWarningState = switches_states & sw_mask;
|
||||||
AUDIO_WARNING1();
|
AUDIO_WARNING1();
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
@@ -695,17 +702,25 @@ void menuModelSetup(event_t event)
|
|||||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i)) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
div_t qr = div(current, 8);
|
div_t qr = div(current, 8);
|
||||||
if (!READ_ONLY() && event==EVT_KEY_BREAK(KEY_ENTER) && line && l_posHorz==current) {
|
if (!READ_ONLY() && event == EVT_KEY_BREAK(KEY_ENTER) && line &&
|
||||||
g_model.switchWarningEnable ^= (1 << i);
|
l_posHorz == current) {
|
||||||
|
uint8_t curr_state = (states & 0x07);
|
||||||
|
// remove old setting
|
||||||
|
g_model.switchWarningState &= ~(0x07 << (3 * i));
|
||||||
|
// add the new one
|
||||||
|
g_model.switchWarningState |= ((curr_state + 1) & 0x03)
|
||||||
|
<< (3 * i);
|
||||||
storageDirty(EE_MODEL);
|
storageDirty(EE_MODEL);
|
||||||
}
|
}
|
||||||
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
|
c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
||||||
c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
|
lcdDrawChar(
|
||||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (menuHorizontalPosition==current) ? INVERS : 0);
|
MODEL_SETUP_2ND_COLUMN + qr.rem * (2 * FW + 1),
|
||||||
if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c);
|
y + FH * qr.quot, 'A' + i,
|
||||||
|
line && (menuHorizontalPosition == current) ? INVERS : 0);
|
||||||
|
lcdDrawChar(lcdNextPos, y + FH * qr.quot, c);
|
||||||
++current;
|
++current;
|
||||||
}
|
}
|
||||||
states >>= 2;
|
states >>= 3;
|
||||||
}
|
}
|
||||||
if (attr && menuHorizontalPosition < 0) {
|
if (attr && menuHorizontalPosition < 0) {
|
||||||
#if defined(PCBX9E)
|
#if defined(PCBX9E)
|
||||||
|
|||||||
@@ -525,6 +525,7 @@ bool swash_is_active(void* user, uint8_t* data, uint32_t bitoffs)
|
|||||||
|
|
||||||
#define r_swtchWarn nullptr
|
#define r_swtchWarn nullptr
|
||||||
|
|
||||||
|
#if defined(COLORLCD)
|
||||||
bool w_swtchWarn(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque)
|
bool w_swtchWarn(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < STORAGE_NUM_SWITCHES; i++) {
|
for (int i = 0; i < STORAGE_NUM_SWITCHES; i++) {
|
||||||
@@ -568,6 +569,58 @@ bool w_swtchWarn(const YamlNode* node, uint32_t val, yaml_writer_func wf, void*
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bool w_swtchWarn(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
yaml_writer_func wf, void* opaque)
|
||||||
|
{
|
||||||
|
data += (bitoffs >> 3UL);
|
||||||
|
|
||||||
|
// switchWarningState
|
||||||
|
swarnstate_t states = *(swarnstate_t*)data;
|
||||||
|
data += sizeof(swarnstate_t);
|
||||||
|
|
||||||
|
// switchWarningEnable
|
||||||
|
swarnenable_t enables = *(swarnenable_t*)data;
|
||||||
|
|
||||||
|
for (int i = 0; i < STORAGE_NUM_SWITCHES; i++) {
|
||||||
|
// decode check state
|
||||||
|
// -> 2 bits per switch + enable
|
||||||
|
swarnenable_t en = (enables >> i) & 0x01;
|
||||||
|
if (en) continue;
|
||||||
|
|
||||||
|
// state == 0 -> no check
|
||||||
|
// state == 1 -> UP
|
||||||
|
// state == 2 -> MIDDLE
|
||||||
|
// state == 3 -> DOWN
|
||||||
|
char swtchWarn[2] = {(char)('A' + i), 0};
|
||||||
|
|
||||||
|
uint8_t state = (states >> (2 * i)) & 0x03;
|
||||||
|
switch (state) {
|
||||||
|
case 0:
|
||||||
|
swtchWarn[1] = 'u';
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
swtchWarn[1] = '-';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
swtchWarn[1] = 'd';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// this should never happen
|
||||||
|
swtchWarn[1] = 'x';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swtchWarn[1] != 0) {
|
||||||
|
if (!wf(opaque, swtchWarn, 2)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const struct YamlIdStr enum_BeeperMode[];
|
extern const struct YamlIdStr enum_BeeperMode[];
|
||||||
|
|
||||||
|
|||||||
@@ -818,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -818,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -818,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -818,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -818,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -831,8 +831,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 32, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 16 ),
|
YAML_PADDING( 48 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -870,8 +870,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 64, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 32 ),
|
YAML_PADDING( 96 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -803,8 +803,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -813,8 +813,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -810,8 +810,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -814,8 +814,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState", NULL, w_swtchWarn ),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 24 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -828,89 +828,94 @@ static bool swash_is_active(void* user, uint8_t* data, uint32_t bitoffs)
|
|||||||
return yaml_conv_220::swash_is_active(user, data, bitoffs);
|
return yaml_conv_220::swash_is_active(user, data, bitoffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t r_swtchWarn(const YamlNode* node, const char* val, uint8_t val_len)
|
static void r_swtchWarn(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
const char* val, uint8_t val_len)
|
||||||
{
|
{
|
||||||
// Read from string like 'AdBuC-':
|
data += (bitoffs >> 3UL);
|
||||||
//
|
swarnstate_t& swtchWarn = *(swarnstate_t*)data;
|
||||||
// -> reads:
|
|
||||||
// - Switch A: must be DOWN
|
|
||||||
// - Switch B: must be UP
|
|
||||||
// - Switch C: must be MIDDLE
|
|
||||||
//
|
|
||||||
// -> switches not in the list shall not be checked
|
|
||||||
//
|
|
||||||
swarnstate_t swtchWarn = 0;
|
|
||||||
while(val_len--) {
|
|
||||||
|
|
||||||
signed swtch = *(val++) - 'A';
|
// Read from string like 'AdBuC-':
|
||||||
if (swtch >= NUM_SWITCHES)
|
//
|
||||||
break;
|
// -> reads:
|
||||||
|
// - Switch A: must be DOWN
|
||||||
|
// - Switch B: must be UP
|
||||||
|
// - Switch C: must be MIDDLE
|
||||||
|
//
|
||||||
|
// -> switches not in the list shall not be checked
|
||||||
|
//
|
||||||
|
swtchWarn = 0;
|
||||||
|
while (val_len--) {
|
||||||
|
signed swtch = *(val++) - 'A';
|
||||||
|
if (swtch >= NUM_SWITCHES) break;
|
||||||
|
|
||||||
unsigned state = 0;
|
unsigned state = 0;
|
||||||
switch (*(val++)) {
|
switch (*(val++)) {
|
||||||
case 'u':
|
case 'u':
|
||||||
state = 1;
|
state = 1;
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
state = 2;
|
state = 2;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
state = 3;
|
state = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// no check
|
// no check
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// 3 bits per switch
|
|
||||||
swtchWarn |= (state << (3*swtch));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return swtchWarn;
|
// 3 bits per switch
|
||||||
|
swtchWarn |= (state << (3 * swtch));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool w_swtchWarn(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque)
|
static bool w_swtchWarn(void* user, uint8_t* data, uint32_t bitoffs,
|
||||||
|
yaml_writer_func wf, void* opaque)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
data += (bitoffs >> 3UL);
|
||||||
if (SWITCH_EXISTS(i)) {
|
swarnstate_t states = *(swarnstate_t*)data;
|
||||||
|
|
||||||
// decode check state
|
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||||
// -> 3 bits per switch
|
// TODO: SWITCH_EXISTS() uses the g_eeGeneral stucture, which might not be
|
||||||
auto state = (val >> (3*i)) & 0x07;
|
// avail
|
||||||
|
if (SWITCH_EXISTS(i)) {
|
||||||
|
// decode check state
|
||||||
|
// -> 3 bits per switch
|
||||||
|
auto state = (states >> (3 * i)) & 0x07;
|
||||||
|
|
||||||
// state == 0 -> no check
|
// state == 0 -> no check
|
||||||
// state == 1 -> UP
|
// state == 1 -> UP
|
||||||
// state == 2 -> MIDDLE
|
// state == 2 -> MIDDLE
|
||||||
// state == 3 -> DOWN
|
// state == 3 -> DOWN
|
||||||
char swtchWarn[2] = {(char)('A' + i), 0};
|
char swtchWarn[2] = {(char)('A' + i), 0};
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
swtchWarn[1] = 'u';
|
swtchWarn[1] = 'u';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
swtchWarn[1] = '-';
|
swtchWarn[1] = '-';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
swtchWarn[1] = 'd';
|
swtchWarn[1] = 'd';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// this should never happen
|
// this should never happen
|
||||||
swtchWarn[1] = 'x';
|
swtchWarn[1] = 'x';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swtchWarn[1] != 0) {
|
if (swtchWarn[1] != 0) {
|
||||||
if (!wf(opaque, swtchWarn, 2)) {
|
if (!wf(opaque, swtchWarn, 2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const struct YamlIdStr enum_BeeperMode[];
|
extern const struct YamlIdStr enum_BeeperMode[];
|
||||||
|
|||||||
@@ -851,7 +851,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 32, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 192 ),
|
YAML_PADDING( 192 ),
|
||||||
@@ -819,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 192 ),
|
YAML_PADDING( 192 ),
|
||||||
@@ -819,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 192 ),
|
YAML_PADDING( 192 ),
|
||||||
@@ -819,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 192 ),
|
YAML_PADDING( 192 ),
|
||||||
@@ -819,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -870,7 +870,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 32, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -868,7 +868,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 352, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 32, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 192 ),
|
YAML_PADDING( 192 ),
|
||||||
@@ -819,8 +818,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -411,7 +411,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 32 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 16, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 16, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 216 ),
|
YAML_PADDING( 216 ),
|
||||||
@@ -832,8 +831,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 32, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 16 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -450,7 +450,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 64 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 32, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 432 ),
|
YAML_PADDING( 432 ),
|
||||||
@@ -871,8 +870,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 320, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 64, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 32 ),
|
YAML_PADDING( 64 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -391,7 +391,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 120 ),
|
YAML_PADDING( 120 ),
|
||||||
@@ -804,8 +803,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -399,7 +399,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 168 ),
|
YAML_PADDING( 168 ),
|
||||||
@@ -814,8 +813,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -396,7 +396,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 144 ),
|
YAML_PADDING( 144 ),
|
||||||
@@ -811,8 +810,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
@@ -398,7 +398,6 @@ static const struct YamlNode struct_RadioData[] = {
|
|||||||
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
YAML_ARRAY("slidersConfig", 1, 4, struct_sliderConfig, nullptr),
|
||||||
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
YAML_ARRAY("potsConfig", 2, 4, struct_potConfig, nullptr),
|
||||||
YAML_UNSIGNED( "backlightColor", 8 ),
|
YAML_UNSIGNED( "backlightColor", 8 ),
|
||||||
YAML_UNSIGNED( "switchUnlockStates", 16 ),
|
|
||||||
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
YAML_ARRAY("sticksConfig", 0, 4, struct_sticksConfig, stick_name_valid),
|
||||||
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
YAML_ARRAY("switchConfig", 2, 8, struct_switchConfig, nullptr),
|
||||||
YAML_PADDING( 144 ),
|
YAML_PADDING( 144 ),
|
||||||
@@ -815,8 +814,8 @@ static const struct YamlNode struct_ModelData[] = {
|
|||||||
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
YAML_STRUCT("swashR", 64, struct_SwashRingData, swash_is_active),
|
||||||
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
YAML_ARRAY("flightModeData", 288, 9, struct_FlightModeData, fmd_is_active),
|
||||||
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
YAML_UNSIGNED_CUST( "thrTraceSrc", 8, r_thrSrc, w_thrSrc ),
|
||||||
YAML_UNSIGNED_CUST( "switchWarningState", 16, r_swtchWarn, w_swtchWarn ),
|
YAML_CUSTOM("switchWarningState",r_swtchWarn,w_swtchWarn),
|
||||||
YAML_UNSIGNED( "switchWarningEnable", 8 ),
|
YAML_PADDING( 32 ),
|
||||||
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
YAML_ARRAY("gvars", 56, 9, struct_GVarData, NULL),
|
||||||
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
YAML_STRUCT("varioData", 40, struct_VarioData, NULL),
|
||||||
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
YAML_UNSIGNED_CUST( "rssiSource", 8, r_tele_sensor, w_tele_sensor ),
|
||||||
|
|||||||
+22
-38
@@ -521,16 +521,16 @@ swsrc_t getMovedSwitch()
|
|||||||
static tmr10ms_t s_move_last_time = 0;
|
static tmr10ms_t s_move_last_time = 0;
|
||||||
swsrc_t result = 0;
|
swsrc_t result = 0;
|
||||||
|
|
||||||
#if defined(PCBFRSKY) || defined(PCBNV14)
|
|
||||||
// Switches
|
// Switches
|
||||||
for (int i = 0; i < NUM_SWITCHES; i++) {
|
for (int i = 0; i < NUM_SWITCHES; i++) {
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t) 0x03 << (i * 2));
|
swarnstate_t mask = ((swarnstate_t) 0x07 << (i * 3));
|
||||||
uint8_t prev = (switches_states & mask) >> (i * 2);
|
uint8_t prev = (switches_states & mask) >> (i * 3);
|
||||||
uint8_t next = (1024 + getValue(MIXSRC_SA + i)) / 1024;
|
uint8_t next = (1024 + getValue(MIXSRC_SA + i)) / 1024 + 1;
|
||||||
if (prev != next) {
|
if (prev != next) {
|
||||||
switches_states = (switches_states & (~mask)) | ((swarnstate_t) next << (i * 2));
|
switches_states =
|
||||||
result = 1 + (3 * i) + next;
|
(switches_states & (~mask)) | ((swarnstate_t)(next) << (i * 3));
|
||||||
|
result = (3 * i) + next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -547,26 +547,6 @@ swsrc_t getMovedSwitch()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// return delivers 1 to 3 for ID1 to ID3
|
|
||||||
// 4..8 for all other switches if changed to true
|
|
||||||
// -4..-8 for all other switches if changed to false
|
|
||||||
// 9 for Trainer switch if changed to true; Change to false is ignored
|
|
||||||
swarnstate_t mask = 0x80;
|
|
||||||
for (uint8_t i=NUM_SWITCHES_POSITIONS; i>1; i--) {
|
|
||||||
bool prev;
|
|
||||||
prev = (switches_states & mask);
|
|
||||||
// don't use getSwitch here to always get the proper value, even getSwitch manipulates
|
|
||||||
bool next = switchState(i-1);
|
|
||||||
if (prev != next) {
|
|
||||||
if (((i<NUM_SWITCHES_POSITIONS) && (i>3)) || next==true)
|
|
||||||
result = next ? i : -i;
|
|
||||||
if (i<=3 && result==0) result = 1;
|
|
||||||
switches_states ^= mask;
|
|
||||||
}
|
|
||||||
mask >>= 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((tmr10ms_t)(get_tmr10ms() - s_move_last_time) > 10)
|
if ((tmr10ms_t)(get_tmr10ms() - s_move_last_time) > 10)
|
||||||
result = 0;
|
result = 0;
|
||||||
@@ -635,9 +615,9 @@ void checkSwitches()
|
|||||||
}
|
}
|
||||||
#elif defined(PCBTARANIS)
|
#elif defined(PCBTARANIS)
|
||||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i) && !(g_model.switchWarningEnable & (1<<i))) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x03 << (i*2));
|
swarnstate_t mask = ((swarnstate_t)0x07 << (i*3));
|
||||||
if (!((states & mask) == (switches_states & mask))) {
|
if ((states & mask) && !((states & mask) == (switches_states & mask))) {
|
||||||
warn = true;
|
warn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -705,15 +685,19 @@ void checkSwitches()
|
|||||||
#endif
|
#endif
|
||||||
int numWarnings = 0;
|
int numWarnings = 0;
|
||||||
for (int i=0; i<NUM_SWITCHES; ++i) {
|
for (int i=0; i<NUM_SWITCHES; ++i) {
|
||||||
if (SWITCH_WARNING_ALLOWED(i) && !(g_model.switchWarningEnable & (1<<i))) {
|
if (SWITCH_WARNING_ALLOWED(i)) {
|
||||||
swarnstate_t mask = ((swarnstate_t)0x03 << (i*2));
|
swarnstate_t mask = ((swarnstate_t)0x07 << (i*3));
|
||||||
LcdFlags attr = ((states & mask) == (switches_states & mask)) ? 0 : INVERS;
|
if (states & mask) {
|
||||||
if (attr) {
|
LcdFlags attr =
|
||||||
if (++numWarnings < 6) {
|
((states & mask) == (switches_states & mask)) ? 0 : INVERS;
|
||||||
char c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[(states & mask) >> (i*2)];
|
if (attr) {
|
||||||
drawSource(x, y, MIXSRC_FIRST_SWITCH+i, attr);
|
if (++numWarnings < 6) {
|
||||||
lcdDrawChar(lcdNextPos, y, c, attr);
|
char c = (" " STR_CHAR_UP
|
||||||
x = lcdNextPos + 3;
|
"-" STR_CHAR_DOWN)[(states & mask) >> (i * 2)];
|
||||||
|
drawSource(x, y, MIXSRC_FIRST_SWITCH + i, attr);
|
||||||
|
lcdDrawChar(lcdNextPos, y, c, attr);
|
||||||
|
x = lcdNextPos + 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,18 @@ TEST(Conversions, ConversionX9DPFrom23)
|
|||||||
EXPECT_STRNEQ("Tes", g_eeGeneral.switchNames[0]); // ZSTREQ
|
EXPECT_STRNEQ("Tes", g_eeGeneral.switchNames[0]); // ZSTREQ
|
||||||
EXPECT_EQ(SWITCH_3POS, SWITCH_CONFIG(0));
|
EXPECT_EQ(SWITCH_3POS, SWITCH_CONFIG(0));
|
||||||
|
|
||||||
|
swarnstate_t state =
|
||||||
|
(0x01) | // SA up
|
||||||
|
(0x03 << (3 * 1)) | // SB down
|
||||||
|
(0x02 << (3 * 2)) | // SC middle
|
||||||
|
(0x01 << (3 * 3)) | // SD up
|
||||||
|
(0x02 << (3 * 4)) | // SE middle
|
||||||
|
(0x03 << (3 * 5)) | // SF down
|
||||||
|
(0x02 << (3 * 6)); // SG middle
|
||||||
|
|
||||||
|
// check only the "allowed switches"
|
||||||
|
EXPECT_EQ(state, g_model.switchWarningState & 0xFFFFF);
|
||||||
|
|
||||||
EXPECT_STRNEQ("Test", g_model.header.name); // ZSTREQ
|
EXPECT_STRNEQ("Test", g_model.header.name); // ZSTREQ
|
||||||
EXPECT_EQ(TMRMODE_ON, g_model.timers[0].mode); // new!
|
EXPECT_EQ(TMRMODE_ON, g_model.timers[0].mode); // new!
|
||||||
EXPECT_EQ(SWSRC_SA0, g_model.timers[0].swtch); // new!
|
EXPECT_EQ(SWSRC_SA0, g_model.timers[0].swtch); // new!
|
||||||
@@ -240,6 +252,15 @@ TEST(Conversions, ConversionX7From23)
|
|||||||
EXPECT_STRNEQ("Tes", g_eeGeneral.switchNames[0]);
|
EXPECT_STRNEQ("Tes", g_eeGeneral.switchNames[0]);
|
||||||
EXPECT_EQ(SWITCH_3POS, SWITCH_CONFIG(0));
|
EXPECT_EQ(SWITCH_3POS, SWITCH_CONFIG(0));
|
||||||
|
|
||||||
|
swarnstate_t state =
|
||||||
|
(0x02) | // SA middle
|
||||||
|
(0x01 << (3 * 1)) | // SB up
|
||||||
|
(0x03 << (3 * 2)) | // SC down
|
||||||
|
(0x03 << (3 * 4)); // SF down
|
||||||
|
|
||||||
|
// check only the "allowed switches"
|
||||||
|
EXPECT_EQ(state, g_model.switchWarningState & 0x7FFF);
|
||||||
|
|
||||||
EXPECT_STRNEQ("Test", g_model.header.name);
|
EXPECT_STRNEQ("Test", g_model.header.name);
|
||||||
EXPECT_EQ(MODULE_TYPE_R9M_PXX1, g_model.moduleData[EXTERNAL_MODULE].type);
|
EXPECT_EQ(MODULE_TYPE_R9M_PXX1, g_model.moduleData[EXTERNAL_MODULE].type);
|
||||||
EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, g_model.moduleData[EXTERNAL_MODULE].subType);
|
EXPECT_EQ(MODULE_SUBTYPE_R9M_EU, g_model.moduleData[EXTERNAL_MODULE].subType);
|
||||||
@@ -469,6 +490,12 @@ TEST(Conversions, ConversionTX16SFrom25)
|
|||||||
writeModelYaml(modelname2);
|
writeModelYaml(modelname2);
|
||||||
loadModel(modelname2);
|
loadModel(modelname2);
|
||||||
|
|
||||||
|
constexpr swarnstate_t swWarnState =
|
||||||
|
(0x01) |// SA up
|
||||||
|
(0x02 << (3 * 2)) | // SB middle
|
||||||
|
(0x03 << (3 * 5)); // SF down
|
||||||
|
EXPECT_EQ(swWarnState, g_model.switchWarningState);
|
||||||
|
|
||||||
EXPECT_EQ(MIXSRC_FIRST_LOGICAL_SWITCH + 4, g_model.mixData[4].srcRaw);
|
EXPECT_EQ(MIXSRC_FIRST_LOGICAL_SWITCH + 4, g_model.mixData[4].srcRaw);
|
||||||
EXPECT_EQ(MIXSRC_SC, g_model.mixData[5].srcRaw);
|
EXPECT_EQ(MIXSRC_SC, g_model.mixData[5].srcRaw);
|
||||||
EXPECT_EQ(MIXSRC_SB, g_model.mixData[6].srcRaw);
|
EXPECT_EQ(MIXSRC_SB, g_model.mixData[6].srcRaw);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user