static void action_enable_backlight_long() { // Toggle backlight #ifdef SUPPORT_DISPLAY_BACKLIGHT enable_custom_backlight(60000); //switch backlight on for one minute #endif }
static void action_enter_menu() { if (menu_active) return; #ifdef SUPPORT_DISPLAY_BACKLIGHT enable_custom_backlight(15 * 1000); //switch backlight on for fifteen minute #endif // Activate on the go menu menu_activity_expire = 0; menu_active = true; menu_changed = true; // Reset to top level menu while (menu_system.back()); }
// // Switch actions start here. // Those can be executed when a button is pressed (short or long) // static void action_set_soft_poti() { #ifdef SUPPORT_SOFT_POTI // Set soft poti if throttle value changed if (poti_stat != throttle_stat) { #ifdef SUPPORT_DISPLAY_BACKLIGHT enable_custom_backlight(5000); //switch backlight on for five seconds #endif poti_stat = throttle_stat; if (poti_stat == 0) display_show_important_info("Tempomat reset", 0); else display_show_important_info("Tempomat set", 0); } #endif }
// // Switch actions start here. // Those can be executed when a button is pressed (short or long) // static void action_set_soft_poti() { #ifdef SUPPORT_SOFT_POTI int power_poti; byte i=0; char buffer[12]="Poti "; // Set soft poti if throttle value changed if (poti_stat != throttle_stat) { #ifdef SUPPORT_DISPLAY_BACKLIGHT enable_custom_backlight(5000); //switch backlight on for five seconds #endif poti_stat = throttle_stat; if (poti_stat == 0) display_show_important_info("Tempomat reset", 0); else { #if CONTROL_MODE == CONTROL_MODE_TORQUE //human power control mode #ifdef SUPPORT_XCELL_RT buffer[9]='%'; power_poti = poti_stat/1023.0* *ptr_power_poti_max; //power_poti_max is in this control mode interpreted as percentage. Example: power_poti_max=200 means; motor power = 200% of human power #endif #endif #if CONTROL_MODE == CONTROL_MODE_NORMAL //constant power mode buffer[9]='W'; power_poti = poti_stat/1023.0* *ptr_power_poti_max; #endif #if CONTROL_MODE == CONTROL_MODE_LIMIT_WH_PER_KM //wh/km control mode buffer[9]=0; buffer[10]=1; power_poti = poti_stat / 1023.0 * whkm_max; //power currently set by poti in relation to speed and maximum wattage per km #endif do { buffer[7-i++] = (char)(((int)'0')+(power_poti % 10)); } while ((power_poti /= 10) > 0); display_show_important_info(buffer, 1); } } #endif }
static void _handle_menu_switch(const enum switch_name sw, const enum switch_result res) { #ifdef SUPPORT_DISPLAY_BACKLIGHT enable_custom_backlight(15 * 1000); //switch backlight on for fifteen seconds #endif switch(res) { case PRESSED_SHORT: if (sw == MENU_BUTTON_DOWN) menu_system.next(true); else if (sw == MENU_BUTTON_UP) menu_system.prev(true); menu_changed = true; break; case PRESSED_LONG: menu_system.select(); menu_changed = true; break; default: break; } }