Many MODELSEL screen bugs solved

This commit is contained in:
bsongis
2011-10-09 12:16:48 +00:00
parent ac45e5bfac
commit 8312f5d20e
4 changed files with 30 additions and 38 deletions
+24 -29
View File
@@ -202,7 +202,13 @@ void menuProcModelSelect(uint8_t event)
s_copyTgtOfs--;
m_posVert = (m_posVert+1) % MAX_MODELS;
}
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
EFile::swap(FILE_MODEL(sub), FILE_MODEL(m_posVert));
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
if (m_posVert == g_eeGeneral.currModel) {
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
@@ -223,34 +229,33 @@ void menuProcModelSelect(uint8_t event)
killEvents(_event);
break;
case EVT_KEY_BREAK(KEY_MENU):
if (EFile::exists(FILE_MODEL(sub)) && !s_copyTgtOfs) {
if (s_copyTgtOfs) {
s_copyTgtOfs = 0;
s_copyMode = 0;
}
else if (EFile::exists(FILE_MODEL(sub))) {
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copySrcRow = -1;
break;
}
// no break
break;
case EVT_KEY_LONG(KEY_MENU):
if (s_copyTgtOfs) {
s_copyTgtOfs = 0;
s_copyMode = 0;
}
else {
eeCheck(true); // force writing of current model data before this is changed
eeLoadModel(sub);
if (g_eeGeneral.currModel != sub) {
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
}
eeLoadModel(sub);
}
s_copyMode = 0;
killEvents(_event);
break;
case EVT_KEY_FIRST(KEY_LEFT):
case EVT_KEY_FIRST(KEY_RIGHT):
if (sub == g_eeGeneral.currModel) {
if (!EFile::exists(FILE_MODEL(sub))) {
eeCheck(true); // force writing of current model data before this is changed
eeLoadModel(sub);
}
chainMenu(_event == EVT_KEY_FIRST(KEY_RIGHT) ? menuProcModel : menuTabModel[DIM(menuTabModel)-1]);
return;
}
@@ -273,7 +278,13 @@ void menuProcModelSelect(uint8_t event)
}
else {
// only swap the model with its neighbor
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
EFile::swap(FILE_MODEL(oldSub), FILE_MODEL(sub));
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
if (oldSub == g_eeGeneral.currModel) {
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
@@ -303,7 +314,7 @@ void menuProcModelSelect(uint8_t event)
if (s_copyMode && k==sub) {
if (s_copyMode == COPY_MODE)
lcd_putc(20*FW+2, y, '+');
lcd_rect(8, y-1, DISPLAY_W-1-7, 9);
lcd_rect(8, y-1, DISPLAY_W-1-7, 9, s_copyMode == COPY_MODE ? 0xff : 0x55);
lcd_filled_rect(9, y, DISPLAY_W-1-9, 7);
}
}
@@ -919,7 +930,7 @@ bool swapExpoMix(uint8_t expo, uint8_t &idx, uint8_t up)
return result;
}
void editExpoVals(uint8_t event, uint8_t which, bool edit, uint8_t y, uint8_t idt)
inline void editExpoVals(uint8_t event, uint8_t which, bool edit, uint8_t y, uint8_t idt)
{
uint8_t invBlk = edit ? INVERS : 0;
// if(edit && stopBlink) invBlk = INVERS;
@@ -959,20 +970,12 @@ void editExpoVals(uint8_t event, uint8_t which, bool edit, uint8_t y, uint8_t id
lcd_putsnAtt(6*FW, y, PSTR("---PosNeg")+9-3*ed->mode, 3, invBlk);
if(edit) ed->mode = 4 - checkIncDecModel(event, 4-ed->mode, 1, 3);
break;
case 6:
lcd_putsAtt(0*FW, y, PSTR("Delete"), invBlk);
if(edit && event==EVT_KEY_FIRST(KEY_MENU)) {
deleteExpoMix(1, idt);
killEvents(event);
popMenu();
}
break;
}
}
void menuProcExpoOne(uint8_t event)
{
SIMPLE_SUBMENU("EXPO/DR", 7);
SIMPLE_SUBMENU("EXPO/DR", 6);
ExpoData *ed = expoaddress(s_currIdx);
@@ -1017,7 +1020,7 @@ void menuProcExpoOne(uint8_t event)
void menuProcMixOne(uint8_t event)
{
SIMPLE_SUBMENU_NOTITLE(14);
SIMPLE_SUBMENU_NOTITLE(13);
TITLEP(s_currCh ? PSTR("INSERT MIX ") : PSTR("EDIT MIX "));
MixData *md2 = mixaddress(s_currIdx) ;
putsChn(lcd_lastPos+1*FW,0,md2->destCh,0);
@@ -1102,14 +1105,6 @@ void menuProcMixOne(uint8_t event)
lcd_outdezAtt(FW*16,y,md2->speedUp,attr);
if(attr) CHECK_INCDEC_MODELVAR( event, md2->speedUp, 0,15);
break;
case 13: lcd_putsAtt( 2*FW,y,PSTR("DELETE MIX [MENU]"),attr);
if(attr && event==EVT_KEY_LONG(KEY_MENU)){
killEvents(event);
deleteExpoMix(0, s_currIdx);
beepWarn1();
popMenu();
}
break;
}
}
}