Screen* SetpointScreen::touch(int16_t x, int16_t y) { for ( auto &button : buttons ) { if (button->contains(x, y)) { button->press(true); } else { button->press(false); } } if (ok_btn.justReleased()) return new HomeScreen(); if ((up_button.isPressed() && !up_button.justPressed()) || up_button.justReleased()) { mainSettings.setpoint = increaseF(mainSettings.setpoint); if (!up_button.isPressed()) save_eeprom(); } if ((down_button.isPressed() && !down_button.justPressed()) || down_button.justReleased()) { mainSettings.setpoint = decreaseF(mainSettings.setpoint); if (!down_button.isPressed()) save_eeprom(); } return NULL; }
void S0_Stop (uint8_t addr) { if(addr == 0){ if(GICR & (1<<INT0)){ //Interrupt aktiv -> deaktivieren GICR &= ~(1<<INT0); // External Interrupt 0: Disable save_eeprom(0); } } if(addr == 1){ if(GICR & (1<<INT1)){ GICR |= (1<<INT1); // External Interrupt 0 Enable save_eeprom(1); } } }
static void action_shutdown_system() { // Shut down system #if HARDWARE_REV >=2 display_show_important_info(msg_shutdown, 60); save_eeprom(); digitalWrite(fet_out,HIGH); #endif }
static void handle_shutdown(MenuItem* p_menu_item) { // Shut down system #if HARDWARE_REV >=2 display_show_important_info(FROM_FLASH(msg_shutdown), 60); save_eeprom(); digitalWrite(fet_out,HIGH); #endif menu_active = false; }
static void handle_command() { // sanity check if (active_serial->number_pos == 0 || active_serial->cmd_index == -1) { active_serial_port->println(MY_F("ERROR")); return; } active_serial_port->print(serial_commands[active_serial->cmd_index].mnemonic); // Info command? if (active_serial->numberstring[0] == '?') { switch(active_serial->cmd_index) { case 0: //poti_stat active_serial_port->println(poti_stat); break; case 1: //total kilometers active_serial_port->println(odo/1000.0*wheel_circumference,0); break; case 4: //hours read #ifdef SUPPORT_RTC active_serial_port->println(now.hh); #endif break; case 5: //minutes read #ifdef SUPPORT_RTC active_serial_port->println(now.mm); #endif break; case 6: //seconds read #ifdef SUPPORT_RTC active_serial_port->println(now.ss); #endif break; case 7: //charge count read #ifdef SUPPORT_BATTERY_CHARGE_COUNTER active_serial_port->println(charge_count); #endif break; } return; } // Write command? switch(active_serial->cmd_index) { case 0: //poti_stat poti_stat = min(atoi(active_serial->numberstring)*1023.0/power_poti_max,1023); break; case 1: //total kilometers odo = atoi(active_serial->numberstring)*1000.0/wheel_circumference; save_eeprom(); break; case 2: //short button press handle_switch(static_cast<switch_name>(atoi(active_serial->numberstring)), 0, PRESSED_SHORT); break; case 3: //long button press handle_switch(static_cast<switch_name>(atoi(active_serial->numberstring)), 0, PRESSED_LONG); break; case 4: //hours write #ifdef SUPPORT_RTC rtc.adjust_time(atoi(active_serial->numberstring),now.mm,now.ss); #endif break; case 5: //minutes write #ifdef SUPPORT_RTC rtc.adjust_time(now.hh,atoi(active_serial->numberstring),now.ss); #endif break; case 6: //seconds write #ifdef SUPPORT_RTC rtc.adjust_time(now.hh,now.mm,atoi(active_serial->numberstring)); #endif break; case 7: //charge count write #ifdef SUPPORT_BATTERY_CHARGE_COUNTER charge_count=atoi(active_serial->numberstring); save_eeprom(); #endif break; } active_serial_port->println(MY_F("OK")); }
static void ClearGekirindan(void) { save_eeprom(); }