static void lcd_menu_insert_material_preheat() { setTargetHotend(material[active_extruder].temperature, active_extruder); int16_t temp = degHotend(active_extruder) - 20; int16_t target = degTargetHotend(active_extruder) - 20 - 10; if (temp < 0) temp = 0; if (temp > target && !is_command_queued()) { set_extrude_min_temp(0); for(uint8_t e=0; e<EXTRUDERS; e++) volume_to_filament_length[e] = 1.0;//Set the extrusion to 1mm per given value, so we can move the filament a set distance. currentMenu = lcd_menu_change_material_insert_wait_user; temp = target; } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_info_screen(lcd_menu_material_main, cancelMaterialInsert); lcd_lib_draw_stringP(3, 10, PSTR("Heating printhead for")); lcd_lib_draw_stringP(3, 20, PSTR("material insertion")); lcd_progressbar(progress); lcd_lib_update_screen(); }
static void lcd_menu_print_printing() { lcd_question_screen(lcd_menu_print_tune, NULL, PSTR("TUNE"), lcd_menu_print_abort, NULL, PSTR("ABORT")); uint8_t progress = card.getFilePos() / ((card.getFileSize() + 123) / 124); char buffer[16]; char* c; switch(printing_state) { default: lcd_lib_draw_string_centerP(20, PSTR("Printing:")); lcd_lib_draw_string_center(30, card.longFilename); break; case PRINT_STATE_HEATING: lcd_lib_draw_string_centerP(20, PSTR("Heating")); c = int_to_string(current_temperature[0], buffer, PSTR("C")); *c++ = '/'; c = int_to_string(target_temperature[0], c, PSTR("C")); lcd_lib_draw_string_center(30, buffer); break; case PRINT_STATE_HEATING_BED: lcd_lib_draw_string_centerP(20, PSTR("Heating buildplate")); c = int_to_string(current_temperature_bed, buffer, PSTR("C")); *c++ = '/'; c = int_to_string(target_temperature_bed, c, PSTR("C")); lcd_lib_draw_string_center(30, buffer); break; } float printTimeMs = (millis() - starttime); float printTimeSec = printTimeMs / 1000L; float totalTimeMs = float(printTimeMs) * float(card.getFileSize()) / float(card.getFilePos()); static float totalTimeSmoothSec; totalTimeSmoothSec = (totalTimeSmoothSec * 999L + totalTimeMs / 1000L) / 1000L; if (isinf(totalTimeSmoothSec)) totalTimeSmoothSec = totalTimeMs; if (LCD_DETAIL_CACHE_TIME() == 0 && printTimeSec < 60) { totalTimeSmoothSec = totalTimeMs / 1000; lcd_lib_draw_stringP(5, 10, PSTR("Time left unknown")); }else{ unsigned long totalTimeSec; if (printTimeSec < LCD_DETAIL_CACHE_TIME() / 2) { float f = float(printTimeSec) / float(LCD_DETAIL_CACHE_TIME() / 2); totalTimeSec = float(totalTimeSmoothSec) * f + float(LCD_DETAIL_CACHE_TIME()) * (1 - f); }else{ totalTimeSec = totalTimeSmoothSec; } unsigned long timeLeftSec = totalTimeSec - printTimeSec; int_to_time_string(timeLeftSec, buffer); lcd_lib_draw_stringP(5, 10, PSTR("Time left")); lcd_lib_draw_string(65, 10, buffer); } lcd_progressbar(progress); lcd_lib_update_screen(); }
static void lcd_menu_change_material_preheat() { #ifdef USE_CHANGE_TEMPERATURE setTargetHotend(material[active_extruder].change_temperature, active_extruder); #else setTargetHotend(material[active_extruder].temperature, active_extruder); #endif int16_t temp = degHotend(active_extruder) - 20; int16_t target = degTargetHotend(active_extruder) - 20; if (temp < 0) temp = 0; if (temp > target - 5 && temp < target + 5) { if ((signed long)(millis() - preheat_end_time) > 0) { set_extrude_min_temp(0); plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 20.0 / volume_to_filament_length[active_extruder], retract_feedrate/60.0, active_extruder); float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_REVERSAL_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; plan_set_e_position(0); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -1.0 / volume_to_filament_length[active_extruder], FILAMENT_REVERSAL_SPEED, active_extruder); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -FILAMENT_REVERSAL_LENGTH / volume_to_filament_length[active_extruder], FILAMENT_REVERSAL_SPEED, active_extruder); max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; currentMenu = lcd_menu_change_material_remove; temp = target; } } else { #ifdef USE_CHANGE_TEMPERATURE preheat_end_time = millis() + (unsigned long)material[active_extruder].change_preheat_wait_time * 1000L; #else preheat_end_time = millis(); #endif } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_info_screen(post_change_material_menu, cancelMaterialInsert); lcd_lib_draw_stringP(3, 10, PSTR("Heating printhead")); lcd_lib_draw_stringP(3, 20, PSTR("for material removal")); lcd_progressbar(progress); lcd_lib_update_screen(); }
static void lcd_menu_change_material_preheat() { run_history = true; setTargetHotend(material[active_extruder].temperature, active_extruder); int16_t temp = degHotend(active_extruder) - 20; int16_t target = degTargetHotend(active_extruder) - 20 - 10; if (temp < 0) temp = 0; if (temp > target && !is_command_queued()) { set_extrude_min_temp(0); for(uint8_t e=0; e<EXTRUDERS; e++) volume_to_filament_length[e] = 1.0;//Set the extrusion to 1mm per given value, so we can move the filament a set distance. plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], 20.0, retract_feedrate/60.0, active_extruder); float old_max_feedrate_e = max_feedrate[E_AXIS]; float old_retract_acceleration = retract_acceleration; max_feedrate[E_AXIS] = FILAMENT_REVERSAL_SPEED; retract_acceleration = FILAMENT_LONG_MOVE_ACCELERATION; current_position[E_AXIS] = 0; plan_set_e_position(current_position[E_AXIS]); plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], -1.0, FILAMENT_REVERSAL_SPEED, active_extruder); for(uint8_t n=0; n<6; n++) plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], (n+1)*-FILAMENT_REVERSAL_LENGTH/6, FILAMENT_REVERSAL_SPEED, active_extruder); max_feedrate[E_AXIS] = old_max_feedrate_e; retract_acceleration = old_retract_acceleration; currentMenu = lcd_menu_change_material_remove; temp = target; } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_info_screen(lcd_menu_material_main, cancelMaterialInsert); lcd_lib_draw_stringP(3, 0, PSTR("Heating printhead")); lcd_lib_draw_stringP(3, 10, PSTR("for material removal")); char buffer[20]; memset (buffer,0,sizeof(buffer)); char* c; c = int_to_string(temp, buffer/*, PSTR( DEGREE_C_SYMBOL )*/); *c++ = TEMPERATURE_SEPARATOR; c = int_to_string(target, c, PSTR( DEGREE_C_SYMBOL )); lcd_lib_draw_string_center(20, buffer); lcd_progressbar(progress); LED_HEAT(); lcd_lib_update_screen(); }
void lcd_info_screen(menuFunc_t cancelMenu, menuFunc_t callbackOnCancel, const char* cancelButtonText) { if (lcd_lib_encoder_pos != ENCODER_NO_SELECTION) { if (lcd_lib_encoder_pos < 0) lcd_lib_encoder_pos += 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM; if (lcd_lib_encoder_pos >= 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM) lcd_lib_encoder_pos -= 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM; } if (lcd_lib_button_pressed && IS_SELECTED_MAIN(0)) { if (callbackOnCancel) callbackOnCancel(); if (cancelMenu) lcd_change_to_menu(cancelMenu); } lcd_basic_screen(); if (!cancelButtonText) cancelButtonText = PSTR("CANCEL"); if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+2, 49+2, 125-2, 63-2); lcd_lib_set(3+3, 49+3, 125-3, 63-3); lcd_lib_clear_stringP(65 - strlen_P(cancelButtonText) * 3, 53, cancelButtonText); }else{ lcd_lib_draw_stringP(65 - strlen_P(cancelButtonText) * 3, 53, cancelButtonText); } }
static void lcd_menu_change_material_remove() { run_history = true; lcd_info_screen(lcd_menu_material_main, cancelMaterialInsert); lcd_lib_draw_stringP(3, 20, PSTR("Reversing material")); if (!blocks_queued()) { lcd_lib_beep(); led_glow_dir = led_glow = 0; currentMenu = lcd_menu_change_material_remove_wait_user; SELECT_MAIN_MENU_ITEM(0); //Disable the extruder motor so you can pull out the remaining filament. disable_e0(); disable_e1(); disable_e2(); } long pos = -st_get_position(E_AXIS); long targetPos = lround(FILAMENT_REVERSAL_LENGTH*axis_steps_per_unit[E_AXIS]); uint8_t progress = (pos * 125 / targetPos); lcd_progressbar(progress); lcd_lib_led_color(48,48,255); lcd_lib_update_screen(); }
void lcd_draw_detailP(const char* pstr) { static int detailStringIndex=0; static const char* pstrBack=pstr; if (pstrBack!=pstr) { detailStringIndex=0; pstrBack=pstr; } uint8_t yOffset = LS(56, 53, 53); uint8_t detailStringLength=strlen_P(pstr); if (detailStringLength<=20) { lcd_lib_draw_string_centerP(yOffset, pstr); } else{ lcd_lib_draw_stringP(-detailStringIndex, yOffset, pstr); detailStringIndex++; if (detailStringIndex>=6*detailStringLength) { detailStringIndex=-128; } } }
void lcd_info_screen(menuFunc_t cancelMenu, menuFunc_t callbackOnCancel, const char* cancelButtonText, uint8_t direction) { lcd_lib_encoder_pos = 0; if (lcd_lib_button_pressed && IS_SELECTED_MAIN(0)) { if (cancelMenu) lcd_change_to_menu(cancelMenu,MAIN_MENU_ITEM_POS(0), direction); if (callbackOnCancel) callbackOnCancel(); } lcd_basic_screen(); if (!cancelButtonText) cancelButtonText = LS(PSTR("CANCEL"), PSTR("\xD8" "\x80" "\xD9" "\x80" ), PSTR("\xFF" "\x82" "\xC6" "\x82" )) ; switch (languageType) { case LANGUAGE_CHINESE: case LANGUAGE_KOREAN: if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+3, 54-3+1, 63+61-3, 64-1); lcd_lib_set(3+4, 54-3+2, 63+61-4, 64-2); lcd_lib_clear_stringP(65 - strlen_P(cancelButtonText) * 3, 56-3, cancelButtonText); }else{ lcd_lib_draw_stringP(65 - strlen_P(cancelButtonText) * 3, 56-3, cancelButtonText); } break; case LANGUAGE_ENGLISH: if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+3, 54+1, 63+61-3, 64-1); lcd_lib_set(3+4, 54+2, 63+61-4, 64-2); lcd_lib_clear_stringP(65 - strlen_P(cancelButtonText) * 3, 56, cancelButtonText); }else{ lcd_lib_draw_stringP(65 - strlen_P(cancelButtonText) * 3, 56, cancelButtonText); } break; default: break; } }
void lcd_question_screen(menuFunc_t optionAMenu, menuFunc_t callbackOnA, const char* AButtonText, menuFunc_t optionBMenu, menuFunc_t callbackOnB, const char* BButtonText) { if (lcd_lib_encoder_pos != ENCODER_NO_SELECTION) { if (lcd_lib_encoder_pos < 0) lcd_lib_encoder_pos += 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM; if (lcd_lib_encoder_pos >= 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM) lcd_lib_encoder_pos -= 2*ENCODER_TICKS_PER_MAIN_MENU_ITEM; } if (lcd_lib_button_pressed) { if (IS_SELECTED_MAIN(0)) { if (callbackOnA) callbackOnA(); if (optionAMenu) lcd_change_to_menu(optionAMenu); }else if (IS_SELECTED_MAIN(1)) { if (callbackOnB) callbackOnB(); if (optionBMenu) lcd_change_to_menu(optionBMenu); } } lcd_basic_screen(); if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+2, 49+2, 64-2, 63-2); lcd_lib_set(3+3, 49+3, 64-3, 63-3); lcd_lib_clear_stringP(35 - strlen_P(AButtonText) * 3, 53, AButtonText); }else{ lcd_lib_draw_stringP(35 - strlen_P(AButtonText) * 3, 53, AButtonText); } if (IS_SELECTED_MAIN(1)) { lcd_lib_draw_box(64+2, 49+2, 64+60-2, 63-2); lcd_lib_set(64+3, 49+3, 64+60-3, 63-3); lcd_lib_clear_stringP(64+31 - strlen_P(BButtonText) * 3, 53, BButtonText); }else{ lcd_lib_draw_stringP(64+31 - strlen_P(BButtonText) * 3, 53, BButtonText); } }
static void lcd_menu_change_material_insert_forward() { lcd_info_screen(lcd_menu_main, cancelMaterialInsert); lcd_lib_draw_stringP(3, 20, PSTR("Forwarding material")); if (!blocks_queued()) { lcd_lib_beep(); led_glow_dir = led_glow = 0; digipot_current(2, motor_current_setting[2]*2/3);//Set the E motor power lower to we skip instead of grind. currentMenu = lcd_menu_change_material_insert; SELECT_MAIN_MENU_ITEM(0); } long pos = st_get_position(E_AXIS); long targetPos = lround(FILAMENT_FORWARD_LENGTH*axis_steps_per_unit[E_AXIS]); uint8_t progress = (pos * 125 / targetPos); lcd_progressbar(progress); lcd_lib_update_screen(); }
void lcd_sd_menu_details_callback(uint8_t nr) { if (nr == 0) { return; } for(uint8_t idx=0; idx<LCD_CACHE_COUNT; idx++) { if (LCD_CACHE_ID(idx) == nr) { if (LCD_CACHE_TYPE(idx) == 1) { lcd_lib_draw_string_centerP(53, PSTR("Folder")); }else{ char buffer[64]; if (LCD_DETAIL_CACHE_ID() != nr) { card.getfilename(nr - 1); if (card.errorCode()) { card.clearError(); return; } LCD_DETAIL_CACHE_ID() = nr; LCD_DETAIL_CACHE_TIME() = 0; for(uint8_t e=0; e<EXTRUDERS; e++) LCD_DETAIL_CACHE_MATERIAL(e) = 0; card.openFile(card.filename, true); if (card.isFileOpen()) { for(uint8_t n=0;n<8;n++) { card.fgets(buffer, sizeof(buffer)); buffer[sizeof(buffer)-1] = '\0'; while (strlen(buffer) > 0 && buffer[strlen(buffer)-1] < ' ') buffer[strlen(buffer)-1] = '\0'; if (strncmp_P(buffer, PSTR(";TIME:"), 6) == 0) LCD_DETAIL_CACHE_TIME() = atol(buffer + 6); else if (strncmp_P(buffer, PSTR(";MATERIAL:"), 10) == 0) LCD_DETAIL_CACHE_MATERIAL(0) = atol(buffer + 10); #if EXTRUDERS > 1 else if (strncmp_P(buffer, PSTR(";MATERIAL2:"), 11) == 0) LCD_DETAIL_CACHE_MATERIAL(1) = atol(buffer + 11); #endif } } if (card.errorCode()) { //On a read error reset the file position and try to keep going. (not pretty, but these read errors are annoying as hell) card.clearError(); LCD_DETAIL_CACHE_ID() = 255; } } if (LCD_DETAIL_CACHE_TIME() > 0) { char* c = buffer; if (led_glow_dir) { strcpy_P(c, PSTR("Time: ")); c += 6; c = int_to_time_string(LCD_DETAIL_CACHE_TIME(), c); }else{ strcpy_P(c, PSTR("Material: ")); c += 10; float length = float(LCD_DETAIL_CACHE_MATERIAL(0)) / (M_PI * (material[0].diameter / 2.0) * (material[0].diameter / 2.0)); if (length < 10000) c = float_to_string(length / 1000.0, c, PSTR("m")); else c = int_to_string(length / 1000.0, c, PSTR("m")); #if EXTRUDERS > 1 if (LCD_DETAIL_CACHE_MATERIAL(1)) { *c++ = '/'; float length = float(LCD_DETAIL_CACHE_MATERIAL(1)) / (M_PI * (material[1].diameter / 2.0) * (material[1].diameter / 2.0)); if (length < 10000) c = float_to_string(length / 1000.0, c, PSTR("m")); else c = int_to_string(length / 1000.0, c, PSTR("m")); } #endif } lcd_lib_draw_string(3, 53, buffer); }else{ lcd_lib_draw_stringP(3, 53, PSTR("No info available")); } } } } }
static void lcd_material_select_details_callback(uint8_t nr) { lcd_lib_draw_stringP(5, 53, PSTR("Select the material")); }
void lcd_advance_menu(const char* menuNameP, int8_t entryCount, entryNameCallback_t entryNameCallback, entryDetailsCallback_t entryDetailsCallback) { if (lcd_lib_encoder_pos < 0) lcd_lib_encoder_pos = -1; if (lcd_lib_encoder_pos >= entryCount * ENCODER_TICKS_PER_SCROLL_MENU_ITEM) lcd_lib_encoder_pos = entryCount * ENCODER_TICKS_PER_SCROLL_MENU_ITEM; uint8_t selIndex =constrain(lcd_lib_encoder_pos/ENCODER_TICKS_PER_SCROLL_MENU_ITEM, 0, entryCount-1); uint8_t drawOffset; lcd_lib_clear(); switch (languageType) { case LANGUAGE_CHINESE: case LANGUAGE_KOREAN: drawOffset = (49-12*entryCount)/2+1; for(int8_t n=0; n<entryCount; n++) { char* ptr = entryNameCallback(n); ptr[20] = '\0'; if (n == selIndex) { lcd_lib_draw_string(4, drawOffset+12*n, CHINESE_POINT); lcd_lib_draw_string(16, drawOffset+12*n, ptr); }else{ lcd_lib_draw_string(16, drawOffset+12*n, ptr); } } if (menuNameP != NULL) { lcd_lib_draw_hline(127-strlen_P(menuNameP)*6-6, 127, 10 + 3); lcd_lib_draw_stringP(127-strlen_P(menuNameP)*6, 1, menuNameP); } lcd_lib_draw_hline(0, 127, 53 - 3); break; case LANGUAGE_ENGLISH: drawOffset = (40-10*entryCount)/2+13; for(int8_t n=0; n<entryCount; n++) { char* ptr = entryNameCallback(n); ptr[20] = '\0'; if (n == selIndex) { lcd_lib_draw_string(4, drawOffset+10*n, ENGLISH_POINT); lcd_lib_draw_string(10, drawOffset+10*n, ptr); }else{ lcd_lib_draw_string(10, drawOffset+10*n, ptr); } } if (menuNameP != NULL) { lcd_lib_draw_hline(127-strlen_P(menuNameP)*6-6, 127, 10); lcd_lib_draw_stringP(127-strlen_P(menuNameP)*6, 1, menuNameP); } lcd_lib_draw_hline(0, 127, 53); break; default: break; } entryDetailsCallback(selIndex); }
void lcd_scroll_menu(const char* menuNameP, int8_t entryCount, entryNameCallback_t entryNameCallback, entryDetailsCallback_t entryDetailsCallback) { if (lcd_lib_button_pressed) return; //Selection possibly changed the menu, so do not update it this cycle. if (lcd_lib_encoder_pos < 0) lcd_lib_encoder_pos = 0; if (lcd_lib_encoder_pos >= entryCount * ENCODER_TICKS_PER_SCROLL_MENU_ITEM) lcd_lib_encoder_pos = entryCount * ENCODER_TICKS_PER_SCROLL_MENU_ITEM - 1; uint8_t selIndex = uint16_t(lcd_lib_encoder_pos/ENCODER_TICKS_PER_SCROLL_MENU_ITEM); lcd_lib_clear(); int16_t targetViewPos; int16_t viewDiff; int16_t drawOffset; uint8_t itemOffset; switch (languageType) { case LANGUAGE_CHINESE: case LANGUAGE_KOREAN: { static int16_t viewPos = 8 + 12; targetViewPos = selIndex * 12; viewDiff = targetViewPos - viewPos; if (viewDiff<0) { viewDiff += 18; if (viewDiff > 0) { viewDiff=0; } } else if (viewDiff>0) { viewDiff -= 18; if (viewDiff<0) { viewDiff=0; } } viewPos += viewDiff / 4; if (viewDiff > 0) { viewPos++; led_glow = led_glow_dir = 0; } if (viewDiff < 0) { viewPos--; led_glow = led_glow_dir = 0; } if (viewPos<0) { viewPos=0; } drawOffset = 7 + 12 -viewPos % 12; itemOffset = viewPos / 12; for(int8_t n=-2; n<4; n++) { uint8_t itemIdx = n + itemOffset; if (itemIdx >= entryCount) continue; char* ptr = entryNameCallback(itemIdx); ptr[20] = '\0'; if (itemIdx == selIndex) { lcd_lib_draw_string(0, drawOffset+12*n, CHINESE_POINT); lcd_lib_draw_string(12, drawOffset+12*n, ptr); }else{ lcd_lib_draw_string(12, drawOffset+12*n, ptr); } } lcd_lib_clear(0, 0, 127,0); lcd_lib_clear(0, 50, 127, 63); lcd_lib_clear(127-strlen_P(menuNameP)*6-6, 0, 127, 13); lcd_lib_draw_hline(127-strlen_P(menuNameP)*6-6, 127, 13); lcd_lib_clear(0, 49, 127,49); lcd_lib_draw_hline(0, 127, 50); lcd_lib_draw_stringP(127-strlen_P(menuNameP)*6, 1, menuNameP); } break; case LANGUAGE_ENGLISH: { static int16_t viewPos = 8 +20; targetViewPos = selIndex * 10; viewDiff = targetViewPos - viewPos; if (viewDiff<0) { viewDiff += 15; if (viewDiff > 0) { viewDiff=0; } } else if (viewDiff>0) { viewDiff -= 15; if (viewDiff<0) { viewDiff=0; } } viewPos += viewDiff / 4; if (viewDiff > 0) { viewPos++; led_glow = led_glow_dir = 0; } if (viewDiff < 0) { viewPos--; led_glow = led_glow_dir = 0; } if (viewPos<0) { viewPos=0; } drawOffset = 8 +20 -viewPos % 10; itemOffset = viewPos / 10; for(int8_t n=-2; n<4; n++) { uint8_t itemIdx = n + itemOffset; if (itemIdx >= entryCount) continue; char* ptr = entryNameCallback(itemIdx); ptr[20] = '\0'; if (itemIdx == selIndex) { lcd_lib_draw_string(0, drawOffset+10*n, ENGLISH_POINT); lcd_lib_draw_string(10, drawOffset+10*n, ptr); }else{ lcd_lib_draw_string(10, drawOffset+10*n, ptr); } } lcd_lib_clear(0, 53, 127, 63); lcd_lib_clear(0, 0, 127, 9); lcd_lib_draw_hline(127-strlen_P(menuNameP)*6-12, 127, 10); lcd_lib_draw_hline(0, 127, 53); lcd_lib_draw_stringP(127-strlen_P(menuNameP)*6, 1, menuNameP); } default: break; } entryDetailsCallback(selIndex); }
void lcd_question_screen(menuFunc_t optionAMenu, menuFunc_t callbackOnA, const char* AButtonText, menuFunc_t optionBMenu, menuFunc_t callbackOnB, const char* BButtonText, uint8_t directionA, uint8_t directionB) { if (lcd_lib_encoder_pos <= 0) { lcd_lib_encoder_pos=0; } else{ lcd_lib_encoder_pos=1; } if (lcd_lib_button_pressed) { if (IS_SELECTED_MAIN(0)) { if (optionAMenu) lcd_change_to_menu(optionAMenu,MAIN_MENU_ITEM_POS(0),directionA); if (callbackOnA) callbackOnA(); }else if (IS_SELECTED_MAIN(1)) { if (optionBMenu) lcd_change_to_menu(optionBMenu,MAIN_MENU_ITEM_POS(0),directionB); if (callbackOnB) callbackOnB(); } } lcd_basic_screen(); switch (languageType) { case LANGUAGE_CHINESE: case LANGUAGE_KOREAN: if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+3, 54-3+1, 63-3, 64-1); lcd_lib_set(3+4, 54-3+2, 63-4, 64-2); lcd_lib_clear_stringP(34 - strlen_P(AButtonText) * 3, 56-3, AButtonText); }else{ lcd_lib_draw_stringP(34 - strlen_P(AButtonText) * 3, 56-3, AButtonText); } if (IS_SELECTED_MAIN(1)) { lcd_lib_draw_box(3+61+3, 54-3+1, 63+61-3, 64-1); lcd_lib_set(3+61+4, 54-3+2, 63+61-4, 64-2); lcd_lib_clear_stringP(34+61 - strlen_P(BButtonText) * 3, 56-3, BButtonText); }else{ lcd_lib_draw_stringP(34+61 - strlen_P(BButtonText) * 3, 56-3, BButtonText); } break; case LANGUAGE_ENGLISH: if (IS_SELECTED_MAIN(0)) { lcd_lib_draw_box(3+3, 54+1, 63-3, 64-1); lcd_lib_set(3+4, 54+2, 63-4, 64-2); lcd_lib_clear_stringP(34 - strlen_P(AButtonText) * 3, 56, AButtonText); }else{ lcd_lib_draw_stringP(34 - strlen_P(AButtonText) * 3, 56, AButtonText); } if (IS_SELECTED_MAIN(1)) { lcd_lib_draw_box(3+61+3, 54+1, 63+61-3, 64-1); lcd_lib_set(3+61+4, 54+2, 63+61-4, 64-2); lcd_lib_clear_stringP(34+61 - strlen_P(BButtonText) * 3, 56, BButtonText); }else{ lcd_lib_draw_stringP(34+61 - strlen_P(BButtonText) * 3, 56, BButtonText); } break; default: break; } }