volatile char timerRevert(char key, char first) { if(first) timer.load(timer.currentId); menu.message(TEXT("Reverted")); menu.back(); return FN_CANCEL; }
volatile char shutter_load(char key, char first) { static char menuSize; static char menuSelected; static char itemSelected; uint8_t c; char ch, update, menuScroll; update = 0; if(first) { menuScroll = 0; update = 1; } if(key == UP_KEY && menuSelected > 0) { menuSelected--; update = 1; } else if(key == DOWN_KEY && menuSelected < menuSize - 1) { menuSelected++; update = 1; } if(update) { lcd.cls(); if(menuSelected > 2) menuScroll = menuSelected - 2; menuSize = 0; char i = 0; for(char x = 1; x < MAX_STORED; x++) { i++; ch = eeprom_read_byte((uint8_t*)&stored[i - 1].Name[0]); if(ch == 0 || ch == 255) continue; for(c = 0; c < MENU_NAME_LEN - 1; c++) // Write settings item text // { if(i >= menuScroll && i <= menuScroll + 5) { ch = eeprom_read_byte((uint8_t*)&stored[i - 1].Name[c]); if(ch == 0) break; if(ch < 'A' || ch > 'Z') ch = ' '; lcd.writeChar(3 + c * 6, 8 + 9 * (menuSize - menuScroll), ch); if(menuSize == menuSelected) itemSelected = i - 1; } } menuSize++; } lcd.drawHighlight(2, 7 + 9 * (menuSelected - menuScroll), 81, 7 + 9 * (menuSelected - menuScroll) + 8); menu.setTitle(TEXT("Load Saved")); menu.setBar(TEXT("CANCEL"), TEXT("LOAD")); lcd.drawLine(0, 3, 0, 40); lcd.drawLine(83, 3, 83, 40); lcd.update(); } switch(key) { case FL_KEY: case LEFT_KEY: return FN_CANCEL; case FR_KEY: case RIGHT_KEY: timer.load(itemSelected); menu.message(TEXT("Loaded")); menu.back(); menu.select(0); return FN_SAVE; } return FN_CONTINUE; }