static void lcd_menu_first_run_material_load_heatup() { setTargetHotend(230, 0); int16_t temp = degHotend(0) - 20; int16_t target = degTargetHotend(0) - 10 - 20; if (temp < 0) temp = 0; if (temp > target) { 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_first_run_material_load_insert; temp = target; } uint8_t progress = uint8_t(temp * 125 / target); if (progress < minProgress) progress = minProgress; else minProgress = progress; lcd_basic_screen(); DRAW_PROGRESS_NR(12); lcd_lib_draw_string_centerP(10, PSTR("Please wait,")); lcd_lib_draw_string_centerP(20, PSTR("printhead heating for")); lcd_lib_draw_string_centerP(30, PSTR("material loading")); lcd_progressbar(progress); 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); } }
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_menu_edit_setting() { if (lcd_lib_encoder_pos < lcd_setting_min) lcd_lib_encoder_pos = lcd_setting_min; if (lcd_lib_encoder_pos > lcd_setting_max) lcd_lib_encoder_pos = lcd_setting_max; if (lcd_setting_type == 1) *(uint8_t*)lcd_setting_ptr = lcd_lib_encoder_pos; else if (lcd_setting_type == 2) *(uint16_t*)lcd_setting_ptr = lcd_lib_encoder_pos; else if (lcd_setting_type == 3) *(float*)lcd_setting_ptr = float(lcd_lib_encoder_pos) / 100.0; else if (lcd_setting_type == 4) *(int32_t*)lcd_setting_ptr = lcd_lib_encoder_pos; else if (lcd_setting_type == 5) *(uint8_t*)lcd_setting_ptr = lcd_lib_encoder_pos * 255 / 100; else if (lcd_setting_type == 6) *(float*)lcd_setting_ptr = float(lcd_lib_encoder_pos) * 60; else if (lcd_setting_type == 7) *(float*)lcd_setting_ptr = float(lcd_lib_encoder_pos) * 100; else if (lcd_setting_type == 8) *(float*)lcd_setting_ptr = float(lcd_lib_encoder_pos); lcd_basic_screen(); lcd_lib_draw_string_centerP(20, lcd_setting_name); char buffer[LCD_MAX_TEXT_LINE_LENGTH + 1]; // Longest string: "Prev: 20000mm/sec^2" = 19 characters + 1 if (lcd_setting_type == 3) float_to_string(float(lcd_lib_encoder_pos) / 100.0, buffer, lcd_setting_postfix); else int_to_string(lcd_lib_encoder_pos, buffer, lcd_setting_postfix); lcd_lib_draw_string_center(30, buffer); strcpy_P(buffer, PSTR("Prev: ")); if (lcd_setting_type == 3) float_to_string(float(lcd_setting_start_value) / 100.0, buffer + 6, lcd_setting_postfix); else int_to_string(lcd_setting_start_value, buffer + 6, lcd_setting_postfix); lcd_lib_draw_string_center(53, buffer); lcd_lib_update_screen(); if (lcd_lib_button_pressed) lcd_change_to_menu(previousMenu, previousEncoderPos); }
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_first_run_material_load_forward() { lcd_basic_screen(); DRAW_PROGRESS_NR(14); lcd_lib_draw_string_centerP(20, PSTR("Loading material...")); if (!blocks_queued()) { lcd_lib_beep(); led_glow_dir = led_glow = 0; digipot_current(2, motor_current_setting[2]*2/3);//Set E motor power lower so the motor will skip instead of grind. currentMenu = lcd_menu_first_run_material_load_wait; 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_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; } }