mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Main view index now stored in model settings instead of radio settings
This commit is contained in:
parent
22efe664d5
commit
c5096ff531
3 changed files with 23 additions and 15 deletions
|
@ -780,7 +780,11 @@ PACK(struct CustomScreenData {
|
||||||
});
|
});
|
||||||
#define CUSTOM_SCREENS_DATA \
|
#define CUSTOM_SCREENS_DATA \
|
||||||
NOBACKUP(CustomScreenData screenData[MAX_CUSTOM_SCREENS]); \
|
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
|
#else
|
||||||
#define CUSTOM_SCREENS_DATA
|
#define CUSTOM_SCREENS_DATA
|
||||||
// TODO other boards could have their custom screens here as well
|
// 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 txVoltageCalibration);
|
||||||
NOBACKUP(int8_t backlightMode);
|
NOBACKUP(int8_t backlightMode);
|
||||||
NOBACKUP(TrainerData trainer);
|
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(int8_t buzzerMode:2); // -2=quiet, -1=only alarms, 0=no keys, 1=all
|
||||||
NOBACKUP(uint8_t fai:1);
|
NOBACKUP(uint8_t fai:1);
|
||||||
NOBACKUP(int8_t beepMode:2); // -2=quiet, -1=only alarms, 0=no keys, 1=all
|
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)
|
#if defined(REV9E)
|
||||||
CHKSIZE(RadioData, 952);
|
CHKSIZE(RadioData, 952);
|
||||||
CHKSIZE(ModelData, 6519);
|
CHKSIZE(ModelData, 6520);
|
||||||
#else
|
#else
|
||||||
CHKSIZE(RadioData, 872);
|
CHKSIZE(RadioData, 872);
|
||||||
CHKSIZE(ModelData, 6506);
|
CHKSIZE(ModelData, 6507);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(PCBHORUS)
|
#elif defined(PCBHORUS)
|
||||||
|
@ -1100,7 +1104,7 @@ static inline void check_struct()
|
||||||
CHKSIZE(ModelHeader, 27);
|
CHKSIZE(ModelHeader, 27);
|
||||||
CHKSIZE(CurveData, 4);
|
CHKSIZE(CurveData, 4);
|
||||||
CHKSIZE(RadioData, 835);
|
CHKSIZE(RadioData, 835);
|
||||||
CHKSIZE(ModelData, 9371);
|
CHKSIZE(ModelData, 9372);
|
||||||
|
|
||||||
#elif defined(PCBSKY9X)
|
#elif defined(PCBSKY9X)
|
||||||
CHKSIZE(MixData, 20);
|
CHKSIZE(MixData, 20);
|
||||||
|
|
|
@ -164,13 +164,13 @@ bool menuMainView(evt_t event)
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_PGDN):
|
case EVT_KEY_FIRST(KEY_PGDN):
|
||||||
storageDirty(EE_GENERAL);
|
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;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_PGUP):
|
case EVT_KEY_FIRST(KEY_PGUP):
|
||||||
killEvents(event);
|
killEvents(event);
|
||||||
storageDirty(EE_GENERAL);
|
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;
|
break;
|
||||||
|
|
||||||
case EVT_KEY_FIRST(KEY_EXIT):
|
case EVT_KEY_FIRST(KEY_EXIT):
|
||||||
|
@ -182,9 +182,13 @@ bool menuMainView(evt_t event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_model.view >= getMainViewsCount()) {
|
||||||
|
g_model.view = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8_t i=0; i<MAX_CUSTOM_SCREENS; i++) {
|
for (uint8_t i=0; i<MAX_CUSTOM_SCREENS; i++) {
|
||||||
if (customScreens[i]) {
|
if (customScreens[i]) {
|
||||||
if (i == g_eeGeneral.view)
|
if (i == g_model.view)
|
||||||
customScreens[i]->refresh();
|
customScreens[i]->refresh();
|
||||||
else
|
else
|
||||||
customScreens[i]->background();
|
customScreens[i]->background();
|
||||||
|
|
|
@ -480,9 +480,9 @@ void menuMainView(uint8_t event)
|
||||||
|
|
||||||
case EVT_KEY_BREAK(KEY_PAGE):
|
case EVT_KEY_BREAK(KEY_PAGE):
|
||||||
storageDirty(EE_GENERAL);
|
storageDirty(EE_GENERAL);
|
||||||
g_eeGeneral.view += 1;
|
g_model.view += 1;
|
||||||
if (g_eeGeneral.view >= VIEW_COUNT) {
|
if (g_model.view >= VIEW_COUNT) {
|
||||||
g_eeGeneral.view = 0;
|
g_model.view = 0;
|
||||||
chainMenu(menuMainViewChannelsMonitor);
|
chainMenu(menuMainViewChannelsMonitor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -524,7 +524,7 @@ void menuMainView(uint8_t event)
|
||||||
if (getSwitchCount() > 8) {
|
if (getSwitchCount() > 8) {
|
||||||
for (int i=0; i<NUM_SWITCHES; ++i) {
|
for (int i=0; i<NUM_SWITCHES; ++i) {
|
||||||
div_t qr = div(i, 9);
|
div_t qr = div(i, 9);
|
||||||
if (g_eeGeneral.view == VIEW_INPUTS) {
|
if (g_model.view == VIEW_INPUTS) {
|
||||||
div_t qr2 = div(qr.rem, 5);
|
div_t qr2 = div(qr.rem, 5);
|
||||||
if (i >= 14) qr2.rem += 1;
|
if (i >= 14) qr2.rem += 1;
|
||||||
const coord_t x[4] = { 50, 142 };
|
const coord_t x[4] = { 50, 142 };
|
||||||
|
@ -542,16 +542,16 @@ void menuMainView(uint8_t event)
|
||||||
if (SWITCH_EXISTS(i)) {
|
if (SWITCH_EXISTS(i)) {
|
||||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+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));
|
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++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_eeGeneral.view == VIEW_TIMERS) {
|
if (g_model.view == VIEW_TIMERS) {
|
||||||
displayTimers();
|
displayTimers();
|
||||||
}
|
}
|
||||||
else if (g_eeGeneral.view == VIEW_INPUTS) {
|
else if (g_model.view == VIEW_INPUTS) {
|
||||||
// Sticks
|
// Sticks
|
||||||
doMainScreenGraphics();
|
doMainScreenGraphics();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue