Scott Lahteine 7 years ago
parent
commit
062131554f
4 changed files with 25 additions and 25 deletions
  1. 3
    3
      Marlin/language_en.h
  2. 13
    12
      Marlin/ubl.cpp
  3. 1
    1
      Marlin/ubl_G29.cpp
  4. 8
    9
      Marlin/ultralcd.cpp

+ 3
- 3
Marlin/language_en.h View File

280
 #ifndef MSG_UBL_OUTPUT_MAP_CSV
280
 #ifndef MSG_UBL_OUTPUT_MAP_CSV
281
   #define MSG_UBL_OUTPUT_MAP_CSV              _UxGT("Output for CSV")
281
   #define MSG_UBL_OUTPUT_MAP_CSV              _UxGT("Output for CSV")
282
 #endif
282
 #endif
283
-  #ifndef MSG_UBL_OUTPUT_MAP_BACKUP
284
-    #define MSG_UBL_OUTPUT_MAP_BACKUP         _UxGT("Off Printer Backup")
285
-  #endif
283
+#ifndef MSG_UBL_OUTPUT_MAP_BACKUP
284
+  #define MSG_UBL_OUTPUT_MAP_BACKUP           _UxGT("Off Printer Backup")
285
+#endif
286
 #ifndef MSG_UBL_INFO_UBL
286
 #ifndef MSG_UBL_INFO_UBL
287
   #define MSG_UBL_INFO_UBL                    _UxGT("Output UBL Info")
287
   #define MSG_UBL_INFO_UBL                    _UxGT("Output UBL Info")
288
 #endif
288
 #endif

+ 13
- 12
Marlin/ubl.cpp View File

115
   void unified_bed_leveling::display_map(const int map_type) {
115
   void unified_bed_leveling::display_map(const int map_type) {
116
     constexpr uint8_t spaces = 8 * (GRID_MAX_POINTS_X - 2);
116
     constexpr uint8_t spaces = 8 * (GRID_MAX_POINTS_X - 2);
117
 
117
 
118
+    SERIAL_PROTOCOLPGM("\nBed Topography Report");
118
     if (map_type == 0) {
119
     if (map_type == 0) {
119
-      SERIAL_PROTOCOLLNPGM("\nBed Topography Report:\n");
120
+      SERIAL_PROTOCOLPGM(":\n\n");
120
       serial_echo_xy(0, GRID_MAX_POINTS_Y - 1);
121
       serial_echo_xy(0, GRID_MAX_POINTS_Y - 1);
121
       SERIAL_ECHO_SP(spaces + 3);
122
       SERIAL_ECHO_SP(spaces + 3);
122
       serial_echo_xy(GRID_MAX_POINTS_X - 1, GRID_MAX_POINTS_Y - 1);
123
       serial_echo_xy(GRID_MAX_POINTS_X - 1, GRID_MAX_POINTS_Y - 1);
126
       serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MAX_Y);
127
       serial_echo_xy(UBL_MESH_MAX_X, UBL_MESH_MAX_Y);
127
       SERIAL_EOL();
128
       SERIAL_EOL();
128
     }
129
     }
129
-
130
-    if (map_type == 1) { SERIAL_PROTOCOLLNPGM("\nBed Topography Report for CSV:"); SERIAL_EOL(); }
131
-    if (map_type == 2) { SERIAL_PROTOCOLLNPGM("\nBed Topography Report for LCD:"); SERIAL_EOL(); }
130
+    else {
131
+      SERIAL_PROTOCOLPGM(" for ");
132
+      serialprintPGM(map_type == 1 ? PSTR("CSV:\n\n") : PSTR("LCD:\n\n"));
133
+    }
132
 
134
 
133
     const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0),
135
     const float current_xi = get_cell_index_x(current_position[X_AXIS] + (MESH_X_DIST) / 2.0),
134
                 current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);
136
                 current_yi = get_cell_index_y(current_position[Y_AXIS] + (MESH_Y_DIST) / 2.0);
142
 
144
 
143
         const float f = z_values[i][j];
145
         const float f = z_values[i][j];
144
         if (isnan(f)) {
146
         if (isnan(f)) {
145
-          serialprintPGM((map_type == 0) ? PSTR("    .   ") : PSTR("NAN"));
147
+          serialprintPGM(map_type == 0 ? PSTR("    .   ") : PSTR("NAN"));
146
         }
148
         }
147
-        else {
149
+        else if (map_type <= 1) {
148
           // if we don't do this, the columns won't line up nicely
150
           // if we don't do this, the columns won't line up nicely
149
-          if ((map_type == 0) && f >= 0.0) SERIAL_CHAR(' ');
150
-          if (map_type <= 1) SERIAL_PROTOCOL_F(f, 3);
151
-          idle();
151
+          if (map_type == 0 && f >= 0.0) SERIAL_CHAR(' ');
152
+          SERIAL_PROTOCOL_F(f, 3);
152
         }
153
         }
154
+        idle();
153
         if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');
155
         if (map_type == 1 && i < GRID_MAX_POINTS_X - 1) SERIAL_CHAR(',');
154
 
156
 
155
         #if TX_BUFFER_SIZE > 0
