static void show_new_state(const boolean is_on) { if (is_on) display_show_important_info(FROM_FLASH(msg_activated), 1); else display_show_important_info(FROM_FLASH(msg_deactivated), 1); menu_active = false; }
void display_show_welcome_msg() { #if (DISPLAY_TYPE & DISPLAY_TYPE_NOKIA) || (DISPLAY_TYPE & DISPLAY_TYPE_16X2) display_show_important_info(FROM_FLASH(msg_welcome), 5); #if (DISPLAY_TYPE & DISPLAY_TYPE_NOKIA) lcd.setCursor(0, 5); const byte max_len = 12; #elif (DISPLAY_TYPE & DISPLAY_TYPE_16X2) lcd.setCursor(0, 1); const byte max_len = 14; #endif // Show total mileage (right aligned) unsigned long total_km = (odo * wheel_circumference/1000); byte number_len = calc_number_length(total_km); // Safety check if (number_len >= max_len) return; number_len = max_len - number_len; while(number_len > 1) { lcd.print(MY_F(" ")); --number_len; } lcd.print(total_km); lcd.print(MY_F(" km")); #endif }
static void execute_action(const sw_action action) { switch(action) { case ACTION_NONE: break; case ACTION_SET_SOFT_POTI: action_set_soft_poti(); break; case ACTION_SHUTDOWN_SYSTEM: action_shutdown_system(); break; case ACTION_ENABLE_BACKLIGHT_LONG: action_enable_backlight_long(); break; case ACTION_TOGGLE_BLUETOOTH: action_toggle_bluetooth(); break; case ACTION_ENTER_MENU: action_enter_menu(); break; case ACTION_PROFILE_1: action_profile_1(); break; case ACTION_PROFILE_2: action_profile_2(); break; case ACTION_PROFILE: action_profile(); break; default: display_show_important_info("Unknown action!", 2); break; } }
static void action_shutdown_system() { // Shut down system #if HARDWARE_REV >=2 display_show_important_info(msg_shutdown, 60); digitalWrite(fet_out,HIGH); #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 // 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_shutdown(MenuItem* p_menu_item) { // Shut down system #if HARDWARE_REV >=2 display_show_important_info(msg_shutdown, 60); digitalWrite(fet_out,HIGH); #endif menu_active = false; }