Main view index now stored in model settings instead of radio settings

This commit is contained in:
Bertrand Songis
2016-06-11 18:09:18 +02:00
parent 22efe664d5
commit c5096ff531
3 changed files with 23 additions and 15 deletions
+7 -3
View File
@@ -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; i<MAX_CUSTOM_SCREENS; i++) {
if (customScreens[i]) {
if (i == g_eeGeneral.view)
if (i == g_model.view)
customScreens[i]->refresh();
else
customScreens[i]->background();
+7 -7
View File
@@ -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<NUM_SWITCHES; ++i) {
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);
if (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();
}