diff --git a/radio/src/datastructs.h b/radio/src/datastructs.h index fc1c656b2..a5c8b08fc 100644 --- a/radio/src/datastructs.h +++ b/radio/src/datastructs.h @@ -780,7 +780,11 @@ PACK(struct CustomScreenData { }); #define CUSTOM_SCREENS_DATA \ NOBACKUP(CustomScreenData screenData[MAX_CUSTOM_SCREENS]); \ - NOBACKUP(Topbar::PersistentData topbarData); + NOBACKUP(Topbar::PersistentData topbarData); \ + NOBACKUP(uint8_t view); +#elif defined(PCBTARANIS) +#define CUSTOM_SCREENS_DATA \ + NOBACKUP(uint8_t view); #else #define CUSTOM_SCREENS_DATA // TODO other boards could have their custom screens here as well @@ -987,7 +991,7 @@ PACK(struct RadioData { NOBACKUP(int8_t txVoltageCalibration); NOBACKUP(int8_t backlightMode); NOBACKUP(TrainerData trainer); - NOBACKUP(uint8_t view); // index of view in main screen + NOBACKUP(uint8_t _view); // index of view in main screen NOBACKUP(int8_t buzzerMode:2); // -2=quiet, -1=only alarms, 0=no keys, 1=all NOBACKUP(uint8_t fai:1); NOBACKUP(int8_t beepMode:2); // -2=quiet, -1=only alarms, 0=no keys, 1=all @@ -1081,10 +1085,10 @@ static inline void check_struct() #if defined(REV9E) CHKSIZE(RadioData, 952); - CHKSIZE(ModelData, 6519); + CHKSIZE(ModelData, 6520); #else CHKSIZE(RadioData, 872); - CHKSIZE(ModelData, 6506); + CHKSIZE(ModelData, 6507); #endif #elif defined(PCBHORUS) @@ -1100,7 +1104,7 @@ static inline void check_struct() CHKSIZE(ModelHeader, 27); CHKSIZE(CurveData, 4); CHKSIZE(RadioData, 835); - CHKSIZE(ModelData, 9371); + CHKSIZE(ModelData, 9372); #elif defined(PCBSKY9X) CHKSIZE(MixData, 20); diff --git a/radio/src/gui/horus/view_main.cpp b/radio/src/gui/horus/view_main.cpp index ddf7a61ab..c0c5f7eeb 100644 --- a/radio/src/gui/horus/view_main.cpp +++ b/radio/src/gui/horus/view_main.cpp @@ -164,13 +164,13 @@ bool menuMainView(evt_t event) case EVT_KEY_FIRST(KEY_PGDN): storageDirty(EE_GENERAL); - g_eeGeneral.view = circularIncDec(g_eeGeneral.view, +1, 0, getMainViewsCount()-1); + g_model.view = circularIncDec(g_model.view, +1, 0, getMainViewsCount()-1); break; case EVT_KEY_FIRST(KEY_PGUP): killEvents(event); storageDirty(EE_GENERAL); - g_eeGeneral.view = circularIncDec(g_eeGeneral.view, -1, 0, getMainViewsCount()-1); + g_model.view = circularIncDec(g_model.view, -1, 0, getMainViewsCount()-1); break; case EVT_KEY_FIRST(KEY_EXIT): @@ -182,9 +182,13 @@ bool menuMainView(evt_t event) break; } + if (g_model.view >= getMainViewsCount()) { + g_model.view = 0; + } + for (uint8_t i=0; irefresh(); else customScreens[i]->background(); diff --git a/radio/src/gui/taranis/view_main.cpp b/radio/src/gui/taranis/view_main.cpp index c7dab9eb1..cf0cbcf34 100644 --- a/radio/src/gui/taranis/view_main.cpp +++ b/radio/src/gui/taranis/view_main.cpp @@ -480,9 +480,9 @@ void menuMainView(uint8_t event) case EVT_KEY_BREAK(KEY_PAGE): storageDirty(EE_GENERAL); - g_eeGeneral.view += 1; - if (g_eeGeneral.view >= VIEW_COUNT) { - g_eeGeneral.view = 0; + g_model.view += 1; + if (g_model.view >= VIEW_COUNT) { + g_model.view = 0; chainMenu(menuMainViewChannelsMonitor); } break; @@ -524,7 +524,7 @@ void menuMainView(uint8_t event) if (getSwitchCount() > 8) { for (int i=0; i= 14) qr2.rem += 1; const coord_t x[4] = { 50, 142 }; @@ -542,16 +542,16 @@ void menuMainView(uint8_t event) if (SWITCH_EXISTS(i)) { getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i); getvalue_t sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3)); - putsSwitches((g_eeGeneral.view == VIEW_INPUTS) ? (index<4 ? 8*FW+1 : 23*FW+2) : (index<4 ? 3*FW+1 : 8*FW-2), (index%4)*FH+3*FH, sw, 0); + putsSwitches((g_model.view == VIEW_INPUTS) ? (index<4 ? 8*FW+1 : 23*FW+2) : (index<4 ? 3*FW+1 : 8*FW-2), (index%4)*FH+3*FH, sw, 0); index++; } } } - if (g_eeGeneral.view == VIEW_TIMERS) { + if (g_model.view == VIEW_TIMERS) { displayTimers(); } - else if (g_eeGeneral.view == VIEW_INPUTS) { + else if (g_model.view == VIEW_INPUTS) { // Sticks doMainScreenGraphics(); }