Преглед на файлове

Cleanups for UBL / ultralcd.cpp

Scott Lahteine преди 8 години
родител
ревизия
d9da126776
променени са 3 файла, в които са добавени 25 реда и са изтрити 25 реда
  1. 2
    2
      Marlin/ubl_G29.cpp
  2. 22
    22
      Marlin/ultralcd.cpp
  3. 1
    1
      Marlin/ultralcd_impl_HD44780.h

+ 2
- 2
Marlin/ubl_G29.cpp Целия файл

45
     void lcd_mesh_edit_setup(float initial);
45
     void lcd_mesh_edit_setup(float initial);
46
     float lcd_mesh_edit();
46
     float lcd_mesh_edit();
47
     void lcd_z_offset_edit_setup(float);
47
     void lcd_z_offset_edit_setup(float);
48
-    #ifdef DOGLCD
48
+    #if ENABLED(DOGLCD)
49
       extern void _lcd_ubl_output_map_lcd();
49
       extern void _lcd_ubl_output_map_lcd();
50
     #endif
50
     #endif
51
     float lcd_z_offset_edit();
51
     float lcd_z_offset_edit();
1575
       SERIAL_ECHOLNPGM("Done Editing Mesh");
1575
       SERIAL_ECHOLNPGM("Done Editing Mesh");
1576
 
1576
 
1577
       if (ubl_lcd_map_control) {
1577
       if (ubl_lcd_map_control) {
1578
-        #ifdef 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
       }

+ 22
- 22
Marlin/ultralcd.cpp Целия файл

257
       _skipStatic = false; \
257
       _skipStatic = false; \
258
       _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
258
       _MENU_ITEM_PART_1(TYPE, ## __VA_ARGS__); \
259
       _MENU_ITEM_PART_2(TYPE, LABEL, ## __VA_ARGS__); \
259
       _MENU_ITEM_PART_2(TYPE, LABEL, ## __VA_ARGS__); \
260
-    } while(0)
260
+    }while(0)
261
 
261
 
262
   #define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
262
   #define MENU_BACK(LABEL) MENU_ITEM(back, LABEL, 0)
263
 
263
 
289
         encoderRateMultiplierEnabled = true; \
289
         encoderRateMultiplierEnabled = true; \
290
         lastEncoderMovementMillis = 0; \
290
         lastEncoderMovementMillis = 0; \
291
         _MENU_ITEM_PART_2(type, label, ## __VA_ARGS__); \
291
         _MENU_ITEM_PART_2(type, label, ## __VA_ARGS__); \
292
-      } while(0)
292
+      }while(0)
293
 
293
 
294
   #else // !ENCODER_RATE_MULTIPLIER
294
   #else // !ENCODER_RATE_MULTIPLIER
295
     #define ENCODER_RATE_MULTIPLY(F) NOOP
295
     #define ENCODER_RATE_MULTIPLY(F) NOOP
296
   #endif // !ENCODER_RATE_MULTIPLIER
296
   #endif // !ENCODER_RATE_MULTIPLIER
297
 
297
 
298
-  #define MENU_ITEM_DUMMY() do { _thisItemNr++; } while(0)
298
+  #define MENU_ITEM_DUMMY() do { _thisItemNr++; }while(0)
299
   #define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
299
   #define MENU_ITEM_EDIT(type, label, ...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## __VA_ARGS__)
300
   #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
300
   #define MENU_ITEM_EDIT_CALLBACK(type, label, ...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## __VA_ARGS__)
301
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
301
   #if ENABLED(ENCODER_RATE_MULTIPLIER)
2075
       enqueue_and_echo_command(ubl_lcd_gcode);
2075
       enqueue_and_echo_command(ubl_lcd_gcode);
2076
     }
2076
     }
2077
 
2077
 
2078
-  #ifdef DOGLCD
2078
+  #if ENABLED(DOGLCD)
2079
 
2079
 
2080
     /**
2080
     /**
2081
      * UBL LCD "radar" map data
2081
      * UBL LCD "radar" map data
2082
      */
2082
      */
2083
-  #define MAP_UPPER_LEFT_CORNER_X 35  // These probably should be moved to the .h file  But for now,
2084
-  #define MAP_UPPER_LEFT_CORNER_Y 8  // it is easier to play with things having them here
2085
-  #define MAP_MAX_PIXELS_X        53
2086
-  #define MAP_MAX_PIXELS_Y        49
2083
+    #define MAP_UPPER_LEFT_CORNER_X 35  // These probably should be moved to the .h file  But for now,
2084
+    #define MAP_UPPER_LEFT_CORNER_Y 8   // it is easier to play with things having them here
2085
+    #define MAP_MAX_PIXELS_X        53
2086
+    #define MAP_MAX_PIXELS_Y        49
2087
 
2087
 
2088
     void _lcd_ubl_plot_drawing_prep() {
2088
     void _lcd_ubl_plot_drawing_prep() {
2089
-      uint8_t i, j, x_offset, y_offset, x_map_pixels, y_map_pixels;
2090
-      uint8_t pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt, inverted_y;
2089
+      uint8_t i, j, x_offset, y_offset, x_map_pixels, y_map_pixels,
2090
+              pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt, inverted_y;
2091
 
2091
 
2092
       /*********************************************************/
2092
       /*********************************************************/
2093
       /************ Scale the box pixels appropriately *********/
2093
       /************ Scale the box pixels appropriately *********/
2098
       pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X;
2098
       pixels_per_X_mesh_pnt = x_map_pixels / GRID_MAX_POINTS_X;
2099
       pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y;
2099
       pixels_per_Y_mesh_pnt = y_map_pixels / GRID_MAX_POINTS_Y;
2100
 
2100
 
2101
-      x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X-x_map_pixels-2)/2;
2102
-      y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y-y_map_pixels-2)/2;
2101
+      x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2;
2102
+      y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2;
2103
 
