@ -148,10 +148,6 @@ uint16_t max_display_update_time = 0;
void lcd_dac_write_eeprom ( ) ;
void lcd_dac_write_eeprom ( ) ;
# endif
# endif
# if HAS_LCD_CONTRAST
void lcd_set_contrast ( ) ;
# endif
# if ENABLED(FWRETRACT)
# if ENABLED(FWRETRACT)
void lcd_control_retract_menu ( ) ;
void lcd_control_retract_menu ( ) ;
# endif
# endif
@ -181,7 +177,7 @@ uint16_t max_display_update_time = 0;
void menu_edit_callback_ # # _name ( ) ; \
void menu_edit_callback_ # # _name ( ) ; \
void _menu_action_setting_edit_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue ) ; \
void _menu_action_setting_edit_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue ) ; \
void menu_action_setting_edit_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue ) ; \
void menu_action_setting_edit_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue ) ; \
void menu_action_setting_edit_callback_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue , const screenFunc_t callback ); \
void menu_action_setting_edit_callback_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue , const screenFunc_t callback , const bool live = false ); \
typedef void _name # # _void
typedef void _name # # _void
DECLARE_MENU_EDIT_TYPE ( int , int3 ) ;
DECLARE_MENU_EDIT_TYPE ( int , int3 ) ;
@ -419,6 +415,7 @@ uint16_t max_display_update_time = 0;
void * editValue ;
void * editValue ;
int32_t minEditValue , maxEditValue ;
int32_t minEditValue , maxEditValue ;
screenFunc_t callbackFunc ;
screenFunc_t callbackFunc ;
bool liveEdit ;
// Manual Moves
// Manual Moves
const float manual_feedrate_mm_m [ ] = MANUAL_FEEDRATE ;
const float manual_feedrate_mm_m [ ] = MANUAL_FEEDRATE ;
@ -590,7 +587,7 @@ void lcd_status_screen() {
}
}
# if ENABLED(ULTIPANEL_FEEDMULTIPLY)
# if ENABLED(ULTIPANEL_FEEDMULTIPLY)
int new_frm = feedrate_percentage + ( int32_t ) encoderPosition ;
const int new_frm = feedrate_percentage + ( int32_t ) encoderPosition ;
// Dead zone at 100% feedrate
// Dead zone at 100% feedrate
if ( ( feedrate_percentage < 100 & & new_frm > 100 ) | | ( feedrate_percentage > 100 & & new_frm < 100 ) ) {
if ( ( feedrate_percentage < 100 & & new_frm > 100 ) | | ( feedrate_percentage > 100 & & new_frm < 100 ) ) {
feedrate_percentage = 100 ;
feedrate_percentage = 100 ;
@ -2465,6 +2462,17 @@ void kill_screen(const char* lcd_msg) {
*
*
*/
*/
/**
*
* Callback for LCD contrast
*
*/
# if HAS_LCD_CONTRAST
void lcd_callback_set_contrast ( ) { set_lcd_contrast ( lcd_contrast ) ; }
# endif // HAS_LCD_CONTRAST
# if ENABLED(EEPROM_SETTINGS)
# if ENABLED(EEPROM_SETTINGS)
static void lcd_store_settings ( ) { lcd_completion_feedback ( settings . save ( ) ) ; }
static void lcd_store_settings ( ) { lcd_completion_feedback ( settings . save ( ) ) ; }
static void lcd_load_settings ( ) { lcd_completion_feedback ( settings . load ( ) ) ; }
static void lcd_load_settings ( ) { lcd_completion_feedback ( settings . load ( ) ) ; }
@ -2483,8 +2491,7 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM ( submenu , MSG_FILAMENT , lcd_control_filament_menu ) ;
MENU_ITEM ( submenu , MSG_FILAMENT , lcd_control_filament_menu ) ;
# if HAS_LCD_CONTRAST
# if HAS_LCD_CONTRAST
//MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
MENU_ITEM_EDIT_CALLBACK ( int3 , MSG_CONTRAST , & lcd_contrast , LCD_CONTRAST_MIN , LCD_CONTRAST_MAX , lcd_callback_set_contrast , true ) ;
MENU_ITEM ( submenu , MSG_CONTRAST , lcd_set_contrast ) ;
# endif
# endif
# if ENABLED(FWRETRACT)
# if ENABLED(FWRETRACT)
MENU_ITEM ( submenu , MSG_RETRACT , lcd_control_retract_menu ) ;
MENU_ITEM ( submenu , MSG_RETRACT , lcd_control_retract_menu ) ;
@ -2953,32 +2960,6 @@ void kill_screen(const char* lcd_msg) {
END_MENU ( ) ;
END_MENU ( ) ;
}
}
/**
*
* " Control " > " Contrast " submenu
*
*/
# if HAS_LCD_CONTRAST
void lcd_set_contrast ( ) {
if ( lcd_clicked ) { return lcd_goto_previous_menu ( ) ; }
ENCODER_DIRECTION_NORMAL ( ) ;
if ( encoderPosition ) {
set_lcd_contrast ( lcd_contrast + encoderPosition ) ;
encoderPosition = 0 ;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW ;
}
if ( lcdDrawUpdate ) {
lcd_implementation_drawedit ( PSTR ( MSG_CONTRAST ) ,
# if LCD_CONTRAST_MAX >= 100
itostr3 ( lcd_contrast )
# else
itostr2 ( lcd_contrast )
# endif
) ;
}
}
# endif // HAS_LCD_CONTRAST
/**
/**
*
*
* " Control " > " Retract " submenu
* " Control " > " Retract " submenu
@ -3492,7 +3473,7 @@ void kill_screen(const char* lcd_msg) {
* void menu_edit_callback_int3 ( ) ; // edit int (interactively) with callback on completion
* void menu_edit_callback_int3 ( ) ; // edit int (interactively) with callback on completion
* void _menu_action_setting_edit_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue ) ;
* void _menu_action_setting_edit_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue ) ;
* void menu_action_setting_edit_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue ) ;
* void menu_action_setting_edit_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue ) ;
* void menu_action_setting_edit_callback_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue , const screenFunc_t callback ); // edit int with callback
* void menu_action_setting_edit_callback_int3 ( const char * const pstr , int * const ptr , const int minValue , const int maxValue , const screenFunc_t callback , const bool live ); // edit int with callback
*
*
* You can then use one of the menu macros to present the edit interface :
* You can then use one of the menu macros to present the edit interface :
* MENU_ITEM_EDIT ( int3 , MSG_SPEED , & feedrate_percentage , 10 , 999 )
* MENU_ITEM_EDIT ( int3 , MSG_SPEED , & feedrate_percentage , 10 , 999 )
@ -3500,9 +3481,7 @@ void kill_screen(const char* lcd_msg) {
* This expands into a more primitive menu item :
* This expands into a more primitive menu item :
* MENU_ITEM ( setting_edit_int3 , MSG_SPEED , PSTR ( MSG_SPEED ) , & feedrate_percentage , 10 , 999 )
* MENU_ITEM ( setting_edit_int3 , MSG_SPEED , PSTR ( MSG_SPEED ) , & feedrate_percentage , 10 , 999 )
*
*
*
* . . . which calls :
* Also : MENU_MULTIPLIER_ITEM_EDIT , MENU_ITEM_EDIT_CALLBACK , and MENU_MULTIPLIER_ITEM_EDIT_CALLBACK
*
* menu_action_setting_edit_int3 ( PSTR ( MSG_SPEED ) , & feedrate_percentage , 10 , 999 )
* menu_action_setting_edit_int3 ( PSTR ( MSG_SPEED ) , & feedrate_percentage , 10 , 999 )
*/
*/
# define DEFINE_MENU_EDIT_TYPE(_type, _name, _strFunc, _scale) \
# define DEFINE_MENU_EDIT_TYPE(_type, _name, _strFunc, _scale) \
@ -3512,11 +3491,11 @@ void kill_screen(const char* lcd_msg) {
if ( ( int32_t ) encoderPosition > maxEditValue ) encoderPosition = maxEditValue ; \
if ( ( int32_t ) encoderPosition > maxEditValue ) encoderPosition = maxEditValue ; \
if ( lcdDrawUpdate ) \
if ( lcdDrawUpdate ) \
lcd_implementation_drawedit ( editLabel , _strFunc ( ( ( _type ) ( ( int32_t ) encoderPosition + minEditValue ) ) * ( 1.0 / _scale ) ) ) ; \
lcd_implementation_drawedit ( editLabel , _strFunc ( ( ( _type ) ( ( int32_t ) encoderPosition + minEditValue ) ) * ( 1.0 / _scale ) ) ) ; \
if ( lcd_clicked ) { \
if ( lcd_clicked | | ( liveEdit & & lcdDrawUpdate ) ) { \
_type value = ( ( _type ) ( ( int32_t ) encoderPosition + minEditValue ) ) * ( 1.0 / _scale ) ; \
_type value = ( ( _type ) ( ( int32_t ) encoderPosition + minEditValue ) ) * ( 1.0 / _scale ) ; \
if ( editValue ! = NULL ) \
if ( editValue ! = NULL ) * ( ( _type * ) editValue ) = value ; \
* ( ( _type * ) editValue ) = value ; \
if ( liveEdit ) ( * callbackFunc ) ( ) ; \
lcd_goto_previous_menu ( ) ; \
if ( lcd_clicked ) lcd_goto_previous_menu ( ) ; \
} \
} \
return lcd_clicked ; \
return lcd_clicked ; \
} \
} \
@ -3537,10 +3516,11 @@ void kill_screen(const char* lcd_msg) {
_menu_action_setting_edit_ # # _name ( pstr , ptr , minValue , maxValue ) ; \
_menu_action_setting_edit_ # # _name ( pstr , ptr , minValue , maxValue ) ; \
currentScreen = menu_edit_ # # _name ; \
currentScreen = menu_edit_ # # _name ; \
} \
} \
void menu_action_setting_edit_callback_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue , const screenFunc_t callback ) { \
void menu_action_setting_edit_callback_ # # _name ( const char * const pstr , _type * const ptr , const _type minValue , const _type maxValue , const screenFunc_t callback , const bool live ) { \
_menu_action_setting_edit_ # # _name ( pstr , ptr , minValue , maxValue ) ; \
_menu_action_setting_edit_ # # _name ( pstr , ptr , minValue , maxValue ) ; \
currentScreen = menu_edit_callback_ # # _name ; \
currentScreen = menu_edit_callback_ # # _name ; \
callbackFunc = callback ; \
callbackFunc = callback ; \
liveEdit = live ; \
} \
} \
typedef void _name
typedef void _name
@ -4071,10 +4051,12 @@ void lcd_setalertstatuspgm(const char * const message) {
void lcd_reset_alert_level ( ) { lcd_status_message_level = 0 ; }
void lcd_reset_alert_level ( ) { lcd_status_message_level = 0 ; }
# if HAS_LCD_CONTRAST
# if HAS_LCD_CONTRAST
void set_lcd_contrast ( const int value ) {
void set_lcd_contrast ( const int value ) {
lcd_contrast = constrain ( value , LCD_CONTRAST_MIN , LCD_CONTRAST_MAX ) ;
lcd_contrast = constrain ( value , LCD_CONTRAST_MIN , LCD_CONTRAST_MAX ) ;
u8g . setContrast ( lcd_contrast ) ;
u8g . setContrast ( lcd_contrast ) ;
}
}
# endif
# endif
# if ENABLED(ULTIPANEL)
# if ENABLED(ULTIPANEL)