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
+4 -8
View File
@@ -201,20 +201,16 @@ bool EFile::exists(uint8_t i_fileId)
return eeFs.files[i_fileId].startBlk; return eeFs.files[i_fileId].startBlk;
} }
/*
* swap two files in eeprom
* called in sync AND async mode as it is a single write operation
*/
void EFile::swap(uint8_t i_fileId1, uint8_t i_fileId2) void EFile::swap(uint8_t i_fileId1, uint8_t i_fileId2)
{ {
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
DirEnt tmp = eeFs.files[i_fileId1]; DirEnt tmp = eeFs.files[i_fileId1];
eeFs.files[i_fileId1] = eeFs.files[i_fileId2]; eeFs.files[i_fileId1] = eeFs.files[i_fileId2];
eeFs.files[i_fileId2] = tmp; eeFs.files[i_fileId2] = tmp;
EeFsFlush(); EeFsFlush();
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
} }
void EFile::rm(uint8_t i_fileId) void EFile::rm(uint8_t i_fileId)
+1 -1
View File
@@ -522,7 +522,7 @@ extern uint16_t s_traceCnt;
const prog_char *get_switches_string() ; const prog_char *get_switches_string() ;
uint16_t getTmr16KHz(); uint16_t getTmr16KHz();
unsigned int stack_free(); uint16_t stack_free();
void checkLowEEPROM(); void checkLowEEPROM();
void checkTHR(); void checkTHR();
+24 -29
View File
@@ -202,7 +202,13 @@ void menuProcModelSelect(uint8_t event)
s_copyTgtOfs--; s_copyTgtOfs--;
m_posVert = (m_posVert+1) % MAX_MODELS; 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)); EFile::swap(FILE_MODEL(sub), FILE_MODEL(m_posVert));
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
if (m_posVert == g_eeGeneral.currModel) { if (m_posVert == g_eeGeneral.currModel) {
g_eeGeneral.currModel = sub; g_eeGeneral.currModel = sub;
STORE_GENERALVARS; STORE_GENERALVARS;
@@ -223,34 +229,33 @@ void menuProcModelSelect(uint8_t event)
killEvents(_event); killEvents(_event);
break; break;
case EVT_KEY_BREAK(KEY_MENU): 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_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
s_copySrcRow = -1; s_copySrcRow = -1;
break;
} }
// no break break;
case EVT_KEY_LONG(KEY_MENU): case EVT_KEY_LONG(KEY_MENU):
if (s_copyTgtOfs) { if (s_copyTgtOfs) {
s_copyTgtOfs = 0; s_copyTgtOfs = 0;
s_copyMode = 0;
} }
else { else {
eeCheck(true); // force writing of current model data before this is changed eeCheck(true); // force writing of current model data before this is changed
eeLoadModel(sub);
if (g_eeGeneral.currModel != sub) { if (g_eeGeneral.currModel != sub) {
g_eeGeneral.currModel = sub; g_eeGeneral.currModel = sub;
STORE_GENERALVARS; STORE_GENERALVARS;
} }
eeLoadModel(sub);
} }
s_copyMode = 0;
killEvents(_event); killEvents(_event);
break; break;
case EVT_KEY_FIRST(KEY_LEFT): case EVT_KEY_FIRST(KEY_LEFT):
case EVT_KEY_FIRST(KEY_RIGHT): case EVT_KEY_FIRST(KEY_RIGHT):
if (sub == g_eeGeneral.currModel) { 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]); chainMenu(_event == EVT_KEY_FIRST(KEY_RIGHT) ? menuProcModel : menuTabModel[DIM(menuTabModel)-1]);
return; return;
} }
@@ -273,7 +278,13 @@ void menuProcModelSelect(uint8_t event)
} }
else { else {
// only swap the model with its neighbor // only swap the model with its neighbor
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = true;
#endif
EFile::swap(FILE_MODEL(oldSub), FILE_MODEL(sub)); EFile::swap(FILE_MODEL(oldSub), FILE_MODEL(sub));
#ifdef EEPROM_ASYNC_WRITE
s_sync_write = false;
#endif
if (oldSub == g_eeGeneral.currModel) { if (oldSub == g_eeGeneral.currModel) {
g_eeGeneral.currModel = sub; g_eeGeneral.currModel = sub;
STORE_GENERALVARS; STORE_GENERALVARS;
@@ -303,7 +314,7 @@ void menuProcModelSelect(uint8_t event)
if (s_copyMode && k==sub) { if (s_copyMode && k==sub) {
if (s_copyMode == COPY_MODE) if (s_copyMode == COPY_MODE)
lcd_putc(20*FW+2, y, '+'); 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); 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; 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; uint8_t invBlk = edit ? INVERS : 0;
// if(edit && stopBlink) invBlk = INVERS; // 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); 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); if(edit) ed->mode = 4 - checkIncDecModel(event, 4-ed->mode, 1, 3);
break; 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) void menuProcExpoOne(uint8_t event)
{ {
SIMPLE_SUBMENU("EXPO/DR", 7); SIMPLE_SUBMENU("EXPO/DR", 6);
ExpoData *ed = expoaddress(s_currIdx); ExpoData *ed = expoaddress(s_currIdx);
@@ -1017,7 +1020,7 @@ void menuProcExpoOne(uint8_t event)
void menuProcMixOne(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 ")); TITLEP(s_currCh ? PSTR("INSERT MIX ") : PSTR("EDIT MIX "));
MixData *md2 = mixaddress(s_currIdx) ; MixData *md2 = mixaddress(s_currIdx) ;
putsChn(lcd_lastPos+1*FW,0,md2->destCh,0); 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); lcd_outdezAtt(FW*16,y,md2->speedUp,attr);
if(attr) CHECK_INCDEC_MODELVAR( event, md2->speedUp, 0,15); if(attr) CHECK_INCDEC_MODELVAR( event, md2->speedUp, 0,15);
break; 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;
} }
} }
} }
+1
View File
@@ -286,6 +286,7 @@ void eeLoadModel(uint8_t id)
if (sz != sizeof(ModelData)) { if (sz != sizeof(ModelData)) {
// alert("Error Loading Model"); // alert("Error Loading Model");
modelDefault(id); modelDefault(id);
eeCheck(true);
} }
resetTimer1(); resetTimer1();