2103
 
2104
       /*********************************************************/
2104
       /*********************************************************/
2105
       /************ Clear the Mesh Map Box**********************/
2105
       /************ Clear the Mesh Map Box**********************/
2106
       /*********************************************************/
2106
       /*********************************************************/
2107
 
2107
 
2108
       u8g.setColorIndex(1);  // First draw the bigger box in White so we have a border around the mesh map box
2108
       u8g.setColorIndex(1);  // First draw the bigger box in White so we have a border around the mesh map box
2109
-      u8g.drawBox(x_offset-2, y_offset-2, x_map_pixels+4, y_map_pixels+4);
2109
+      u8g.drawBox(x_offset - 2, y_offset - 2, x_map_pixels + 4, y_map_pixels + 4);
2110
 
2110
 
2111
       u8g.setColorIndex(0);  // Now actually clear the mesh map box
2111
       u8g.setColorIndex(0);  // Now actually clear the mesh map box
2112
       u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels);
2112
       u8g.drawBox(x_offset, y_offset, x_map_pixels, y_map_pixels);
2118
       u8g.setColorIndex(1);
2118
       u8g.setColorIndex(1);
2119
       for (i = 0; i < GRID_MAX_POINTS_X; i++) {
2119
       for (i = 0; i < GRID_MAX_POINTS_X; i++) {
2120
         for (j = 0; j < GRID_MAX_POINTS_Y; j++) {
2120
         for (j = 0; j < GRID_MAX_POINTS_Y; j++) {
2121
-          u8g.drawBox(x_offset+i*pixels_per_X_mesh_pnt+pixels_per_X_mesh_pnt/2,  
2122
-                      y_offset+j*pixels_per_Y_mesh_pnt+pixels_per_Y_mesh_pnt/2, 1, 1);
2121
+          u8g.drawBox(x_offset + i * pixels_per_X_mesh_pnt + pixels_per_X_mesh_pnt / 2,
2122
+                      y_offset + j * pixels_per_Y_mesh_pnt + pixels_per_Y_mesh_pnt / 2, 1, 1);
2123
         }
2123
         }
2124
       }
2124
       }
2125
 
2125
 
2127
       /************ Fill in the Specified Mesh Point ***********/
2127
       /************ Fill in the Specified Mesh Point ***********/
2128
       /*********************************************************/
2128
       /*********************************************************/
2129
 
2129
 
2130
-      inverted_y = GRID_MAX_POINTS_Y - y_plot - 1;    // The origin is typically in the lower right corner.  We need to 
2130
+      inverted_y = GRID_MAX_POINTS_Y - y_plot - 1;    // The origin is typically in the lower right corner.  We need to
2131
                                                       // invert the Y to get it to plot in the right location.
2131
                                                       // invert the Y to get it to plot in the right location.
2132
-      u8g.drawBox(x_offset+x_plot*pixels_per_X_mesh_pnt, y_offset+inverted_y*pixels_per_Y_mesh_pnt, 
2132
+      u8g.drawBox(x_offset + x_plot * pixels_per_X_mesh_pnt, y_offset + inverted_y * pixels_per_Y_mesh_pnt,
2133
                     pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt);
2133
                     pixels_per_X_mesh_pnt, pixels_per_Y_mesh_pnt);
2134
 
2134
 
2135
       /*********************************************************/
2135
       /*********************************************************/
2147
 
2147
 
2148
       // Print plot position
2148
       // Print plot position
2149
       u8g.setPrintPos(5, 64);
2149
       u8g.setPrintPos(5, 64);
2150
-      lcd_print("(");
2150
+      lcd_print('(');
2151
       u8g.print(x_plot);
2151
       u8g.print(x_plot);
2152
-      lcd_print(",");
2152
+      lcd_print(',');
2153
       u8g.print(y_plot);
2153
       u8g.print(y_plot);
2154
-      lcd_print(")");
2154
+      lcd_print(')');
2155
 
2155
 
2156
       // Show the location value
2156
       // Show the location value
2157
       u8g.setPrintPos(74, 64);
2157
       u8g.setPrintPos(74, 64);
2262
     void _lcd_ubl_output_map_lcd_cmd() {
2262
     void _lcd_ubl_output_map_lcd_cmd() {
2263
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2263
       if (!(axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]))
2264
         enqueue_and_echo_commands_P(PSTR("G28"));
2264
         enqueue_and_echo_commands_P(PSTR("G28"));
2265
-      lcd_goto_screen(_lcd_ubl_map_homing);     
2265
+      lcd_goto_screen(_lcd_ubl_map_homing);
2266
     }
2266
     }
2267
 
2267
 
2268
     /**
2268
     /**
3624
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
3624
         lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; \
3625
       } \
3625
       } \
3626
       ++_thisItemNr; \
3626
       ++_thisItemNr; \
3627
-    } while(0)
3627
+    }while(0)
3628
 
3628
 
3629
     void lcd_advanced_pause_toocold_menu() {
3629
     void lcd_advanced_pause_toocold_menu() {
3630
       START_MENU();
3630
       START_MENU();

+ 1
- 1
Marlin/ultralcd_impl_HD44780.h Целия файл

1012
 
1012
 
1013
   #endif // SDSUPPORT
1013
   #endif // SDSUPPORT
1014
 
1014
 
1015
-  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR,LCD_UPLEVEL_CHAR)
1015
+  #define lcd_implementation_drawmenu_back(sel, row, pstr, dummy) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_UPLEVEL_CHAR, LCD_UPLEVEL_CHAR)
1016
   #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
1016
   #define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
1017
   #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
1017
   #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
1018
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
1018
   #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')

Loading…
Отказ
Запис