157
         #if TX_BUFFER_SIZE > 0
162
         }
164
         }
163
       }
165
       }
164
       SERIAL_EOL();
166
       SERIAL_EOL();
165
-      if (j && (map_type == 0)) { // we want the (0,0) up tight against the block of numbers
167
+      if (j && map_type == 0) { // we want the (0,0) up tight against the block of numbers
166
         SERIAL_CHAR(' ');
168
         SERIAL_CHAR(' ');
167
         SERIAL_EOL();
169
         SERIAL_EOL();
168
       }
170
       }
183
   bool unified_bed_leveling::sanity_check() {
185
   bool unified_bed_leveling::sanity_check() {
184
     uint8_t error_flag = 0;
186
     uint8_t error_flag = 0;
185
 
187
 
186
-    const int a = settings.calc_num_meshes();
187
-    if (a < 1) {
188
+    if (settings.calc_num_meshes() < 1) {
188
       SERIAL_PROTOCOLLNPGM("?Insufficient EEPROM storage for a mesh of this size.");
189
       SERIAL_PROTOCOLLNPGM("?Insufficient EEPROM storage for a mesh of this size.");
189
       error_flag++;
190
       error_flag++;
190
     }
191
     }

+ 1
- 1
Marlin/ubl_G29.cpp View File

1576
 
1576
 
1577
       if (ubl_lcd_map_control) {
1577
       if (ubl_lcd_map_control) {
1578
         #if ENABLED(DOGLCD)
1578
         #if ENABLED(DOGLCD)
1579
-        lcd_goto_screen(_lcd_ubl_output_map_lcd);
1579
+          lcd_goto_screen(_lcd_ubl_output_map_lcd);
1580
         #endif
1580
         #endif
1581
       }
1581
       }
1582
       else lcd_return_to_status();
1582
       else lcd_return_to_status();

+ 8
- 9
Marlin/ultralcd.cpp View File

2094
       /*********************************************************/
2094
       /*********************************************************/
2095
       /************ Scale the box pixels appropriately *********/
2095
       /************ Scale the box pixels appropriately *********/
2096
       /*********************************************************/
2096
       /*********************************************************/
2097
-      x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / GRID_MAX_POINTS_X) * GRID_MAX_POINTS_X;
2098
-      y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / GRID_MAX_POINTS_Y) * GRID_MAX_POINTS_Y;
2097
+      x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X);
2098
+      y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y);
2099
 
2099
 
2100
-      pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X;
2101
-      pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y;
2100
+      pixels_per_X_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X);
2101
+      pixels_per_Y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y);
2102
 
2102
 
2103
       x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2;
2103
       x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2;
2104
       y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2;
2104
       y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2;
2184
     void sync_plan_position();
2184
     void sync_plan_position();
2185
 
2185
 
2186
     void _lcd_ubl_output_map_lcd() {
2186
     void _lcd_ubl_output_map_lcd() {
2187
-      static int step_scaler=0;
2187
+      static int16_t step_scaler = 0;
2188
       int32_t signed_enc_pos;
2188
       int32_t signed_enc_pos;
2189
 
2189
 
2190
       defer_return_to_status = true;
2190
       defer_return_to_status = true;
2194
         if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); }
2194
         if (lcd_clicked) { return _lcd_ubl_map_lcd_edit_cmd(); }
2195
         ENCODER_DIRECTION_NORMAL();
2195
         ENCODER_DIRECTION_NORMAL();
2196
 
2196
 
2197
-        if (encoderPosition != 0) {
2197
+        if (encoderPosition) {
2198
           signed_enc_pos = (int32_t)encoderPosition;
2198
           signed_enc_pos = (int32_t)encoderPosition;
2199
           step_scaler += signed_enc_pos;
2199
           step_scaler += signed_enc_pos;
2200
-          x_plot = (x_plot + step_scaler / ENCODER_STEPS_PER_MENU_ITEM);
2201
-
2200
+          x_plot += step_scaler / (ENCODER_STEPS_PER_MENU_ITEM);
2202
           if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2201
           if (abs(step_scaler) >= ENCODER_STEPS_PER_MENU_ITEM)
2203
             step_scaler = 0;
2202
             step_scaler = 0;
2204
           refresh_cmd_timeout();
2203
           refresh_cmd_timeout();
2240
 
2239
 
2241
           ubl_map_move_to_xy(); // Move to current location
2240
           ubl_map_move_to_xy(); // Move to current location
2242
 
2241
 
2243
-          if (planner.movesplanned()>1) { // if the nozzle is moving, cancel the move.  There is a new location
2242
+          if (planner.movesplanned() > 1) { // if the nozzle is moving, cancel the move.  There is a new location
2244
             #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
2243
             #define ENABLE_STEPPER_DRIVER_INTERRUPT()  SBI(TIMSK1, OCIE1A)
2245
             #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
2244
             #define DISABLE_STEPPER_DRIVER_INTERRUPT() CBI(TIMSK1, OCIE1A)
2246
             DISABLE_STEPPER_DRIVER_INTERRUPT();
2245
             DISABLE_STEPPER_DRIVER_INTERRUPT();

Loading…
Cancel
Save