volatile char timerRemoteStart(char key, char first) { menu.message(TEXT("Started Remote")); remote.set(REMOTE_PROGRAM); remote.set(REMOTE_START); menu.spawn((void*)timerStatusRemote); return FN_JUMP; }
volatile char timerStatusRemote(char key, char first) { static uint32_t startTime = 0; static uint8_t toggle = 0; if(first) { startTime = 0; } if(clock.Ms() > startTime + 100) { startTime = clock.Ms(); lcd.cls(); if(toggle == 0) remote.request(REMOTE_BATTERY); else if(toggle == 1) remote.send(REMOTE_BATTERY, REMOTE_TYPE_NOTIFY_SET); else if(toggle == 2) remote.request(REMOTE_START); else remote.request(REMOTE_STATUS); if(++toggle >= 10) toggle = 2; displayTimerStatus(1); menu.setTitle(TEXT("Remote")); if(remote.running) menu.setBar(TEXT("RETURN"), TEXT("STOP")); else menu.setBar(TEXT("RETURN"), BLANK_STR); lcd.update(); } if(!remote.connected) return FN_CANCEL; switch(key) { case FR_KEY: remote.set(REMOTE_STOP); break; case FL_KEY: case LEFT_KEY: remote.send(REMOTE_BATTERY, REMOTE_TYPE_NOTIFY_UNSET); toggle = 0; return FN_CANCEL; } return FN_CONTINUE; }
volatile char cableReleaseRemote(char key, char first) { static char status; //, cable; if(first) { status = 0; lcd.cls(); menu.setTitle(TEXT("BT Cable Remote")); menu.setBar(TEXT("Bulb"), TEXT("Photo")); lcd.update(); remote.set(REMOTE_BULB_END); } if(key == FL_KEY) { if(status != 1) { status = 1; lcd.eraseBox(8, 18, 8 + 6 * 11, 26); lcd.writeString(8, 18, TEXT("(BULB OPEN)")); remote.set(REMOTE_BULB_START); lcd.update(); } else { status = 0; lcd.eraseBox(8, 18, 8 + 6 * 11, 26); remote.set(REMOTE_BULB_END); lcd.update(); } } else if(key == FR_KEY && status != 1) { status = 0; lcd.eraseBox(8, 18, 8 + 6 * 11, 26); remote.set(REMOTE_CAPTURE); lcd.update(); } else if(key != 0) { status = 0; lcd.eraseBox(8, 18, 8 + 6 * 11, 26); remote.set(REMOTE_BULB_END); lcd.update(); } if(key == LEFT_KEY || !remote.connected) { remote.set(REMOTE_BULB_END); return FN_CANCEL; } return FN_CONTINUE; }