@ -40,6 +40,9 @@
# include "../../../libs/buzzer.h"
# include "../../../inc/Conditionals_post.h"
//#define DEBUG_OUT 1
# include "../../../core/debug_out.h"
# if ENABLED(ADVANCED_PAUSE_FEATURE)
# include "../../../feature/pause.h"
# endif
@ -200,7 +203,6 @@ CrealityDWINClass CrealityDWIN;
uint8_t mesh_y = 0 ;
# if ENABLED(AUTO_BED_LEVELING_UBL)
bed_mesh_t & mesh_z_values = ubl . z_values ;
uint8_t tilt_grid = 1 ;
void manual_value_update ( bool undefined = false ) {
@ -213,11 +215,11 @@ CrealityDWINClass CrealityDWIN;
struct linear_fit_data lsf_results ;
incremental_LSF_reset ( & lsf_results ) ;
GRID_LOOP ( x , y ) {
if ( ! isnan ( mesh_z_values [ x ] [ y ] ) ) {
if ( ! isnan ( Z_VALUES_ARR [ x ] [ y ] ) ) {
xy_pos_t rpos ;
rpos . x = ubl . mesh_index_to_xpos ( x ) ;
rpos . y = ubl . mesh_index_to_ypos ( y ) ;
incremental_LSF ( & lsf_results , rpos , mesh_z_values [ x ] [ y ] ) ;
incremental_LSF ( & lsf_results , rpos , Z_VALUES_ARR [ x ] [ y ] ) ;
}
}
@ -232,7 +234,7 @@ CrealityDWINClass CrealityDWIN;
GRID_LOOP ( i , j ) {
float mx = ubl . mesh_index_to_xpos ( i ) ,
my = ubl . mesh_index_to_ypos ( j ) ,
mz = mesh_z_values [ i ] [ j ] ;
mz = Z_VALUES_ARR [ i ] [ j ] ;
if ( DEBUGGING ( LEVELING ) ) {
DEBUG_ECHOPAIR_F ( " before rotation = [ " , mx , 7 ) ;
@ -256,13 +258,12 @@ CrealityDWINClass CrealityDWIN;
DEBUG_DELAY ( 20 ) ;
}
mesh_z_values [ i ] [ j ] = mz - lsf_results . D ;
Z_VALUES_ARR [ i ] [ j ] = mz - lsf_results . D ;
}
return false ;
}
# else
bed_mesh_t & mesh_z_values = z_values ;
void manual_value_update ( ) {
sprintf_P ( cmd , PSTR ( " G29 I%i J%i Z%s " ) , mesh_x , mesh_y , dtostrf ( current_position . z , 1 , 3 , str_1 ) ) ;
@ -275,7 +276,7 @@ CrealityDWINClass CrealityDWIN;
void manual_move ( bool zmove = false ) {
if ( zmove ) {
planner . synchronize ( ) ;
current_position . z = goto_mesh_value ? mesh_z_values [ mesh_x ] [ mesh_y ] : Z_CLEARANCE_BETWEEN_PROBES ;
current_position . z = goto_mesh_value ? Z_VALUES_ARR [ mesh_x ] [ mesh_y ] : Z_CLEARANCE_BETWEEN_PROBES ;
planner . buffer_line ( current_position , homing_feedrate ( Z_AXIS ) , active_extruder ) ;
planner . synchronize ( ) ;
}
@ -286,7 +287,7 @@ CrealityDWINClass CrealityDWIN;
sprintf_P ( cmd , PSTR ( " G42 F4000 I%i J%i " ) , mesh_x , mesh_y ) ;
gcode . process_subcommands_now_P ( cmd ) ;
planner . synchronize ( ) ;
current_position . z = goto_mesh_value ? mesh_z_values [ mesh_x ] [ mesh_y ] : Z_CLEARANCE_BETWEEN_PROBES ;
current_position . z = goto_mesh_value ? Z_VALUES_ARR [ mesh_x ] [ mesh_y ] : Z_CLEARANCE_BETWEEN_PROBES ;
planner . buffer_line ( current_position , homing_feedrate ( Z_AXIS ) , active_extruder ) ;
planner . synchronize ( ) ;
CrealityDWIN . Redraw_Menu ( ) ;
@ -296,8 +297,8 @@ CrealityDWINClass CrealityDWIN;
float get_max_value ( ) {
float max = __FLT_MIN__ ;
GRID_LOOP ( x , y ) {
if ( ! isnan ( mesh_z_values[ x ] [ y ] ) & & mesh_z_values [ x ] [ y ] > max )
max = mesh_z_values [ x ] [ y ] ;
if ( ! isnan ( Z_VALUES_ARR[ x ] [ y ] ) & & Z_VALUES_ARR [ x ] [ y ] > max )
max = Z_VALUES_ARR [ x ] [ y ] ;
}
return max ;
}
@ -305,8 +306,8 @@ CrealityDWINClass CrealityDWIN;
float get_min_value ( ) {
float min = __FLT_MAX__ ;
GRID_LOOP ( x , y ) {
if ( ! isnan ( mesh_z_values[ x ] [ y ] ) & & mesh_z_values [ x ] [ y ] < min )
min = mesh_z_values [ x ] [ y ] ;
if ( ! isnan ( Z_VALUES_ARR[ x ] [ y ] ) & & Z_VALUES_ARR [ x ] [ y ] < min )
min = Z_VALUES_ARR [ x ] [ y ] ;
}
return min ;
}
@ -335,12 +336,12 @@ CrealityDWINClass CrealityDWIN;
const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width ;
const auto start_y_px = padding_y_top + ( GRID_MAX_POINTS_Y - y - 1 ) * cell_height_px ;
const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width ;
DWIN_Draw_Rectangle ( 1 , // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
isnan ( mesh_z_values [ x ] [ y ] ) ? Color_Grey : ( // gray if undefined
( mesh_z_values [ x ] [ y ] < 0 ?
( uint16_t ) round ( 0x1F * - mesh_z_values [ x ] [ y ] / ( ! viewer_asymmetric_range ? range : v_min ) ) < < 11 : // red if mesh point value is negative
( uint16_t ) round ( 0x3F * mesh_z_values [ x ] [ y ] / ( ! viewer_asymmetric_range ? range : v_max ) ) < < 5 ) | // green if mesh point value is positive
_MIN ( 0x1F , ( ( ( uint8_t ) abs ( mesh_z_values [ x ] [ y ] ) / 10 ) * 4 ) ) ) , // + blue stepping for every mm
DWIN_Draw_Rectangle ( 1 , // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
isnan ( Z_VALUES_ARR [ x ] [ y ] ) ? Color_Grey : ( // gray if undefined
( Z_VALUES_ARR [ x ] [ y ] < 0 ?
( uint16_t ) round ( 0x1F * - Z_VALUES_ARR [ x ] [ y ] / ( ! viewer_asymmetric_range ? range : v_min ) ) < < 11 : // red if mesh point value is negative
( uint16_t ) round ( 0x3F * Z_VALUES_ARR [ x ] [ y ] / ( ! viewer_asymmetric_range ? range : v_max ) ) < < 5 ) | // green if mesh point value is positive
_MIN ( 0x1F , ( ( ( uint8_t ) abs ( Z_VALUES_ARR [ x ] [ y ] ) / 10 ) * 4 ) ) ) , // + blue stepping for every mm
start_x_px , start_y_px , end_x_px , end_y_px
) ;
@ -350,18 +351,18 @@ CrealityDWINClass CrealityDWIN;
// Draw value text on
if ( viewer_print_value ) {
int8_t offset_x , offset_y = cell_height_px / 2 - 6 ;
if ( isnan ( mesh_z_values [ x ] [ y ] ) ) { // undefined
DWIN_Draw_String ( false , false , font6x12 , Color_White , Color_Bg_Blue , start_x_px + cell_width_px / 2 - 5 , start_y_px + offset_y , F ( " X " ) ) ;
if ( isnan ( Z_VALUES_ARR [ x ] [ y ] ) ) { // undefined
DWIN_Draw_String ( false , font6x12 , Color_White , Color_Bg_Blue , start_x_px + cell_width_px / 2 - 5 , start_y_px + offset_y , F ( " X " ) ) ;
}
else { // has value
if ( GRID_MAX_POINTS_X < 10 )
sprintf_P ( buf , PSTR ( " %s " ) , dtostrf ( abs ( mesh_z_values [ x ] [ y ] ) , 1 , 2 , str_1 ) ) ;
sprintf_P ( buf , PSTR ( " %s " ) , dtostrf ( abs ( Z_VALUES_ARR [ x ] [ y ] ) , 1 , 2 , str_1 ) ) ;
else
sprintf_P ( buf , PSTR ( " %02i " ) , ( uint16_t ) ( abs ( mesh_z_values [ x ] [ y ] - ( int16_t ) mesh_z_values [ x ] [ y ] ) * 100 ) ) ;
sprintf_P ( buf , PSTR ( " %02i " ) , ( uint16_t ) ( abs ( Z_VALUES_ARR [ x ] [ y ] - ( int16_t ) Z_VALUES_ARR [ x ] [ y ] ) * 100 ) ) ;
offset_x = cell_width_px / 2 - 3 * ( strlen ( buf ) ) - 2 ;
if ( ! ( GRID_MAX_POINTS_X < 10 ) )
DWIN_Draw_String ( false , false , font6x12 , Color_White , Color_Bg_Blue , start_x_px - 2 + offset_x , start_y_px + offset_y /*+ square / 2 - 6*/ , F ( " . " ) ) ;
DWIN_Draw_String ( false , false , font6x12 , Color_White , Color_Bg_Blue , start_x_px + 1 + offset_x , start_y_px + offset_y /*+ square / 2 - 6*/ , buf ) ;
DWIN_Draw_String ( false , font6x12 , Color_White , Color_Bg_Blue , start_x_px - 2 + offset_x , start_y_px + offset_y /*+ square / 2 - 6*/ , F ( " . " ) ) ;
DWIN_Draw_String ( false , font6x12 , Color_White , Color_Bg_Blue , start_x_px + 1 + offset_x , start_y_px + offset_y /*+ square / 2 - 6*/ , buf ) ;
}
safe_delay ( 10 ) ;
LCD_SERIAL . flushTX ( ) ;
@ -415,16 +416,11 @@ void CrealityDWINClass::Draw_Float(float value, uint8_t row, bool selected/*=fal
const uint16_t bColor = ( selected ) ? Select_Color : Color_Bg_Black ;
const uint16_t xpos = 240 - ( digits * 8 ) ;
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 194 , MBASE ( row ) , 234 - ( digits * 8 ) , MBASE ( row ) + 16 ) ;
if ( isnan ( value ) ) {
DWIN_Draw_String ( false , true , DWIN_FONT_MENU , Color_White , bColor , xpos - 8 , MBASE ( row ) , F ( " NaN " ) ) ;
}
else if ( value < 0 ) {
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , Color_White , bColor , digits - log10 ( minunit ) + 1 , log10 ( minunit ) , xpos , MBASE ( row ) , - value * minunit ) ;
DWIN_Draw_String ( false , true , DWIN_FONT_MENU , Color_White , bColor , xpos - 8 , MBASE ( row ) , F ( " - " ) ) ;
}
if ( isnan ( value ) )
DWIN_Draw_String ( true , DWIN_FONT_MENU , Color_White , bColor , xpos - 8 , MBASE ( row ) , F ( " NaN " ) ) ;
else {
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , Color_White , bColor , digits - log10 ( minunit ) + 1 , log10 ( minunit ) , xpos , MBASE ( row ) , value * minunit ) ;
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , Color_White , bColor , xpos - 8 , MBASE ( row ) , F ( " " ) ) ;
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , Color_White , bColor , digits - log10 ( minunit ) + 1 , log10 ( minunit ) , xpos , MBASE ( row ) , ( value < 0 ? - value : value ) * minunit ) ;
DWIN_Draw_String ( true , DWIN_FONT_MENU , Color_White , bColor , xpos - 8 , MBASE ( row ) , value < 0 ? F ( " - " ) : F ( " " ) ) ;
}
}
@ -432,7 +428,7 @@ void CrealityDWINClass::Draw_Option(uint8_t value, const char * const * options,
uint16_t bColor = ( selected ) ? Select_Color : Color_Bg_Black ;
uint16_t tColor = ( color ) ? GetColor ( value , Color_White , false ) : Color_White ;
DWIN_Draw_Rectangle ( 1 , bColor , 202 , MBASE ( row ) + 14 , 258 , MBASE ( row ) - 2 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , tColor , bColor , 202 , MBASE ( row ) - 1 , options [ value ] ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , tColor , bColor , 202 , MBASE ( row ) - 1 , options [ value ] ) ;
}
uint16_t CrealityDWINClass : : GetColor ( uint8_t color , uint16_t original , bool light /*=false*/ ) {
@ -475,15 +471,15 @@ uint16_t CrealityDWINClass::GetColor(uint8_t color, uint16_t original, bool ligh
}
void CrealityDWINClass : : Draw_Title ( const char * title ) {
DWIN_Draw_String ( false , false , DWIN_FONT_HEAD , GetColor ( eeprom_settings . menu_top_txt , Color_White , false ) , Color_Bg_Blue , ( DWIN_WIDTH - strlen ( title ) * STAT_CHR_W ) / 2 , 5 , title ) ;
DWIN_Draw_String ( false , DWIN_FONT_HEAD , GetColor ( eeprom_settings . menu_top_txt , Color_White , false ) , Color_Bg_Blue , ( DWIN_WIDTH - strlen ( title ) * STAT_CHR_W ) / 2 , 5 , title ) ;
}
void CrealityDWINClass : : Draw_Menu_Item ( uint8_t row , uint8_t icon /*=0*/ , const char * label1 , const char * label2 , bool more /*=false*/ , bool centered /*=false*/ ) {
const uint8_t label_offset_y = ! ( label1 & & label2 ) ? 0 : MENU_CHR_H * 3 / 5 ;
const uint8_t label1_offset_x = ! centered ? LBLX : LBLX * 4 / 5 + _MAX ( LBLX * 1U / 5 , ( DWIN_WIDTH - LBLX - ( label1 ? strlen ( label1 ) : 0 ) * MENU_CHR_W ) / 2 ) ;
const uint8_t label2_offset_x = ! centered ? LBLX : LBLX * 4 / 5 + _MAX ( LBLX * 1U / 5 , ( DWIN_WIDTH - LBLX - ( label2 ? strlen ( label2 ) : 0 ) * MENU_CHR_W ) / 2 ) ;
if ( label1 ) DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , label1_offset_x , MBASE ( row ) - 1 - label_offset_y , label1 ) ; // Draw Label
if ( label2 ) DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , label2_offset_x , MBASE ( row ) - 1 + label_offset_y , label2 ) ; // Draw Label
if ( label1 ) DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , label1_offset_x , MBASE ( row ) - 1 - label_offset_y , label1 ) ; // Draw Label
if ( label2 ) DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , label2_offset_x , MBASE ( row ) - 1 + label_offset_y , label2 ) ; // Draw Label
if ( icon ) DWIN_ICON_Show ( ICON , icon , 26 , MBASE ( row ) - 3 ) ; //Draw Menu Icon
if ( more ) DWIN_ICON_Show ( ICON , ICON_More , 226 , MBASE ( row ) - 3 ) ; // Draw More Arrow
DWIN_Draw_Line ( GetColor ( eeprom_settings . menu_split_line , Line_Color , true ) , 16 , MBASE ( row ) + 33 , 256 , MBASE ( row ) + 33 ) ; // Draw Menu Line
@ -547,50 +543,49 @@ void CrealityDWINClass::Main_Menu_Icons() {
if ( selection = = 0 ) {
DWIN_ICON_Show ( ICON , ICON_Print_1 , 17 , 130 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 17 , 130 , 126 , 229 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 52 , 200 , F ( " Print " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 52 , 200 , F ( " Print " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Print_0 , 17 , 130 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 52 , 200 , F ( " Print " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 52 , 200 , F ( " Print " ) ) ;
}
if ( selection = = 1 ) {
DWIN_ICON_Show ( ICON , ICON_Prepare_1 , 145 , 130 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 145 , 130 , 254 , 229 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 170 , 200 , F ( " Prepare " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 170 , 200 , F ( " Prepare " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Prepare_0 , 145 , 130 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 170 , 200 , F ( " Prepare " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 170 , 200 , F ( " Prepare " ) ) ;
}
if ( selection = = 2 ) {
DWIN_ICON_Show ( ICON , ICON_Control_1 , 17 , 246 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 17 , 246 , 126 , 345 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 43 , 317 , F ( " Control " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 43 , 317 , F ( " Control " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Control_0 , 17 , 246 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 43 , 317 , F ( " Control " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 43 , 317 , F ( " Control " ) ) ;
}
# if HAS_ABL_OR_UBL
if ( selection = = 3 ) {
DWIN_ICON_Show ( ICON , ICON_Leveling_1 , 145 , 246 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 145 , 246 , 254 , 345 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 179 , 317 , F ( " Level " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 179 , 317 , F ( " Level " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Leveling_0 , 145 , 246 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 179 , 317 , F ( " Level " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 179 , 317 , F ( " Level " ) ) ;
}
# else
if ( selection = = 3 ) {
DWIN_ICON_Show ( ICON , ICON_Info_1 , 145 , 246 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 145 , 246 , 254 , 345 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 181 , 317 , F ( " Info " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 181 , 317 , F ( " Info " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Info_0 , 145 , 246 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 181 , 317 , F ( " Info " ) ) ;
//DWIN_Frame_AreaCopy(1, 132, 423, 159, 435, 186, 318);
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 181 , 317 , F ( " Info " ) ) ;
}
# endif
}
@ -610,41 +605,41 @@ void CrealityDWINClass::Print_Screen_Icons() {
if ( selection = = 0 ) {
DWIN_ICON_Show ( ICON , ICON_Setup_1 , 8 , 252 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 8 , 252 , 87 , 351 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 30 , 322 , F ( " Tune " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 30 , 322 , F ( " Tune " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Setup_0 , 8 , 252 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 30 , 322 , F ( " Tune " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 30 , 322 , F ( " Tune " ) ) ;
}
if ( selection = = 2 ) {
DWIN_ICON_Show ( ICON , ICON_Stop_1 , 184 , 252 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 184 , 252 , 263 , 351 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 205 , 322 , F ( " Stop " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 205 , 322 , F ( " Stop " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Stop_0 , 184 , 252 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 205 , 322 , F ( " Stop " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 205 , 322 , F ( " Stop " ) ) ;
}
if ( paused ) {
if ( selection = = 1 ) {
DWIN_ICON_Show ( ICON , ICON_Continue_1 , 96 , 252 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 96 , 252 , 175 , 351 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Print " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Print " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Continue_0 , 96 , 252 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Print " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Print " ) ) ;
}
}
else {
if ( selection = = 1 ) {
DWIN_ICON_Show ( ICON , ICON_Pause_1 , 96 , 252 ) ;
DWIN_Draw_Rectangle ( 0 , GetColor ( eeprom_settings . highlight_box , Color_White ) , 96 , 252 , 175 , 351 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Pause " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Pause " ) ) ;
}
else {
DWIN_ICON_Show ( ICON , ICON_Pause_0 , 96 , 252 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Pause " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Blue , 114 , 322 , F ( " Pause " ) ) ;
}
}
}
@ -658,8 +653,8 @@ void CrealityDWINClass::Draw_Print_Screen() {
Print_Screen_Icons ( ) ;
DWIN_ICON_Show ( ICON , ICON_PrintTime , 14 , 171 ) ;
DWIN_ICON_Show ( ICON , ICON_RemainTime , 147 , 169 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , 41 , 163 , " Elapsed " ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , 176 , 163 , " Remaining " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , 41 , 163 , F ( " Elapsed " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , 176 , 163 , F ( " Remaining " ) ) ;
Update_Status_Bar ( true ) ;
Draw_Print_ProgressBar ( ) ;
Draw_Print_ProgressElapsed ( ) ;
@ -687,14 +682,14 @@ void CrealityDWINClass::Draw_Print_Filename(const bool reset/*=false*/) {
dispname [ len ] = ' \0 ' ;
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 8 , 50 , DWIN_WIDTH - 8 , 80 ) ;
const int8_t npos = ( DWIN_WIDTH - 30 * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , npos , 60 , dispname ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , npos , 60 , dispname ) ;
if ( - pos > = 30 ) namescrl = 0 ;
namescrl + + ;
}
else {
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 8 , 50 , DWIN_WIDTH - 8 , 80 ) ;
const int8_t npos = ( DWIN_WIDTH - strlen ( filename ) * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , npos , 60 , filename ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , Color_White , Color_Bg_Black , npos , 60 , filename ) ;
}
}
}
@ -704,7 +699,7 @@ void CrealityDWINClass::Draw_Print_ProgressBar() {
DWIN_ICON_Show ( ICON , ICON_Bar , 15 , 93 ) ;
DWIN_Draw_Rectangle ( 1 , BarFill_Color , 16 + printpercent * 240 / 100 , 93 , 256 , 113 ) ;
DWIN_Draw_IntValue ( true , true , 0 , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_percent , Percent_Color ) , Color_Bg_Black , 3 , 109 , 133 , printpercent ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_percent , Percent_Color ) , Color_Bg_Black , 133 , 133 , " % " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_percent , Percent_Color ) , Color_Bg_Black , 133 , 133 , F ( " % " ) ) ;
}
# if ENABLED(USE_M73_REMAINING_TIME)
@ -714,11 +709,11 @@ void CrealityDWINClass::Draw_Print_ProgressBar() {
DWIN_Draw_IntValue ( true , true , 1 , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 2 , 176 , 187 , remainingtime / 3600 ) ;
DWIN_Draw_IntValue ( true , true , 1 , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 2 , 200 , 187 , ( remainingtime % 3600 ) / 60 ) ;
if ( eeprom_settings . time_format_textual ) {
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 192 , 187 , " h " ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 216 , 187 , " m " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 192 , 187 , F ( " h " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 216 , 187 , F ( " m " ) ) ;
}
else
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 192 , 187 , " : " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 192 , 187 , F ( " : " ) ) ;
}
# endif
@ -728,11 +723,11 @@ void CrealityDWINClass::Draw_Print_ProgressElapsed() {
DWIN_Draw_IntValue ( true , true , 1 , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 2 , 42 , 187 , elapsed . value / 3600 ) ;
DWIN_Draw_IntValue ( true , true , 1 , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 2 , 66 , 187 , ( elapsed . value % 3600 ) / 60 ) ;
if ( eeprom_settings . time_format_textual ) {
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 58 , 187 , " h " ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 82 , 187 , " m " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 58 , 187 , F ( " h " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 82 , 187 , F ( " m " ) ) ;
}
else
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 58 , 187 , " : " ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . progress_time , Color_White ) , Color_Bg_Black , 58 , 187 , F ( " : " ) ) ;
}
void CrealityDWINClass : : Draw_Print_confirm ( ) {
@ -779,7 +774,7 @@ void CrealityDWINClass::Draw_SD_List(bool removed/*=false*/) {
else {
Draw_Menu_Item ( 0 , ICON_Back , " Back " ) ;
DWIN_Draw_Rectangle ( 1 , Color_Bg_Red , 10 , MBASE ( 3 ) - 10 , DWIN_WIDTH - 10 , MBASE ( 4 ) ) ;
DWIN_Draw_String ( false , false , font16x32 , Color_Yellow , Color_Bg_Red , ( ( DWIN_WIDTH ) - 8 * 16 ) / 2 , MBASE ( 3 ) , " No Media " ) ;
DWIN_Draw_String ( false , font16x32 , Color_Yellow , Color_Bg_Red , ( ( DWIN_WIDTH ) - 8 * 16 ) / 2 , MBASE ( 3 ) , F ( " No Media " ) ) ;
}
DWIN_Draw_Rectangle ( 1 , GetColor ( eeprom_settings . cursor_color , Rectangle_Color ) , 0 , MBASE ( 0 ) - 18 , 14 , MBASE ( 0 ) + 33 ) ;
}
@ -795,7 +790,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
hotend = - 1 ;
hotendtarget = - 1 ;
DWIN_ICON_Show ( ICON , ICON_HotendTemp , 10 , 383 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 25 + 3 * STAT_CHR_W + 5 , 384 , F ( " / " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 25 + 3 * STAT_CHR_W + 5 , 384 , F ( " / " ) ) ;
}
if ( thermalManager . temp_hotend [ 0 ] . celsius ! = hotend ) {
hotend = thermalManager . temp_hotend [ 0 ] . celsius ;
@ -810,7 +805,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
if ( icons ) {
flow = - 1 ;
DWIN_ICON_Show ( ICON , ICON_StepE , 112 , 417 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 116 + 5 * STAT_CHR_W + 2 , 417 , F ( " % " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 116 + 5 * STAT_CHR_W + 2 , 417 , F ( " % " ) ) ;
}
if ( planner . flow_percentage [ 0 ] ! = flow ) {
flow = planner . flow_percentage [ 0 ] ;
@ -825,7 +820,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
bed = - 1 ;
bedtarget = - 1 ;
DWIN_ICON_Show ( ICON , ICON_BedTemp , 10 , 416 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 25 + 3 * STAT_CHR_W + 5 , 417 , F ( " / " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 25 + 3 * STAT_CHR_W + 5 , 417 , F ( " / " ) ) ;
}
if ( thermalManager . temp_bed . celsius ! = bed ) {
bed = thermalManager . temp_bed . celsius ;
@ -860,14 +855,8 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
}
if ( zoffsetvalue ! = offset ) {
offset = zoffsetvalue ;
if ( zoffsetvalue < 0 ) {
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 2 , 2 , 207 , 417 , - zoffsetvalue * 100 ) ;
DWIN_Draw_String ( false , true , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 205 , 419 , " - " ) ;
}
else {
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 2 , 2 , 207 , 417 , zoffsetvalue * 100 ) ;
DWIN_Draw_String ( false , true , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 205 , 419 , " " ) ;
}
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 2 , 2 , 207 , 417 , ( zoffsetvalue < 0 ? - zoffsetvalue : zoffsetvalue ) * 100 ) ;
DWIN_Draw_String ( true , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 205 , 419 , zoffsetvalue < 0 ? F ( " - " ) : F ( " " ) ) ;
}
# endif
@ -875,7 +864,7 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
if ( icons ) {
feedrate = - 1 ;
DWIN_ICON_Show ( ICON , ICON_Speed , 113 , 383 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 116 + 5 * STAT_CHR_W + 2 , 384 , F ( " % " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , GetColor ( eeprom_settings . status_area_text , Color_White ) , Color_Bg_Black , 116 + 5 * STAT_CHR_W + 2 , 384 , F ( " % " ) ) ;
}
if ( feedrate_percentage ! = feedrate ) {
feedrate = feedrate_percentage ;
@ -897,21 +886,21 @@ void CrealityDWINClass::Draw_Status_Area(bool icons/*=false*/) {
if ( update_x ) {
x = current_position . x ;
if ( ( update_x = axis_should_home ( X_AXIS ) & & ui . get_blink ( ) ) )
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 35 , 459 , " -?- " ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 35 , 459 , F ( " -?- " ) ) ;
else
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 3 , 1 , 35 , 459 , current_position . x * 10 ) ;
}
if ( update_y ) {
y = current_position . y ;
if ( ( update_y = axis_should_home ( Y_AXIS ) & & ui . get_blink ( ) ) )
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 120 , 459 , " -?- " ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 120 , 459 , F ( " -?- " ) ) ;
else
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 3 , 1 , 120 , 459 , current_position . y * 10 ) ;
}
if ( update_z ) {
z = current_position . z ;
if ( ( update_z = axis_should_home ( Z_AXIS ) & & ui . get_blink ( ) ) )
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 205 , 459 , " -?- " ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 205 , 459 , F ( " -?- " ) ) ;
else
DWIN_Draw_FloatValue ( true , true , 0 , DWIN_FONT_MENU , GetColor ( eeprom_settings . coordinates_text , Color_White ) , Color_Bg_Black , 3 , 2 , 205 , 459 , ( current_position . z > = 0 ) ? current_position . z * 100 : 0 ) ;
}
@ -927,20 +916,20 @@ void CrealityDWINClass::Draw_Popup(PGM_P const line1, PGM_P const line2, PGM_P c
DWIN_Draw_Rectangle ( 1 , Color_Bg_Window , 14 , 60 , 258 , 350 ) ;
const uint8_t ypos = ( mode = = Popup | | mode = = Confirm ) ? 150 : 230 ;
if ( icon > 0 ) DWIN_ICON_Show ( ICON , icon , 101 , 105 ) ;
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line1 ) ) / 2 , ypos , line1 ) ;
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line2 ) ) / 2 , ypos + 30 , line2 ) ;
DWIN_Draw_String ( false, true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line3 ) ) / 2 , ypos + 60 , line3 ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line1 ) ) / 2 , ypos , line1 ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line2 ) ) / 2 , ypos + 30 , line2 ) ;
DWIN_Draw_String ( true, DWIN_FONT_MENU , Popup_Text_Color , Color_Bg_Window , ( 272 - 8 * strlen_P ( line3 ) ) / 2 , ypos + 60 , line3 ) ;
if ( mode = = Popup ) {
selection = 0 ;
DWIN_Draw_Rectangle ( 1 , Confirm_Color , 26 , 280 , 125 , 317 ) ;
DWIN_Draw_Rectangle ( 1 , Cancel_Color , 146 , 280 , 245 , 317 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 39 , 290 , " Confirm " ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 165 , 290 , " Cancel " ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 39 , 290 , F ( " Confirm " ) ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 165 , 290 , F ( " Cancel " ) ) ;
Popup_Select ( ) ;
}
else if ( mode = = Confirm ) {
DWIN_Draw_Rectangle ( 1 , Confirm_Color , 87 , 280 , 186 , 317 ) ;
DWIN_Draw_String ( false , false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 96 , 290 , " Continue " ) ;
DWIN_Draw_String ( false , DWIN_FONT_STAT , Color_White , Color_Bg_Window , 96 , 290 , F ( " Continue " ) ) ;
}
}
@ -985,12 +974,12 @@ void CrealityDWINClass::Update_Status_Bar(bool refresh/*=false*/) {
if ( process = = Print ) {
DWIN_Draw_Rectangle ( 1 , Color_Grey , 8 , 214 , DWIN_WIDTH - 8 , 238 ) ;
const int8_t npos = ( DWIN_WIDTH - 30 * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 219 , dispmsg ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 219 , dispmsg ) ;
}
else {
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 8 , 352 , DWIN_WIDTH - 8 , 376 ) ;
const int8_t npos = ( DWIN_WIDTH - 30 * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 357 , dispmsg ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 357 , dispmsg ) ;
}
if ( - pos > = 30 ) msgscrl = 0 ;
msgscrl + + ;
@ -1001,12 +990,12 @@ void CrealityDWINClass::Update_Status_Bar(bool refresh/*=false*/) {
if ( process = = Print ) {
DWIN_Draw_Rectangle ( 1 , Color_Grey , 8 , 214 , DWIN_WIDTH - 8 , 238 ) ;
const int8_t npos = ( DWIN_WIDTH - strlen ( statusmsg ) * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 219 , statusmsg ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 219 , statusmsg ) ;
}
else {
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 8 , 352 , DWIN_WIDTH - 8 , 376 ) ;
const int8_t npos = ( DWIN_WIDTH - strlen ( statusmsg ) * MENU_CHR_W ) / 2 ;
DWIN_Draw_String ( false , false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 357 , statusmsg ) ;
DWIN_Draw_String ( false , DWIN_FONT_MENU , GetColor ( eeprom_settings . status_bar_text , Color_White ) , Color_Bg_Black , npos , 357 , statusmsg ) ;
}
}
}
@ -1280,7 +1269,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
# if HAS_BED_PROBE
case MOVE_P :
if ( draw ) {
Draw_Menu_Item ( row , ICON_StockConfigurat on, " Probe " ) ;
Draw_Menu_Item ( row , ICON_StockConfigurat i on, " Probe " ) ;
Draw_Checkbox ( row , probe_deployed ) ;
}
else {
@ -2866,7 +2855,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
case Advanced :
# define ADVANCED_BACK 0
# define ADVANCED_BEEPER (ADVANCED_BACK + 1 )
# define ADVANCED_BEEPER (ADVANCED_BACK + ENABLED(SOUND_MENU_ITEM) )
# define ADVANCED_PROBE (ADVANCED_BEEPER + ENABLED(HAS_BED_PROBE))
# define ADVANCED_CORNER (ADVANCED_PROBE + 1)
# define ADVANCED_LA (ADVANCED_CORNER + ENABLED(LIN_ADVANCE))
@ -2886,16 +2875,18 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Menu ( Control , CONTROL_ADVANCED ) ;
break ;
case ADVANCED_BEEPER :
if ( draw ) {
Draw_Menu_Item ( row , ICON_Version , " LCD Beeper " ) ;
Draw_Checkbox ( row , eeprom_settings . beeperenable ) ;
}
else {
eeprom_settings . beeperenable = ! eeprom_settings . beeperenable ;
Draw_Checkbox ( row , eeprom_settings . beeperenable ) ;
}
break ;
# if ENABLED(SOUND_MENU_ITEM)
case ADVANCED_BEEPER :
if ( draw ) {
Draw_Menu_Item ( row , ICON_Version , " LCD Beeper " ) ;
Draw_Checkbox ( row , ui . buzzer_enabled ) ;
}
else {
ui . buzzer_enabled = ! ui . buzzer_enabled ;
Draw_Checkbox ( row , ui . buzzer_enabled ) ;
}
break ;
# endif
# if HAS_BED_PROBE
case ADVANCED_PROBE :
@ -3122,7 +3113,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
break ;
case LEVELING_ACTIVE :
if ( draw ) {
Draw_Menu_Item ( row , ICON_StockConfigurat on, " Leveling Active " ) ;
Draw_Menu_Item ( row , ICON_StockConfigurat i on, " Leveling Active " ) ;
Draw_Checkbox ( row , planner . leveling_active ) ;
}
else {
@ -3407,7 +3398,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if ( draw )
Draw_Menu_Item ( row , ICON_Mesh , " Zero Current Mesh " ) ;
else
ZERO ( mesh_conf. mesh_z_values ) ;
ZERO ( Z_VALUES_ARR ) ;
break ;
case LEVELING_SETTINGS_UNDEF :
if ( draw )
@ -3493,41 +3484,41 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
case LEVELING_M_OFFSET :
if ( draw ) {
Draw_Menu_Item ( row , ICON_SetZOffset , " Point Z Offset " ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row , false , 100 ) ;
}
else {
if ( isnan ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] ) )
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] = 0 ;
Modify_Value ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , MIN_Z_OFFSET , MAX_Z_OFFSET , 100 ) ;
if ( isnan ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] ) )
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] = 0 ;
Modify_Value ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , MIN_Z_OFFSET , MAX_Z_OFFSET , 100 ) ;
}
break ;
case LEVELING_M_UP :
if ( draw )
Draw_Menu_Item ( row , ICON_Axis , " Microstep Up " ) ;
else if ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] < MAX_Z_OFFSET ) {
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] + = 0.01 ;
else if ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] < MAX_Z_OFFSET ) {
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] + = 0.01 ;
gcode . process_subcommands_now_P ( PSTR ( " M290 Z0.01 " ) ) ;
planner . synchronize ( ) ;
current_position . z + = 0.01f ;
sync_plan_position ( ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 1 , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 1 , false , 100 ) ;
}
break ;
case LEVELING_M_DOWN :
if ( draw )
Draw_Menu_Item ( row , ICON_AxisD , " Microstep Down " ) ;
else if ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] > MIN_Z_OFFSET ) {
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] - = 0.01 ;
else if ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] > MIN_Z_OFFSET ) {
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] - = 0.01 ;
gcode . process_subcommands_now_P ( PSTR ( " M290 Z-0.01 " ) ) ;
planner . synchronize ( ) ;
current_position . z - = 0.01f ;
sync_plan_position ( ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 2 , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 2 , false , 100 ) ;
}
break ;
case LEVELING_M_GOTO_VALUE :
if ( draw ) {
Draw_Menu_Item ( row , ICON_StockConfigurat on, " Go to Mesh Z Value " ) ;
Draw_Menu_Item ( row , ICON_StockConfigurat i on, " Go to Mesh Z Value " ) ;
Draw_Checkbox ( row , mesh_conf . goto_mesh_value ) ;
}
else {
@ -3614,36 +3605,36 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
case UBL_M_OFFSET :
if ( draw ) {
Draw_Menu_Item ( row , ICON_SetZOffset , " Point Z Offset " ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row , false , 100 ) ;
}
else {
if ( isnan ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] ) )
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] = 0 ;
Modify_Value ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , MIN_Z_OFFSET , MAX_Z_OFFSET , 100 ) ;
if ( isnan ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] ) )
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] = 0 ;
Modify_Value ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , MIN_Z_OFFSET , MAX_Z_OFFSET , 100 ) ;
}
break ;
case UBL_M_UP :
if ( draw )
Draw_Menu_Item ( row , ICON_Axis , " Microstep Up " ) ;
else if ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] < MAX_Z_OFFSET ) {
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] + = 0.01 ;
else if ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] < MAX_Z_OFFSET ) {
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] + = 0.01 ;
gcode . process_subcommands_now_P ( PSTR ( " M290 Z0.01 " ) ) ;
planner . synchronize ( ) ;
current_position . z + = 0.01f ;
sync_plan_position ( ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 1 , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 1 , false , 100 ) ;
}
break ;
case UBL_M_DOWN :
if ( draw )
Draw_Menu_Item ( row , ICON_Axis , " Microstep Down " ) ;
else if ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] > MIN_Z_OFFSET ) {
mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] - = 0.01 ;
else if ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] > MIN_Z_OFFSET ) {
Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] - = 0.01 ;
gcode . process_subcommands_now_P ( PSTR ( " M290 Z-0.01 " ) ) ;
planner . synchronize ( ) ;
current_position . z - = 0.01f ;
sync_plan_position ( ) ;
Draw_Float ( mesh_conf. mesh_z_values [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 2 , false , 100 ) ;
Draw_Float ( Z_VALUES_ARR [ mesh_conf . mesh_x ] [ mesh_conf . mesh_y ] , row - 2 , false , 100 ) ;
}
break ;
}
@ -3733,7 +3724,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
if ( mesh_y % 2 = = 1 )
mesh_x = GRID_MAX_POINTS_X - mesh_x - 1 ;
const float currval = mesh_conf. mesh_z_values [ mesh_x ] [ mesh_y ] ;
const float currval = Z_VALUES_ARR [ mesh_x ] [ mesh_y ] ;
if ( draw ) {
Draw_Menu_Item ( row , ICON_Zoffset , " Goto Mesh Value " ) ;
@ -4215,7 +4206,7 @@ void CrealityDWINClass::Confirm_Handler(PopupID popupid) {
/* Navigation and Control */
void CrealityDWINClass : : Main_Menu_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW & & selection < PAGE_COUNT - 1 ) {
selection + + ; // Select Down
@ -4236,7 +4227,7 @@ void CrealityDWINClass::Main_Menu_Control() {
}
void CrealityDWINClass : : Menu_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW & & selection < Get_Menu_Size ( active_menu ) ) {
DWIN_Draw_Rectangle ( 1 , Color_Bg_Black , 0 , MBASE ( selection - scrollpos ) - 18 , 14 , MBASE ( selection - scrollpos ) + 33 ) ;
@ -4264,7 +4255,7 @@ void CrealityDWINClass::Menu_Control() {
}
void CrealityDWINClass : : Value_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW )
tempvalue + = EncoderRate . encoderMoveValue ;
@ -4329,7 +4320,7 @@ void CrealityDWINClass::Value_Control() {
}
void CrealityDWINClass : : Option_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW )
tempvalue + = EncoderRate . encoderMoveValue ;
@ -4368,7 +4359,7 @@ void CrealityDWINClass::Option_Control() {
}
void CrealityDWINClass : : File_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
static uint8_t filescrl = 0 ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) {
if ( selection > 0 ) {
@ -4456,7 +4447,7 @@ void CrealityDWINClass::File_Control() {
}
void CrealityDWINClass : : Print_Screen_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW & & selection < PRINT_COUNT - 1 ) {
selection + + ; // Select Down
@ -4509,7 +4500,7 @@ void CrealityDWINClass::Print_Screen_Control() {
}
void CrealityDWINClass : : Popup_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_CW & & selection < 1 ) {
selection + + ;
@ -4659,7 +4650,7 @@ void CrealityDWINClass::Popup_Control() {
}
void CrealityDWINClass : : Confirm_Control ( ) {
E NCODER_Diff State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
E ncoder State encoder_diffState = Encoder_ReceiveAnalyze ( ) ;
if ( encoder_diffState = = ENCODER_DIFF_NO ) return ;
if ( encoder_diffState = = ENCODER_DIFF_ENTER ) {
switch ( popup ) {
@ -4967,14 +4958,14 @@ void CrealityDWINClass::Screen_Update() {
void CrealityDWINClass : : AudioFeedback ( const bool success /*=true*/ ) {
if ( success ) {
if ( eeprom_settings. beeperenable ) {
if ( ui. buzzer_enabled ) {
BUZZ ( 100 , 659 ) ;
BUZZ ( 10 , 0 ) ;
BUZZ ( 100 , 698 ) ;
}
else Update_Status ( " Success " ) ;
}
else if ( eeprom_settings. beeperenable )
else if ( ui. buzzer_enabled )
BUZZ ( 40 , 440 ) ;
else
Update_Status ( " Failed " ) ;
@ -5003,7 +4994,6 @@ void CrealityDWINClass::Load_Settings(const char *buff) {
void CrealityDWINClass : : Reset_Settings ( ) {
eeprom_settings . time_format_textual = false ;
eeprom_settings . beeperenable = true ;
TERN_ ( AUTO_BED_LEVELING_UBL , eeprom_settings . tilt_grid_size = 0 ) ;
eeprom_settings . corner_pos = 325 ;
eeprom_settings . cursor_color = 0 ;
@ -5019,6 +5009,7 @@ void CrealityDWINClass::Reset_Settings() {
eeprom_settings . coordinates_split_line = 0 ;
TERN_ ( AUTO_BED_LEVELING_UBL , mesh_conf . tilt_grid = eeprom_settings . tilt_grid_size + 1 ) ;
corner_pos = eeprom_settings . corner_pos / 10.0f ;
TERN_ ( SOUND_MENU_ITEM , ui . buzzer_enabled = true ) ;
Redraw_Screen ( ) ;
}