63
63
#include " dwin_popup.h"
64
64
#include " bedlevel_tools.h"
65
65
66
- BedLevelToolsClass bedLevelTools;
66
+ BedLevelTools bedLevelTools;
67
67
68
68
#if ENABLED(USE_UBL_VIEWER)
69
- bool BedLevelToolsClass ::viewer_asymmetric_range = false ;
70
- bool BedLevelToolsClass ::viewer_print_value = false ;
69
+ bool BedLevelTools ::viewer_asymmetric_range = false ;
70
+ bool BedLevelTools ::viewer_print_value = false ;
71
71
#endif
72
- bool BedLevelToolsClass ::goto_mesh_value = false ;
73
- uint8_t BedLevelToolsClass ::mesh_x = 0 ;
74
- uint8_t BedLevelToolsClass ::mesh_y = 0 ;
75
- uint8_t BedLevelToolsClass ::tilt_grid = 1 ;
72
+ bool BedLevelTools ::goto_mesh_value = false ;
73
+ uint8_t BedLevelTools ::mesh_x = 0 ;
74
+ uint8_t BedLevelTools ::mesh_y = 0 ;
75
+ uint8_t BedLevelTools ::tilt_grid = 1 ;
76
76
77
77
bool drawing_mesh = false ;
78
78
char cmd[MAX_CMD_SIZE+16 ], str_1[16 ], str_2[16 ], str_3[16 ];
79
79
80
80
#if ENABLED(AUTO_BED_LEVELING_UBL)
81
81
82
- void BedLevelToolsClass ::manual_value_update (const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/* =false*/ ) {
82
+ void BedLevelTools ::manual_value_update (const uint8_t mesh_x, const uint8_t mesh_y, bool undefined/* =false*/ ) {
83
83
sprintf_P (cmd, PSTR (" M421 I%i J%i Z%s %s" ), mesh_x, mesh_y, dtostrf (current_position.z , 1 , 3 , str_1), undefined ? " N" : " " );
84
84
gcode.process_subcommands_now (cmd);
85
85
planner.synchronize ();
86
86
}
87
87
88
- bool BedLevelToolsClass ::create_plane_from_mesh () {
88
+ bool BedLevelTools ::create_plane_from_mesh () {
89
89
struct linear_fit_data lsf_results;
90
90
incremental_LSF_reset (&lsf_results);
91
91
GRID_LOOP (x, y) {
@@ -125,15 +125,15 @@ char cmd[MAX_CMD_SIZE+16], str_1[16], str_2[16], str_3[16];
125
125
126
126
#else
127
127
128
- void BedLevelToolsClass ::manual_value_update (const uint8_t mesh_x, const uint8_t mesh_y) {
128
+ void BedLevelTools ::manual_value_update (const uint8_t mesh_x, const uint8_t mesh_y) {
129
129
sprintf_P (cmd, PSTR (" G29 I%i J%i Z%s" ), mesh_x, mesh_y, dtostrf (current_position.z , 1 , 3 , str_1));
130
130
gcode.process_subcommands_now (cmd);
131
131
planner.synchronize ();
132
132
}
133
133
134
134
#endif
135
135
136
- void BedLevelToolsClass ::manual_move (const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/* =false*/ ) {
136
+ void BedLevelTools ::manual_move (const uint8_t mesh_x, const uint8_t mesh_y, bool zmove/* =false*/ ) {
137
137
gcode.process_subcommands_now (F (" G28O" ));
138
138
if (zmove) {
139
139
planner.synchronize ();
@@ -142,8 +142,8 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y,
142
142
planner.synchronize ();
143
143
}
144
144
else {
145
- DWIN_Show_Popup (ICON_BLTouch, F (" Moving to Point" ), F (" Please wait until done." ));
146
- HMI_SaveProcessID (NothingToDo );
145
+ dwinShowPopup (ICON_BLTouch, F (" Moving to Point" ), F (" Please wait until done." ));
146
+ hmiSaveProcessID (ID_NothingToDo );
147
147
sprintf_P (cmd, PSTR (" G0 F300 Z%s" ), dtostrf (Z_CLEARANCE_BETWEEN_PROBES, 1 , 3 , str_1));
148
148
gcode.process_subcommands_now (cmd);
149
149
sprintf_P (cmd, PSTR (" G42 F4000 I%i J%i" ), mesh_x, mesh_y);
@@ -152,24 +152,24 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y,
152
152
current_position.z = goto_mesh_value ? bedlevel.z_values [mesh_x][mesh_y] : Z_CLEARANCE_BETWEEN_PROBES;
153
153
planner.buffer_line (current_position, homing_feedrate (Z_AXIS), active_extruder);
154
154
planner.synchronize ();
155
- HMI_ReturnScreen ();
155
+ hmiReturnScreen ();
156
156
}
157
157
}
158
158
159
159
// Move / Probe methods. As examples, not yet used.
160
- void BedLevelToolsClass ::MoveToXYZ () {
160
+ void BedLevelTools ::MoveToXYZ () {
161
161
bedLevelTools.goto_mesh_value = true ;
162
162
bedLevelTools.manual_move (bedLevelTools.mesh_x , bedLevelTools.mesh_y , false );
163
163
}
164
- void BedLevelToolsClass ::MoveToXY () {
164
+ void BedLevelTools ::MoveToXY () {
165
165
bedLevelTools.goto_mesh_value = false ;
166
166
bedLevelTools.manual_move (bedLevelTools.mesh_x , bedLevelTools.mesh_y , false );
167
167
}
168
- void BedLevelToolsClass ::MoveToZ () {
168
+ void BedLevelTools ::MoveToZ () {
169
169
bedLevelTools.goto_mesh_value = true ;
170
170
bedLevelTools.manual_move (bedLevelTools.mesh_x , bedLevelTools.mesh_y , true );
171
171
}
172
- void BedLevelToolsClass ::ProbeXY () {
172
+ void BedLevelTools ::ProbeXY () {
173
173
const uint16_t Clear = Z_CLEARANCE_DEPLOY_PROBE;
174
174
sprintf_P (cmd, PSTR (" G28O\n G0Z%i\n G30X%sY%s" ),
175
175
Clear,
@@ -180,7 +180,7 @@ void BedLevelToolsClass::ProbeXY() {
180
180
}
181
181
182
182
// Accessors
183
- float BedLevelToolsClass ::get_max_value () {
183
+ float BedLevelTools ::get_max_value () {
184
184
float max = __FLT_MAX__ * -1 ;
185
185
GRID_LOOP (x, y) {
186
186
if (!isnan (bedlevel.z_values [x][y]) && bedlevel.z_values [x][y] > max)
@@ -189,7 +189,7 @@ float BedLevelToolsClass::get_max_value() {
189
189
return max;
190
190
}
191
191
192
- float BedLevelToolsClass ::get_min_value () {
192
+ float BedLevelTools ::get_min_value () {
193
193
float min = __FLT_MAX__;
194
194
GRID_LOOP (x, y) {
195
195
if (!isnan (bedlevel.z_values [x][y]) && bedlevel.z_values [x][y] < min)
@@ -199,7 +199,7 @@ float BedLevelToolsClass::get_min_value() {
199
199
}
200
200
201
201
// Return 'true' if mesh is good and within LCD limits
202
- bool BedLevelToolsClass ::meshvalidate () {
202
+ bool BedLevelTools ::meshvalidate () {
203
203
GRID_LOOP (x, y) {
204
204
const float v = bedlevel.z_values [x][y];
205
205
if (isnan (v) || !WITHIN (v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false ;
@@ -209,7 +209,7 @@ bool BedLevelToolsClass::meshvalidate() {
209
209
210
210
#if ENABLED(USE_UBL_VIEWER)
211
211
212
- void BedLevelToolsClass::Draw_Bed_Mesh (int16_t selected /* = -1*/ , uint8_t gridline_width /* = 1*/ , uint16_t padding_x /* = 8*/ , uint16_t padding_y_top /* = 40 + 53 - 7*/ ) {
212
+ void BedLevelTools::drawBedMesh (int16_t selected /* = -1*/ , uint8_t gridline_width /* = 1*/ , uint16_t padding_x /* = 8*/ , uint16_t padding_y_top /* = 40 + 53 - 7*/ ) {
213
213
drawing_mesh = true ;
214
214
const uint16_t total_width_px = DWIN_WIDTH - padding_x - padding_x;
215
215
const uint16_t cell_width_px = total_width_px / (GRID_MAX_POINTS_X);
@@ -267,7 +267,7 @@ bool BedLevelToolsClass::meshvalidate() {
267
267
}
268
268
}
269
269
270
- void BedLevelToolsClass::Set_Mesh_Viewer_Status () { // TODO: draw gradient with values as a legend instead
270
+ void BedLevelTools::setMeshViewerStatus () { // TODO: draw gradient with values as a legend instead
271
271
float v_max = abs (get_max_value ()), v_min = abs (get_min_value ()), range = _MAX (v_min, v_max);
272
272
if (v_min > 3e+10F ) v_min = 0.0000001 ;
273
273
if (v_max > 3e+10F ) v_max = 0.0000001 ;
0 commit comments