@ -29,33 +29,6 @@
# include "stepper.h"
# include "stepper.h"
# include "configuration_store.h"
# include "configuration_store.h"
/**
* REVERSE_MENU_DIRECTION
*
* To reverse the menu direction we need a general way to reverse
* the direction of the encoder everywhere . So encoderDirection is
* added to allow the encoder to go the other way .
*
* This behavior is limited to scrolling Menus and SD card listings ,
* and is disabled in other contexts .
*/
# if ENABLED(REVERSE_MENU_DIRECTION)
int8_t encoderDirection = 1 ;
# define ENCODER_DIRECTION_NORMAL() (encoderDirection = 1)
# define ENCODER_DIRECTION_MENUS() (encoderDirection = -1)
# else
# define ENCODER_DIRECTION_NORMAL() ;
# define ENCODER_DIRECTION_MENUS() ;
# endif
int8_t encoderDiff ; // updated from interrupt context and added to encoderPosition every LCD update
int8_t manual_move_axis = ( int8_t ) NO_AXIS ;
millis_t manual_move_start_time = 0 ;
bool encoderRateMultiplierEnabled ;
int32_t lastEncoderMovementMillis ;
int plaPreheatHotendTemp ;
int plaPreheatHotendTemp ;
int plaPreheatHPBTemp ;
int plaPreheatHPBTemp ;
int plaPreheatFanSpeed ;
int plaPreheatFanSpeed ;
@ -68,9 +41,6 @@ int absPreheatFanSpeed;
millis_t previous_lcd_status_ms = 0 ;
millis_t previous_lcd_status_ms = 0 ;
# endif
# endif
// Function pointer to menu functions.
typedef void ( * menuFunc_t ) ( ) ;
uint8_t lcd_status_message_level ;
uint8_t lcd_status_message_level ;
char lcd_status_message [ 3 * ( LCD_WIDTH ) + 1 ] = WELCOME_MSG ; // worst case is kana with up to 3*LCD_WIDTH+1
char lcd_status_message [ 3 * ( LCD_WIDTH ) + 1 ] = WELCOME_MSG ; // worst case is kana with up to 3*LCD_WIDTH+1
@ -83,8 +53,50 @@ char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kan
// The main status screen
// The main status screen
static void lcd_status_screen ( ) ;
static void lcd_status_screen ( ) ;
millis_t next_lcd_update_ms ;
enum LCDViewAction {
LCDVIEW_NONE ,
LCDVIEW_REDRAW_NOW ,
LCDVIEW_CALL_REDRAW_NEXT ,
LCDVIEW_CLEAR_CALL_REDRAW ,
LCDVIEW_CALL_NO_REDRAW
} ;
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
// place-holders for Ki and Kd edits
float raw_Ki , raw_Kd ;
/**
* REVERSE_MENU_DIRECTION
*
* To reverse the menu direction we need a general way to reverse
* the direction of the encoder everywhere . So encoderDirection is
* added to allow the encoder to go the other way .
*
* This behavior is limited to scrolling Menus and SD card listings ,
* and is disabled in other contexts .
*/
# if ENABLED(REVERSE_MENU_DIRECTION)
int8_t encoderDirection = 1 ;
# define ENCODER_DIRECTION_NORMAL() (encoderDirection = 1)
# define ENCODER_DIRECTION_MENUS() (encoderDirection = -1)
# else
# define ENCODER_DIRECTION_NORMAL() ;
# define ENCODER_DIRECTION_MENUS() ;
# endif
int8_t encoderDiff ; // updated from interrupt context and added to encoderPosition every LCD update
int8_t manual_move_axis = ( int8_t ) NO_AXIS ;
millis_t manual_move_start_time = 0 ;
bool encoderRateMultiplierEnabled ;
int32_t lastEncoderMovementMillis ;
# if HAS_POWER_SWITCH
# if HAS_POWER_SWITCH
extern bool powersupply ;
extern bool powersupply ;
# endif
# endif
@ -116,7 +128,10 @@ static void lcd_status_screen();
# include "mesh_bed_leveling.h"
# include "mesh_bed_leveling.h"
# endif
# endif
/* Different types of actions that can be used in menu items. */
// Function pointer to menu functions.
typedef void ( * menuFunc_t ) ( ) ;
// Different types of actions that can be used in menu items.
static void menu_action_back ( ) ;
static void menu_action_back ( ) ;
static void menu_action_submenu ( menuFunc_t data ) ;
static void menu_action_submenu ( menuFunc_t data ) ;
static void menu_action_gcode ( const char * pgcode ) ;
static void menu_action_gcode ( const char * pgcode ) ;
@ -270,49 +285,31 @@ static void lcd_status_screen();
uint8_t lcd_sd_status ;
uint8_t lcd_sd_status ;
# endif
# endif
# endif // ULTIPANEL
typedef struct {
typedef struct {
menuFunc_t menu_function ;
menuFunc_t menu_function ;
# if ENABLED(ULTIPANEL)
uint32_t encoder_position ;
uint32_t encoder_position ;
# endif
} menuPosition ;
} menuPosition ;
menuFunc_t currentMenu = lcd_status_screen ; // pointer to the currently active menu handler
menuFunc_t currentMenu = lcd_status_screen ; // pointer to the currently active menu handler
menuPosition menu_history [ 10 ] ;
menuPosition menu_history [ 10 ] ;
uint8_t menu_history_depth = 0 ;
uint8_t menu_history_depth = 0 ;
millis_t next_lcd_update_ms ;
bool ignore_click = false ;
bool ignore_click = false ;
bool wait_for_unclick ;
bool wait_for_unclick ;
bool defer_return_to_status = false ;
bool defer_return_to_status = false ;
enum LCDViewAction {
// Variables used when editing values.
LCDVIEW_NONE ,
const char * editLabel ;
LCDVIEW_REDRAW_NOW ,
void * editValue ;
LCDVIEW_CALL_REDRAW_NEXT ,
int32_t minEditValue , maxEditValue ;
LCDVIEW_CLEAR_CALL_REDRAW ,
menuFunc_t callbackFunc ; // call this after editing
LCDVIEW_CALL_NO_REDRAW
} ;
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
// Variables used when editing values.
const char * editLabel ;
void * editValue ;
int32_t minEditValue , maxEditValue ;
menuFunc_t callbackFunc ; // call this after editing
// place-holders for Ki and Kd edits
float raw_Ki , raw_Kd ;
/**
/**
* General function to go directly to a menu
* General function to go directly to a menu
* Remembers the previous position
* Remembers the previous position
*/
*/
static void lcd_goto_menu ( menuFunc_t menu , const bool feedback = false , const uint32_t encoder = 0 ) {
static void lcd_goto_menu ( menuFunc_t menu , const bool feedback = false , const uint32_t encoder = 0 ) {
if ( currentMenu ! = menu ) {
if ( currentMenu ! = menu ) {
currentMenu = menu ;
currentMenu = menu ;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
@ -329,11 +326,11 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
lcd_set_custom_characters ( menu = = lcd_status_screen ) ;
lcd_set_custom_characters ( menu = = lcd_status_screen ) ;
# endif
# endif
}
}
}
}
static void lcd_return_to_status ( ) { lcd_goto_menu ( lcd_status_screen ) ; }
static void lcd_return_to_status ( ) { lcd_goto_menu ( lcd_status_screen ) ; }
inline void lcd_save_previous_menu ( ) {
inline void lcd_save_previous_menu ( ) {
if ( menu_history_depth < COUNT ( menu_history ) ) {
if ( menu_history_depth < COUNT ( menu_history ) ) {
menu_history [ menu_history_depth ] . menu_function = currentMenu ;
menu_history [ menu_history_depth ] . menu_function = currentMenu ;
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
@ -341,9 +338,9 @@ inline void lcd_save_previous_menu() {
# endif
# endif
+ + menu_history_depth ;
+ + menu_history_depth ;
}
}
}
}
static void lcd_goto_previous_menu ( bool feedback = false ) {
static void lcd_goto_previous_menu ( bool feedback = false ) {
if ( menu_history_depth > 0 ) {
if ( menu_history_depth > 0 ) {
- - menu_history_depth ;
- - menu_history_depth ;
lcd_goto_menu ( menu_history [ menu_history_depth ] . menu_function , feedback
lcd_goto_menu ( menu_history [ menu_history_depth ] . menu_function , feedback
@ -354,7 +351,14 @@ static void lcd_goto_previous_menu(bool feedback=false) {
}
}
else
else
lcd_return_to_status ( ) ;
lcd_return_to_status ( ) ;
}
}
void lcd_ignore_click ( bool b ) {
ignore_click = b ;
wait_for_unclick = false ;
}
# endif // ULTIPANEL
/**
/**
*
*
@ -364,8 +368,11 @@ static void lcd_goto_previous_menu(bool feedback=false) {
*/
*/
static void lcd_status_screen ( ) {
static void lcd_status_screen ( ) {
# if ENABLED(ULTIPANEL)
ENCODER_DIRECTION_NORMAL ( ) ;
ENCODER_DIRECTION_NORMAL ( ) ;
encoderRateMultiplierEnabled = false ;
encoderRateMultiplierEnabled = false ;
# endif
# if ENABLED(LCD_PROGRESS_BAR)
# if ENABLED(LCD_PROGRESS_BAR)
millis_t ms = millis ( ) ;
millis_t ms = millis ( ) ;
@ -423,7 +430,7 @@ static void lcd_status_screen() {
if ( current_click ) {
if ( current_click ) {
lcd_goto_menu ( lcd_main_menu , true ) ;
lcd_goto_menu ( lcd_main_menu , true ) ;
lcd_implementation_init ( // to maybe revive the LCD if static electricity killed it.
lcd_implementation_init ( // to maybe revive the LCD if static electricity killed it.
# if ENABLED(LCD_PROGRESS_BAR)
# if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
currentMenu = = lcd_status_screen
currentMenu = = lcd_status_screen
# endif
# endif
) ;
) ;
@ -462,16 +469,16 @@ static void lcd_status_screen() {
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
inline void line_to_current ( AxisEnum axis ) {
inline void line_to_current ( AxisEnum axis ) {
# if ENABLED(DELTA)
# if ENABLED(DELTA)
calculate_delta ( current_position ) ;
calculate_delta ( current_position ) ;
planner . buffer_line ( delta [ X_AXIS ] , delta [ Y_AXIS ] , delta [ Z_AXIS ] , current_position [ E_AXIS ] , manual_feedrate [ axis ] / 60 , active_extruder ) ;
planner . buffer_line ( delta [ X_AXIS ] , delta [ Y_AXIS ] , delta [ Z_AXIS ] , current_position [ E_AXIS ] , manual_feedrate [ axis ] / 60 , active_extruder ) ;
# else
# else // !DELTA
planner . buffer_line ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] , manual_feedrate [ axis ] / 60 , active_extruder ) ;
planner . buffer_line ( current_position [ X_AXIS ] , current_position [ Y_AXIS ] , current_position [ Z_AXIS ] , current_position [ E_AXIS ] , manual_feedrate [ axis ] / 60 , active_extruder ) ;
# endif
# endif // !DELTA
}
}
# if ENABLED(SDSUPPORT)
# if ENABLED(SDSUPPORT)
static void lcd_sdcard_pause ( ) {
static void lcd_sdcard_pause ( ) {
card . pauseSDPrint ( ) ;
card . pauseSDPrint ( ) ;
@ -487,7 +494,7 @@ inline void line_to_current(AxisEnum axis) {
stepper . quick_stop ( ) ;
stepper . quick_stop ( ) ;
# if DISABLED(DELTA) && DISABLED(SCARA)
# if DISABLED(DELTA) && DISABLED(SCARA)
set_current_position_from_planner ( ) ;
set_current_position_from_planner ( ) ;
# endif
# endif // !DELTA && !SCARA
clear_command_queue ( ) ;
clear_command_queue ( ) ;
card . sdprinting = false ;
card . sdprinting = false ;
card . closefile ( ) ;
card . closefile ( ) ;
@ -497,15 +504,15 @@ inline void line_to_current(AxisEnum axis) {
lcd_setstatus ( MSG_PRINT_ABORTED , true ) ;
lcd_setstatus ( MSG_PRINT_ABORTED , true ) ;
}
}
# endif //SDSUPPORT
# endif //SDSUPPORT
/**
/**
*
*
* " Main " menu
* " Main " menu
*
*
*/
*/
static void lcd_main_menu ( ) {
static void lcd_main_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_WATCH ) ;
MENU_ITEM ( back , MSG_WATCH ) ;
if ( planner . movesplanned ( ) | | IS_SD_PRINTING ) {
if ( planner . movesplanned ( ) | | IS_SD_PRINTING ) {
@ -544,24 +551,24 @@ static void lcd_main_menu() {
# endif //SDSUPPORT
# endif //SDSUPPORT
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Tune " submenu items
* " Tune " submenu items
*
*
*/
*/
/**
/**
* Set the home offset based on the current_position
* Set the home offset based on the current_position
*/
*/
void lcd_set_home_offsets ( ) {
void lcd_set_home_offsets ( ) {
// M428 Command
// M428 Command
enqueue_and_echo_commands_P ( PSTR ( " M428 " ) ) ;
enqueue_and_echo_commands_P ( PSTR ( " M428 " ) ) ;
lcd_return_to_status ( ) ;
lcd_return_to_status ( ) ;
}
}
# if ENABLED(BABYSTEPPING)
# if ENABLED(BABYSTEPPING)
int babysteps_done = 0 ;
int babysteps_done = 0 ;
@ -587,12 +594,12 @@ void lcd_set_home_offsets() {
static void _lcd_babystep_z ( ) { _lcd_babystep ( Z_AXIS , PSTR ( MSG_BABYSTEPPING_Z ) ) ; }
static void _lcd_babystep_z ( ) { _lcd_babystep ( Z_AXIS , PSTR ( MSG_BABYSTEPPING_Z ) ) ; }
static void lcd_babystep_z ( ) { babysteps_done = 0 ; lcd_goto_menu ( _lcd_babystep_z ) ; }
static void lcd_babystep_z ( ) { babysteps_done = 0 ; lcd_goto_menu ( _lcd_babystep_z ) ; }
# endif //BABYSTEPPING
# endif //BABYSTEPPING
/**
/**
* Watch temperature callbacks
* Watch temperature callbacks
*/
*/
# if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
# if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
# if TEMP_SENSOR_0 != 0
# if TEMP_SENSOR_0 != 0
void watch_temp_callback_E0 ( ) { thermalManager . start_watching_heater ( 0 ) ; }
void watch_temp_callback_E0 ( ) { thermalManager . start_watching_heater ( 0 ) ; }
# endif
# endif
@ -605,7 +612,7 @@ void lcd_set_home_offsets() {
# if HOTENDS > 3 && TEMP_SENSOR_3 != 0
# if HOTENDS > 3 && TEMP_SENSOR_3 != 0
void watch_temp_callback_E3 ( ) { thermalManager . start_watching_heater ( 3 ) ; }
void watch_temp_callback_E3 ( ) { thermalManager . start_watching_heater ( 3 ) ; }
# endif // HOTENDS > 3
# endif // HOTENDS > 3
# else
# else
# if TEMP_SENSOR_0 != 0
# if TEMP_SENSOR_0 != 0
void watch_temp_callback_E0 ( ) { }
void watch_temp_callback_E0 ( ) { }
# endif
# endif
@ -618,24 +625,24 @@ void lcd_set_home_offsets() {
# if HOTENDS > 3 && TEMP_SENSOR_3 != 0
# if HOTENDS > 3 && TEMP_SENSOR_3 != 0
void watch_temp_callback_E3 ( ) { }
void watch_temp_callback_E3 ( ) { }
# endif // HOTENDS > 3
# endif // HOTENDS > 3
# endif
# endif
# if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
# if ENABLED(THERMAL_PROTECTION_BED) && WATCH_BED_TEMP_PERIOD > 0
# if TEMP_SENSOR_BED != 0
# if TEMP_SENSOR_BED != 0
void watch_temp_callback_bed ( ) { thermalManager . start_watching_bed ( ) ; }
void watch_temp_callback_bed ( ) { thermalManager . start_watching_bed ( ) ; }
# endif
# endif
# else
# else
# if TEMP_SENSOR_BED != 0
# if TEMP_SENSOR_BED != 0
void watch_temp_callback_bed ( ) { }
void watch_temp_callback_bed ( ) { }
# endif
# endif
# endif
# endif
/**
/**
*
*
* " Tune " submenu
* " Tune " submenu
*
*
*/
*/
static void lcd_tune_menu ( ) {
static void lcd_tune_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
//
//
@ -749,14 +756,14 @@ static void lcd_tune_menu() {
# endif
# endif
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Prepare " submenu items
* " Prepare " submenu items
*
*
*/
*/
void _lcd_preheat ( int endnum , const float temph , const float tempb , const int fan ) {
void _lcd_preheat ( int endnum , const float temph , const float tempb , const int fan ) {
if ( temph > 0 ) thermalManager . setTargetHotend ( temph , endnum ) ;
if ( temph > 0 ) thermalManager . setTargetHotend ( temph , endnum ) ;
# if TEMP_SENSOR_BED != 0
# if TEMP_SENSOR_BED != 0
thermalManager . setTargetBed ( tempb ) ;
thermalManager . setTargetBed ( tempb ) ;
@ -773,14 +780,14 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
UNUSED ( fan ) ;
UNUSED ( fan ) ;
# endif
# endif
lcd_return_to_status ( ) ;
lcd_return_to_status ( ) ;
}
}
# if TEMP_SENSOR_0 != 0
# if TEMP_SENSOR_0 != 0
void lcd_preheat_pla0 ( ) { _lcd_preheat ( 0 , plaPreheatHotendTemp , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_pla0 ( ) { _lcd_preheat ( 0 , plaPreheatHotendTemp , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_abs0 ( ) { _lcd_preheat ( 0 , absPreheatHotendTemp , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
void lcd_preheat_abs0 ( ) { _lcd_preheat ( 0 , absPreheatHotendTemp , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
# endif
# endif
# if HOTENDS > 1
# if HOTENDS > 1
void lcd_preheat_pla1 ( ) { _lcd_preheat ( 1 , plaPreheatHotendTemp , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_pla1 ( ) { _lcd_preheat ( 1 , plaPreheatHotendTemp , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_abs1 ( ) { _lcd_preheat ( 1 , absPreheatHotendTemp , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
void lcd_preheat_abs1 ( ) { _lcd_preheat ( 1 , absPreheatHotendTemp , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
# if HOTENDS > 2
# if HOTENDS > 2
@ -817,14 +824,14 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
lcd_preheat_abs0 ( ) ;
lcd_preheat_abs0 ( ) ;
}
}
# endif // HOTENDS > 1
# endif // HOTENDS > 1
# if TEMP_SENSOR_BED != 0
# if TEMP_SENSOR_BED != 0
void lcd_preheat_pla_bedonly ( ) { _lcd_preheat ( 0 , 0 , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_pla_bedonly ( ) { _lcd_preheat ( 0 , 0 , plaPreheatHPBTemp , plaPreheatFanSpeed ) ; }
void lcd_preheat_abs_bedonly ( ) { _lcd_preheat ( 0 , 0 , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
void lcd_preheat_abs_bedonly ( ) { _lcd_preheat ( 0 , 0 , absPreheatHPBTemp , absPreheatFanSpeed ) ; }
# endif
# endif
# if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
# if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
static void lcd_preheat_pla_menu ( ) {
static void lcd_preheat_pla_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
@ -870,17 +877,17 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_BED)
# endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_BED)
void lcd_cooldown ( ) {
void lcd_cooldown ( ) {
# if FAN_COUNT > 0
# if FAN_COUNT > 0
for ( uint8_t i = 0 ; i < FAN_COUNT ; i + + ) fanSpeeds [ i ] = 0 ;
for ( uint8_t i = 0 ; i < FAN_COUNT ; i + + ) fanSpeeds [ i ] = 0 ;
# endif
# endif
thermalManager . disable_all_heaters ( ) ;
thermalManager . disable_all_heaters ( ) ;
lcd_return_to_status ( ) ;
lcd_return_to_status ( ) ;
}
}
# if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
# if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
static void lcd_autostart_sd ( ) {
static void lcd_autostart_sd ( ) {
card . autostart_index = 0 ;
card . autostart_index = 0 ;
@ -888,9 +895,9 @@ void lcd_cooldown() {
card . checkautostart ( true ) ;
card . checkautostart ( true ) ;
}
}
# endif
# endif
# if ENABLED(MANUAL_BED_LEVELING)
# if ENABLED(MANUAL_BED_LEVELING)
/**
/**
*
*
@ -1086,15 +1093,15 @@ void lcd_cooldown() {
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# endif // MANUAL_BED_LEVELING
# endif // MANUAL_BED_LEVELING
/**
/**
*
*
* " Prepare " submenu
* " Prepare " submenu
*
*
*/
*/
static void lcd_prepare_menu ( ) {
static void lcd_prepare_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
//
//
@ -1176,9 +1183,9 @@ static void lcd_prepare_menu() {
# endif
# endif
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# if ENABLED(DELTA_CALIBRATION_MENU)
# if ENABLED(DELTA_CALIBRATION_MENU)
static void lcd_delta_calibrate_menu ( ) {
static void lcd_delta_calibrate_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
@ -1191,13 +1198,13 @@ static void lcd_prepare_menu() {
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# endif // DELTA_CALIBRATION_MENU
# endif // DELTA_CALIBRATION_MENU
/**
/**
* If the most recent manual move hasn ' t been fed to the planner yet ,
* If the most recent manual move hasn ' t been fed to the planner yet ,
* and the planner can accept one , send immediately
* and the planner can accept one , send immediately
*/
*/
inline void manage_manual_move ( ) {
inline void manage_manual_move ( ) {
if ( manual_move_axis ! = ( int8_t ) NO_AXIS & & millis ( ) > = manual_move_start_time & & ! planner . is_full ( ) ) {
if ( manual_move_axis ! = ( int8_t ) NO_AXIS & & millis ( ) > = manual_move_start_time & & ! planner . is_full ( ) ) {
# if ENABLED(DELTA)
# if ENABLED(DELTA)
calculate_delta ( current_position ) ;
calculate_delta ( current_position ) ;
@ -1207,26 +1214,26 @@ inline void manage_manual_move() {
# endif
# endif
manual_move_axis = ( int8_t ) NO_AXIS ;
manual_move_axis = ( int8_t ) NO_AXIS ;
}
}
}
}
/**
/**
* Set a flag that lcd_update ( ) should start a move
* Set a flag that lcd_update ( ) should start a move
* to " current_position " after a short delay .
* to " current_position " after a short delay .
*/
*/
inline void manual_move_to_current ( AxisEnum axis ) {
inline void manual_move_to_current ( AxisEnum axis ) {
manual_move_start_time = millis ( ) + 500UL ; // 1/2 second delay
manual_move_start_time = millis ( ) + 500UL ; // 1/2 second delay
manual_move_axis = ( int8_t ) axis ;
manual_move_axis = ( int8_t ) axis ;
}
}
/**
/**
*
*
* " Prepare " > " Move Axis " submenu
* " Prepare " > " Move Axis " submenu
*
*
*/
*/
float move_menu_scale ;
float move_menu_scale ;
static void _lcd_move ( const char * name , AxisEnum axis , float min , float max ) {
static void _lcd_move ( const char * name , AxisEnum axis , float min , float max ) {
ENCODER_DIRECTION_NORMAL ( ) ;
ENCODER_DIRECTION_NORMAL ( ) ;
if ( encoderPosition ) {
if ( encoderPosition ) {
refresh_cmd_timeout ( ) ;
refresh_cmd_timeout ( ) ;
@ -1239,22 +1246,22 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
}
}
if ( lcdDrawUpdate ) lcd_implementation_drawedit ( name , ftostr41sign ( current_position [ axis ] ) ) ;
if ( lcdDrawUpdate ) lcd_implementation_drawedit ( name , ftostr41sign ( current_position [ axis ] ) ) ;
if ( LCD_CLICKED ) lcd_goto_previous_menu ( true ) ;
if ( LCD_CLICKED ) lcd_goto_previous_menu ( true ) ;
}
}
# if ENABLED(DELTA)
# if ENABLED(DELTA)
static float delta_clip_radius_2 = ( DELTA_PRINTABLE_RADIUS ) * ( DELTA_PRINTABLE_RADIUS ) ;
static float delta_clip_radius_2 = ( DELTA_PRINTABLE_RADIUS ) * ( DELTA_PRINTABLE_RADIUS ) ;
static int delta_clip ( float a ) { return sqrt ( delta_clip_radius_2 - a * a ) ; }
static int delta_clip ( float a ) { return sqrt ( delta_clip_radius_2 - a * a ) ; }
static void lcd_move_x ( ) { int clip = delta_clip ( current_position [ Y_AXIS ] ) ; _lcd_move ( PSTR ( MSG_MOVE_X ) , X_AXIS , max ( sw_endstop_min [ X_AXIS ] , - clip ) , min ( sw_endstop_max [ X_AXIS ] , clip ) ) ; }
static void lcd_move_x ( ) { int clip = delta_clip ( current_position [ Y_AXIS ] ) ; _lcd_move ( PSTR ( MSG_MOVE_X ) , X_AXIS , max ( sw_endstop_min [ X_AXIS ] , - clip ) , min ( sw_endstop_max [ X_AXIS ] , clip ) ) ; }
static void lcd_move_y ( ) { int clip = delta_clip ( current_position [ X_AXIS ] ) ; _lcd_move ( PSTR ( MSG_MOVE_Y ) , Y_AXIS , max ( sw_endstop_min [ Y_AXIS ] , - clip ) , min ( sw_endstop_max [ Y_AXIS ] , clip ) ) ; }
static void lcd_move_y ( ) { int clip = delta_clip ( current_position [ X_AXIS ] ) ; _lcd_move ( PSTR ( MSG_MOVE_Y ) , Y_AXIS , max ( sw_endstop_min [ Y_AXIS ] , - clip ) , min ( sw_endstop_max [ Y_AXIS ] , clip ) ) ; }
# else
# else
static void lcd_move_x ( ) { _lcd_move ( PSTR ( MSG_MOVE_X ) , X_AXIS , sw_endstop_min [ X_AXIS ] , sw_endstop_max [ X_AXIS ] ) ; }
static void lcd_move_x ( ) { _lcd_move ( PSTR ( MSG_MOVE_X ) , X_AXIS , sw_endstop_min [ X_AXIS ] , sw_endstop_max [ X_AXIS ] ) ; }
static void lcd_move_y ( ) { _lcd_move ( PSTR ( MSG_MOVE_Y ) , Y_AXIS , sw_endstop_min [ Y_AXIS ] , sw_endstop_max [ Y_AXIS ] ) ; }
static void lcd_move_y ( ) { _lcd_move ( PSTR ( MSG_MOVE_Y ) , Y_AXIS , sw_endstop_min [ Y_AXIS ] , sw_endstop_max [ Y_AXIS ] ) ; }
# endif
# endif
static void lcd_move_z ( ) { _lcd_move ( PSTR ( MSG_MOVE_Z ) , Z_AXIS , sw_endstop_min [ Z_AXIS ] , sw_endstop_max [ Z_AXIS ] ) ; }
static void lcd_move_z ( ) { _lcd_move ( PSTR ( MSG_MOVE_Z ) , Z_AXIS , sw_endstop_min [ Z_AXIS ] , sw_endstop_max [ Z_AXIS ] ) ; }
static void lcd_move_e (
static void lcd_move_e (
# if EXTRUDERS > 1
# if EXTRUDERS > 1
uint8_t e
uint8_t e
# endif
# endif
) {
) {
ENCODER_DIRECTION_NORMAL ( ) ;
ENCODER_DIRECTION_NORMAL ( ) ;
# if EXTRUDERS > 1
# if EXTRUDERS > 1
unsigned short original_active_extruder = active_extruder ;
unsigned short original_active_extruder = active_extruder ;
@ -1288,9 +1295,9 @@ static void lcd_move_e(
# if EXTRUDERS > 1
# if EXTRUDERS > 1
active_extruder = original_active_extruder ;
active_extruder = original_active_extruder ;
# endif
# endif
}
}
# if EXTRUDERS > 1
# if EXTRUDERS > 1
static void lcd_move_e0 ( ) { lcd_move_e ( 0 ) ; }
static void lcd_move_e0 ( ) { lcd_move_e ( 0 ) ; }
static void lcd_move_e1 ( ) { lcd_move_e ( 1 ) ; }
static void lcd_move_e1 ( ) { lcd_move_e ( 1 ) ; }
# if EXTRUDERS > 2
# if EXTRUDERS > 2
@ -1299,21 +1306,21 @@ static void lcd_move_e(
static void lcd_move_e3 ( ) { lcd_move_e ( 3 ) ; }
static void lcd_move_e3 ( ) { lcd_move_e ( 3 ) ; }
# endif
# endif
# endif
# endif
# endif // EXTRUDERS > 1
# endif // EXTRUDERS > 1
/**
/**
*
*
* " Prepare " > " Move Xmm " > " Move XYZ " submenu
* " Prepare " > " Move Xmm " > " Move XYZ " submenu
*
*
*/
*/
# if ENABLED(DELTA) || ENABLED(SCARA)
# if ENABLED(DELTA) || ENABLED(SCARA)
# define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
# define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
# else
# else
# define _MOVE_XYZ_ALLOWED true
# define _MOVE_XYZ_ALLOWED true
# endif
# endif
static void _lcd_move_menu_axis ( ) {
static void _lcd_move_menu_axis ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_MOVE_AXIS ) ;
MENU_ITEM ( back , MSG_MOVE_AXIS ) ;
@ -1337,28 +1344,28 @@ static void _lcd_move_menu_axis() {
# endif // EXTRUDERS > 1
# endif // EXTRUDERS > 1
}
}
END_MENU ( ) ;
END_MENU ( ) ;
}
}
static void lcd_move_menu_10mm ( ) {
static void lcd_move_menu_10mm ( ) {
move_menu_scale = 10.0 ;
move_menu_scale = 10.0 ;
_lcd_move_menu_axis ( ) ;
_lcd_move_menu_axis ( ) ;
}
}
static void lcd_move_menu_1mm ( ) {
static void lcd_move_menu_1mm ( ) {
move_menu_scale = 1.0 ;
move_menu_scale = 1.0 ;
_lcd_move_menu_axis ( ) ;
_lcd_move_menu_axis ( ) ;
}
}
static void lcd_move_menu_01mm ( ) {
static void lcd_move_menu_01mm ( ) {
move_menu_scale = 0.1 ;
move_menu_scale = 0.1 ;
_lcd_move_menu_axis ( ) ;
_lcd_move_menu_axis ( ) ;
}
}
/**
/**
*
*
* " Prepare " > " Move Axis " submenu
* " Prepare " > " Move Axis " submenu
*
*
*/
*/
static void lcd_move_menu ( ) {
static void lcd_move_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_PREPARE ) ;
MENU_ITEM ( back , MSG_PREPARE ) ;
@ -1369,15 +1376,15 @@ static void lcd_move_menu() {
MENU_ITEM ( submenu , MSG_MOVE_01MM , lcd_move_menu_01mm ) ;
MENU_ITEM ( submenu , MSG_MOVE_01MM , lcd_move_menu_01mm ) ;
//TODO:X,Y,Z,E
//TODO:X,Y,Z,E
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Control " submenu
* " Control " submenu
*
*
*/
*/
static void lcd_control_menu ( ) {
static void lcd_control_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_MAIN ) ;
MENU_ITEM ( back , MSG_MAIN ) ;
MENU_ITEM ( submenu , MSG_TEMPERATURE , lcd_control_temperature_menu ) ;
MENU_ITEM ( submenu , MSG_TEMPERATURE , lcd_control_temperature_menu ) ;
@ -1397,15 +1404,15 @@ static void lcd_control_menu() {
# endif
# endif
MENU_ITEM ( function , MSG_RESTORE_FAILSAFE , Config_ResetDefault ) ;
MENU_ITEM ( function , MSG_RESTORE_FAILSAFE , Config_ResetDefault ) ;
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Temperature " submenu
* " Temperature " submenu
*
*
*/
*/
# if ENABLED(PID_AUTOTUNE_MENU)
# if ENABLED(PID_AUTOTUNE_MENU)
# if ENABLED(PIDTEMP)
# if ENABLED(PIDTEMP)
int autotune_temp [ HOTENDS ] = ARRAY_BY_HOTENDS1 ( 150 ) ;
int autotune_temp [ HOTENDS ] = ARRAY_BY_HOTENDS1 ( 150 ) ;
@ -1430,9 +1437,9 @@ static void lcd_control_menu() {
enqueue_and_echo_command ( cmd ) ;
enqueue_and_echo_command ( cmd ) ;
}
}
# endif //PID_AUTOTUNE_MENU
# endif //PID_AUTOTUNE_MENU
# if ENABLED(PIDTEMP)
# if ENABLED(PIDTEMP)
// Helpers for editing PID Ki & Kd values
// Helpers for editing PID Ki & Kd values
// grab the PID value out of the temp variable; scale it; then update the PID driver
// grab the PID value out of the temp variable; scale it; then update the PID driver
@ -1475,14 +1482,14 @@ static void lcd_control_menu() {
# endif //HOTENDS > 1
# endif //HOTENDS > 1
# endif //PID_PARAMS_PER_HOTEND
# endif //PID_PARAMS_PER_HOTEND
# endif //PIDTEMP
# endif //PIDTEMP
/**
/**
*
*
* " Control " > " Temperature " submenu
* " Control " > " Temperature " submenu
*
*
*/
*/
static void lcd_control_temperature_menu ( ) {
static void lcd_control_temperature_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
//
//
@ -1611,14 +1618,14 @@ static void lcd_control_temperature_menu() {
//
//
MENU_ITEM ( submenu , MSG_PREHEAT_ABS_SETTINGS , lcd_control_temperature_preheat_abs_settings_menu ) ;
MENU_ITEM ( submenu , MSG_PREHEAT_ABS_SETTINGS , lcd_control_temperature_preheat_abs_settings_menu ) ;
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Temperature " > " Preheat PLA conf " submenu
* " Temperature " > " Preheat PLA conf " submenu
*
*
*/
*/
static void lcd_control_temperature_preheat_pla_settings_menu ( ) {
static void lcd_control_temperature_preheat_pla_settings_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_TEMPERATURE ) ;
MENU_ITEM ( back , MSG_TEMPERATURE ) ;
MENU_ITEM_EDIT ( int3 , MSG_FAN_SPEED , & plaPreheatFanSpeed , 0 , 255 ) ;
MENU_ITEM_EDIT ( int3 , MSG_FAN_SPEED , & plaPreheatFanSpeed , 0 , 255 ) ;
@ -1632,14 +1639,14 @@ static void lcd_control_temperature_preheat_pla_settings_menu() {
MENU_ITEM ( function , MSG_STORE_EPROM , Config_StoreSettings ) ;
MENU_ITEM ( function , MSG_STORE_EPROM , Config_StoreSettings ) ;
# endif
# endif
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Temperature " > " Preheat ABS conf " submenu
* " Temperature " > " Preheat ABS conf " submenu
*
*
*/
*/
static void lcd_control_temperature_preheat_abs_settings_menu ( ) {
static void lcd_control_temperature_preheat_abs_settings_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_TEMPERATURE ) ;
MENU_ITEM ( back , MSG_TEMPERATURE ) ;
MENU_ITEM_EDIT ( int3 , MSG_FAN_SPEED , & absPreheatFanSpeed , 0 , 255 ) ;
MENU_ITEM_EDIT ( int3 , MSG_FAN_SPEED , & absPreheatFanSpeed , 0 , 255 ) ;
@ -1653,16 +1660,16 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
MENU_ITEM ( function , MSG_STORE_EPROM , Config_StoreSettings ) ;
MENU_ITEM ( function , MSG_STORE_EPROM , Config_StoreSettings ) ;
# endif
# endif
END_MENU ( ) ;
END_MENU ( ) ;
}
}
static void _reset_acceleration_rates ( ) { planner . reset_acceleration_rates ( ) ; }
static void _reset_acceleration_rates ( ) { planner . reset_acceleration_rates ( ) ; }
/**
/**
*
*
* " Control " > " Motion " submenu
* " Control " > " Motion " submenu
*
*
*/
*/
static void lcd_control_motion_menu ( ) {
static void lcd_control_motion_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
# if ENABLED(AUTO_BED_LEVELING_FEATURE)
# if ENABLED(AUTO_BED_LEVELING_FEATURE)
@ -1708,14 +1715,14 @@ static void lcd_control_motion_menu() {
MENU_ITEM_EDIT ( float74 , MSG_YSCALE , & axis_scaling [ Y_AXIS ] , 0.5 , 2 ) ;
MENU_ITEM_EDIT ( float74 , MSG_YSCALE , & axis_scaling [ Y_AXIS ] , 0.5 , 2 ) ;
# endif
# endif
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Control " > " Filament " submenu
* " Control " > " Filament " submenu
*
*
*/
*/
static void lcd_control_volumetric_menu ( ) {
static void lcd_control_volumetric_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
@ -1737,14 +1744,14 @@ static void lcd_control_volumetric_menu() {
}
}
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
/**
*
*
* " Control " > " Contrast " submenu
* " Control " > " Contrast " submenu
*
*
*/
*/
# if HAS_LCD_CONTRAST
# if HAS_LCD_CONTRAST
static void lcd_set_contrast ( ) {
static void lcd_set_contrast ( ) {
ENCODER_DIRECTION_NORMAL ( ) ;
ENCODER_DIRECTION_NORMAL ( ) ;
if ( encoderPosition ) {
if ( encoderPosition ) {
@ -1763,14 +1770,14 @@ static void lcd_control_volumetric_menu() {
}
}
if ( LCD_CLICKED ) lcd_goto_previous_menu ( true ) ;
if ( LCD_CLICKED ) lcd_goto_previous_menu ( true ) ;
}
}
# endif // HAS_LCD_CONTRAST
# endif // HAS_LCD_CONTRAST
/**
/**
*
*
* " Control " > " Retract " submenu
* " Control " > " Retract " submenu
*
*
*/
*/
# if ENABLED(FWRETRACT)
# if ENABLED(FWRETRACT)
static void lcd_control_retract_menu ( ) {
static void lcd_control_retract_menu ( ) {
START_MENU ( ) ;
START_MENU ( ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
MENU_ITEM ( back , MSG_CONTROL ) ;
@ -1788,9 +1795,9 @@ static void lcd_control_volumetric_menu() {
MENU_ITEM_EDIT ( float3 , MSG_CONTROL_RETRACT_RECOVERF , & retract_recover_feedrate , 1 , 999 ) ;
MENU_ITEM_EDIT ( float3 , MSG_CONTROL_RETRACT_RECOVERF , & retract_recover_feedrate , 1 , 999 ) ;
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# endif // FWRETRACT
# endif // FWRETRACT
# if ENABLED(SDSUPPORT)
# if ENABLED(SDSUPPORT)
# if !PIN_EXISTS(SD_DETECT)
# if !PIN_EXISTS(SD_DETECT)
static void lcd_sd_refresh ( ) {
static void lcd_sd_refresh ( ) {
@ -1846,9 +1853,9 @@ static void lcd_control_volumetric_menu() {
END_MENU ( ) ;
END_MENU ( ) ;
}
}
# endif //SDSUPPORT
# endif //SDSUPPORT
/**
/**
*
*
* Functions for editing single values
* Functions for editing single values
*
*
@ -1874,7 +1881,7 @@ static void lcd_control_volumetric_menu() {
*
*
* menu_action_setting_edit_int3 ( PSTR ( MSG_SPEED ) , & feedrate_multiplier , 10 , 999 )
* menu_action_setting_edit_int3 ( PSTR ( MSG_SPEED ) , & feedrate_multiplier , 10 , 999 )
*/
*/
# define menu_edit_type(_type, _name, _strFunc, scale) \
# define menu_edit_type(_type, _name, _strFunc, scale) \
bool _menu_edit_ # # _name ( ) { \
bool _menu_edit_ # # _name ( ) { \
ENCODER_DIRECTION_NORMAL ( ) ; \
ENCODER_DIRECTION_NORMAL ( ) ; \
bool isClicked = LCD_CLICKED ; \
bool isClicked = LCD_CLICKED ; \
@ -1910,21 +1917,21 @@ static void lcd_control_volumetric_menu() {
currentMenu = menu_edit_callback_ # # _name ; \
currentMenu = menu_edit_callback_ # # _name ; \
callbackFunc = callback ; \
callbackFunc = callback ; \
}
}
menu_edit_type ( int , int3 , itostr3 , 1 ) ;
menu_edit_type ( int , int3 , itostr3 , 1 ) ;
menu_edit_type ( float , float3 , ftostr3 , 1 ) ;
menu_edit_type ( float , float3 , ftostr3 , 1 ) ;
menu_edit_type ( float , float32 , ftostr32 , 100 ) ;
menu_edit_type ( float , float32 , ftostr32 , 100 ) ;
menu_edit_type ( float , float43 , ftostr43sign , 1000 ) ;
menu_edit_type ( float , float43 , ftostr43sign , 1000 ) ;
menu_edit_type ( float , float5 , ftostr5rj , 0.01 ) ;
menu_edit_type ( float , float5 , ftostr5rj , 0.01 ) ;
menu_edit_type ( float , float51 , ftostr51sign , 10 ) ;
menu_edit_type ( float , float51 , ftostr51sign , 10 ) ;
menu_edit_type ( float , float52 , ftostr52sign , 100 ) ;
menu_edit_type ( float , float52 , ftostr52sign , 100 ) ;
menu_edit_type ( unsigned long , long5 , ftostr5rj , 0.01 ) ;
menu_edit_type ( unsigned long , long5 , ftostr5rj , 0.01 ) ;
/**
/**
*
*
* Handlers for RepRap World Keypad input
* Handlers for RepRap World Keypad input
*
*
*/
*/
# if ENABLED(REPRAPWORLD_KEYPAD)
# if ENABLED(REPRAPWORLD_KEYPAD)
static void reprapworld_keypad_move_z_up ( ) {
static void reprapworld_keypad_move_z_up ( ) {
encoderPosition = 1 ;
encoderPosition = 1 ;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP ;
move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP ;
@ -1958,22 +1965,22 @@ menu_edit_type(unsigned long, long5, ftostr5rj, 0.01);
static void reprapworld_keypad_move_home ( ) {
static void reprapworld_keypad_move_home ( ) {
enqueue_and_echo_commands_P ( PSTR ( " G28 " ) ) ; // move all axes home
enqueue_and_echo_commands_P ( PSTR ( " G28 " ) ) ; // move all axes home
}
}
# endif // REPRAPWORLD_KEYPAD
# endif // REPRAPWORLD_KEYPAD
/**
/**
*
*
* Audio feedback for controller clicks
* Audio feedback for controller clicks
*
*
*/
*/
# if ENABLED(LCD_USE_I2C_BUZZER)
# if ENABLED(LCD_USE_I2C_BUZZER)
void lcd_buzz ( long duration , uint16_t freq ) { // called from buzz() in Marlin_main.cpp where lcd is unknown
void lcd_buzz ( long duration , uint16_t freq ) { // called from buzz() in Marlin_main.cpp where lcd is unknown
lcd . buzz ( duration , freq ) ;
lcd . buzz ( duration , freq ) ;
}
}
# endif
# endif
void lcd_quick_feedback ( ) {
void lcd_quick_feedback ( ) {
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
next_button_update_ms = millis ( ) + 500 ;
next_button_update_ms = millis ( ) + 500 ;
@ -1984,19 +1991,19 @@ void lcd_quick_feedback() {
# else
# else
delay ( LCD_FEEDBACK_FREQUENCY_DURATION_MS ) ;
delay ( LCD_FEEDBACK_FREQUENCY_DURATION_MS ) ;
# endif
# endif
}
}
/**
/**
*
*
* Menu actions
* Menu actions
*
*
*/
*/
static void menu_action_back ( ) { lcd_goto_previous_menu ( ) ; }
static void menu_action_back ( ) { lcd_goto_previous_menu ( ) ; }
static void menu_action_submenu ( menuFunc_t func ) { lcd_save_previous_menu ( ) ; lcd_goto_menu ( func ) ; }
static void menu_action_submenu ( menuFunc_t func ) { lcd_save_previous_menu ( ) ; lcd_goto_menu ( func ) ; }
static void menu_action_gcode ( const char * pgcode ) { enqueue_and_echo_commands_P ( pgcode ) ; }
static void menu_action_gcode ( const char * pgcode ) { enqueue_and_echo_commands_P ( pgcode ) ; }
static void menu_action_function ( menuFunc_t func ) { ( * func ) ( ) ; }
static void menu_action_function ( menuFunc_t func ) { ( * func ) ( ) ; }
# if ENABLED(SDSUPPORT)
# if ENABLED(SDSUPPORT)
static void menu_action_sdfile ( const char * filename , char * longFilename ) {
static void menu_action_sdfile ( const char * filename , char * longFilename ) {
UNUSED ( longFilename ) ;
UNUSED ( longFilename ) ;
@ -2010,13 +2017,13 @@ static void menu_action_function(menuFunc_t func) { (*func)(); }
encoderPosition = 0 ;
encoderPosition = 0 ;
}
}
# endif //SDSUPPORT
# endif //SDSUPPORT
static void menu_action_setting_edit_bool ( const char * pstr , bool * ptr ) { UNUSED ( pstr ) ; * ptr = ! ( * ptr ) ; }
static void menu_action_setting_edit_bool ( const char * pstr , bool * ptr ) { UNUSED ( pstr ) ; * ptr = ! ( * ptr ) ; }
static void menu_action_setting_edit_callback_bool ( const char * pstr , bool * ptr , menuFunc_t callback ) {
static void menu_action_setting_edit_callback_bool ( const char * pstr , bool * ptr , menuFunc_t callback ) {
menu_action_setting_edit_bool ( pstr , ptr ) ;
menu_action_setting_edit_bool ( pstr , ptr ) ;
( * callback ) ( ) ;
( * callback ) ( ) ;
}
}
# endif //ULTIPANEL
# endif //ULTIPANEL
@ -2158,13 +2165,12 @@ bool lcd_blink() {
* No worries . This function is only called from the main thread .
* No worries . This function is only called from the main thread .
*/
*/
void lcd_update ( ) {
void lcd_update ( ) {
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)
static millis_t return_to_status_ms = 0 ;
static millis_t return_to_status_ms = 0 ;
manage_manual_move ( ) ;
manage_manual_move ( ) ;
# endif
# endif
lcd_buttons_update ( ) ;
lcd_buttons_update ( ) ;
# if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
# if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
@ -2173,7 +2179,7 @@ void lcd_update() {
if ( sd_status ! = lcd_sd_status & & lcd_detected ( ) ) {
if ( sd_status ! = lcd_sd_status & & lcd_detected ( ) ) {
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW ;
lcd_implementation_init ( // to maybe revive the LCD if static electricity killed it.
lcd_implementation_init ( // to maybe revive the LCD if static electricity killed it.
# if ENABLED(LCD_PROGRESS_BAR)
# if ENABLED(LCD_PROGRESS_BAR) && ENABLED(ULTIPANEL)
currentMenu = = lcd_status_screen
currentMenu = = lcd_status_screen
# endif
# endif
) ;
) ;
@ -2272,7 +2278,11 @@ void lcd_update() {
// We arrive here every ~100ms when idling often enough.
// We arrive here every ~100ms when idling often enough.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
// Instead of tracking the changes simply redraw the Info Screen ~1 time a second.
static int8_t lcd_status_update_delay = 1 ; // first update one loop delayed
static int8_t lcd_status_update_delay = 1 ; // first update one loop delayed
if ( currentMenu = = lcd_status_screen & & ! lcd_status_update_delay - - ) {
if (
# if ENABLED(ULTIPANEL)
currentMenu = = lcd_status_screen & &
# endif
! lcd_status_update_delay - - ) {
lcd_status_update_delay = 9 ;
lcd_status_update_delay = 9 ;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW ;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW ;
}
}
@ -2301,10 +2311,18 @@ void lcd_update() {
u8g . setColorIndex ( dot_color ) ; // Set color for the alive dot
u8g . setColorIndex ( dot_color ) ; // Set color for the alive dot
u8g . drawPixel ( 127 , 63 ) ; // draw alive dot
u8g . drawPixel ( 127 , 63 ) ; // draw alive dot
u8g . setColorIndex ( 1 ) ; // black on white
u8g . setColorIndex ( 1 ) ; // black on white
# if ENABLED(ULTIPANEL)
( * currentMenu ) ( ) ;
( * currentMenu ) ( ) ;
# else
lcd_status_screen ( ) ;
# endif
} while ( u8g . nextPage ( ) ) ;
} while ( u8g . nextPage ( ) ) ;
# else
# else
# if ENABLED(ULTIPANEL)
( * currentMenu ) ( ) ;
( * currentMenu ) ( ) ;
# else
lcd_status_screen ( ) ;
# endif
# endif
# endif
}
}
@ -2334,11 +2352,6 @@ void lcd_update() {
}
}
}
}
void lcd_ignore_click ( bool b ) {
ignore_click = b ;
wait_for_unclick = false ;
}
void lcd_finishstatus ( bool persist = false ) {
void lcd_finishstatus ( bool persist = false ) {
# if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
# if !(ENABLED(LCD_PROGRESS_BAR) && (PROGRESS_MSG_EXPIRE > 0))
UNUSED ( persist ) ;
UNUSED ( persist ) ;