Bläddra i källkod

Further repairs to UBL, comments, spacing

Scott Lahteine 7 år sedan
förälder
incheckning
9e4bd6b3b5

+ 22
- 27
Marlin/G26_Mesh_Validation_Tool.cpp Visa fil

@@ -38,7 +38,7 @@
38 38
 
39 39
   #define EXTRUSION_MULTIPLIER 1.0    // This is too much clutter for the main Configuration.h file  But
40 40
   #define RETRACTION_MULTIPLIER 1.0   // some user have expressed an interest in being able to customize
41
-  #define NOZZLE 0.3                  // these numbers for thier printer so they don't need to type all
41
+  #define NOZZLE 0.3                  // these numbers for their printer so they don't need to type all
42 42
   #define FILAMENT 1.75               // the options every time they do a Mesh Validation Print.
43 43
   #define LAYER_HEIGHT 0.2
44 44
   #define PRIME_LENGTH 10.0           // So, we put these number in an easy to find and change place.
@@ -113,10 +113,7 @@
113 113
    *   Y #  Y coordinate  Specify the starting location of the drawing activity.
114 114
    */
115 115
 
116
-  extern bool g26_debug_flag;
117
-  extern bool ubl_has_control_of_lcd_panel;
118 116
   extern float feedrate;
119
-  //extern bool relative_mode;
120 117
   extern Planner planner;
121 118
   //#if ENABLED(ULTRA_LCD)
122 119
     extern char lcd_status_message[];
@@ -197,12 +194,10 @@
197 194
       set_current_to_destination();
198 195
     }
199 196
 
200
-    ubl_has_control_of_lcd_panel = true; // Take control of the LCD Panel!
197
+    ubl.has_control_of_lcd_panel = true; // Take control of the LCD Panel!
201 198
     if (turn_on_heaters())     // Turn on the heaters, leave the command if anything
202 199
       goto LEAVE;              // has gone wrong.
203 200
 
204
-    axis_relative_modes[E_AXIS] = false;    // Get things setup so we can take control of the
205
-    //relative_mode = false;                  // planner and stepper motors!
206 201
     current_position[E_AXIS] = 0.0;
207 202
     sync_plan_position_e();
208 203
 
@@ -232,7 +227,7 @@
232 227
     move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0.0);
233 228
     move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], ooze_amount);
234 229
 
235
-    ubl_has_control_of_lcd_panel = true; // Take control of the LCD Panel!
230
+    ubl.has_control_of_lcd_panel = true; // Take control of the LCD Panel!
236 231
     //debug_current_and_destination((char*)"Starting G26 Mesh Validation Pattern.");
237 232
 
238 233
     /**
@@ -292,7 +287,7 @@
292 287
         xi = location.x_index;  // Just to shrink the next few lines and make them easier to understand
293 288
         yi = location.y_index;
294 289
 
295
-        if (g26_debug_flag) {
290
+        if (ubl.g26_debug_flag) {
296 291
           SERIAL_ECHOPAIR("   Doing circle at: (xi=", xi);
297 292
           SERIAL_ECHOPAIR(", yi=", yi);
298 293
           SERIAL_CHAR(')');
@@ -346,7 +341,7 @@
346 341
             ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
347 342
           #endif
348 343
 
349
-          //if (g26_debug_flag) {
344
+          //if (ubl.g26_debug_flag) {
350 345
           //  char ccc, *cptr, seg_msg[50], seg_num[10];
351 346
           //  strcpy(seg_msg, "   segment: ");
352 347
           //  strcpy(seg_num, "    \n");
@@ -364,7 +359,7 @@
364 359
         //if (lcd_init_counter > 10) {
365 360
         //  lcd_init_counter = 0;
366 361
         //  lcd_init(); // Some people's LCD Displays are locking up.  This might help them
367
-        //  ubl_has_control_of_lcd_panel = true;     // Make sure UBL still is controlling the LCD Panel
362
+        //  ubl.has_control_of_lcd_panel = true;     // Make sure UBL still is controlling the LCD Panel
368 363
         //}
369 364
 
370 365
         //debug_current_and_destination((char*)"Looking for lines to connect.");
@@ -394,7 +389,7 @@
394 389
     move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 0); // Move back to the starting position
395 390
     //debug_current_and_destination((char*)"done doing X/Y move.");
396 391
 
397
-    ubl_has_control_of_lcd_panel = false;     // Give back control of the LCD Panel!
392
+    ubl.has_control_of_lcd_panel = false;     // Give back control of the LCD Panel!
398 393
 
399 394
     if (!keep_heaters_on) {
400 395
       #if HAS_TEMP_BED
@@ -479,7 +474,7 @@
479 474
               ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
480 475
               ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
481 476
 
482
-              if (g26_debug_flag) {
477
+              if (ubl.g26_debug_flag) {
483 478
                 SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
484 479
                 SERIAL_ECHOPAIR(", sy=", sy);
485 480
                 SERIAL_ECHOPAIR(") -> (ex=", ex);
@@ -516,7 +511,7 @@
516 511
                 ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
517 512
                 ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
518 513
 
519
-                if (g26_debug_flag) {
514
+                if (ubl.g26_debug_flag) {
520 515
                   SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
521 516
                   SERIAL_ECHOPAIR(", sy=", sy);
522 517
                   SERIAL_ECHOPAIR(") -> (ex=", ex);
@@ -541,10 +536,10 @@
541 536
 
542 537
     bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
543 538
 
544
-    //if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to()  has_xy_component:", (int)has_xy_component);
539
+    //if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to()  has_xy_component:", (int)has_xy_component);
545 540
 
546 541
     if (z != last_z) {
547
-      //if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to()  changing Z to ", (int)z);
542
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to()  changing Z to ", (int)z);
548 543
 
549 544
       last_z = z;
550 545
       feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0);  // Base the feed rate off of the configured Z_AXIS feed rate
@@ -559,24 +554,24 @@
559 554
       stepper.synchronize();
560 555
       set_destination_to_current();
561 556
 
562
-      //if (g26_debug_flag) debug_current_and_destination((char*)" in move_to() done with Z move");
557
+      //if (ubl.g26_debug_flag) debug_current_and_destination((char*)" in move_to() done with Z move");
563 558
     }
564 559
 
565 560
     // Check if X or Y is involved in the movement.
566 561
     // Yes: a 'normal' movement. No: a retract() or un_retract()
567 562
     feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5;
568 563
 
569
-    if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
564
+    if (ubl.g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
570 565
 
571 566
     destination[X_AXIS] = x;
572 567
     destination[Y_AXIS] = y;
573 568
     destination[E_AXIS] += e_delta;
574 569
 
575
-    //if (g26_debug_flag) debug_current_and_destination((char*)" in move_to() doing last move");
570
+    //if (ubl.g26_debug_flag) debug_current_and_destination((char*)" in move_to() doing last move");
576 571
 
577 572
     ubl_line_to_destination(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feed_value, 0);
578 573
 
579
-    //if (g26_debug_flag) debug_current_and_destination((char*)" in move_to() after last move");
574
+    //if (ubl.g26_debug_flag) debug_current_and_destination((char*)" in move_to() after last move");
580 575
 
581 576
     stepper.synchronize();
582 577
     set_destination_to_current();
@@ -586,9 +581,9 @@
586 581
   void retract_filament() {
587 582
     if (!g26_retracted) { // Only retract if we are not already retracted!
588 583
       g26_retracted = true;
589
-      //if (g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
584
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Decided to do retract.");
590 585
       move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], -1.0 * retraction_multiplier);
591
-      //if (g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
586
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" Retraction done.");
592 587
     }
593 588
   }
594 589
 
@@ -596,7 +591,7 @@
596 591
     if (g26_retracted) { // Only un-retract if we are retracted.
597 592
       move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], 1.2 * retraction_multiplier);
598 593
       g26_retracted = false;
599
-      //if (g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
594
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM(" unretract done.");
600 595
     }
601 596
   }
602 597
 
@@ -633,7 +628,7 @@
633 628
     // On very small lines we don't do the optimization because it just isn't worth it.
634 629
     //
635 630
     if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < abs(line_length)) {
636
-      //if (g26_debug_flag) SERIAL_ECHOLNPGM("  Reversing start and end of print_line_from_here_to_there()");
631
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM("  Reversing start and end of print_line_from_here_to_there()");
637 632
       print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
638 633
       return;
639 634
     }
@@ -642,7 +637,7 @@
642 637
 
643 638
     if (dist_start > 2.0) {
644 639
       retract_filament();
645
-      //if (g26_debug_flag) SERIAL_ECHOLNPGM("  filament retracted.");
640
+      //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM("  filament retracted.");
646 641
     }
647 642
     move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion
648 643
 
@@ -650,7 +645,7 @@
650 645
 
651 646
     un_retract_filament();
652 647
 
653
-    //if (g26_debug_flag) {
648
+    //if (ubl.g26_debug_flag) {
654 649
     //  SERIAL_ECHOLNPGM("  doing printing move.");
655 650
     //  debug_current_and_destination((char*)"doing final move_to() inside print_line_from_here_to_there()");
656 651
     //}
@@ -810,7 +805,7 @@
810 805
           lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99);
811 806
           lcd_quick_feedback();
812 807
       #endif
813
-          ubl_has_control_of_lcd_panel = true;
808
+          ubl.has_control_of_lcd_panel = true;
814 809
           thermalManager.setTargetBed(bed_temp);
815 810
           while (abs(thermalManager.degBed() - bed_temp) > 3) {
816 811
             if (ubl_lcd_clicked()) return exit_from_g26();

+ 2
- 2
Marlin/M100_Free_Mem_Chk.cpp Visa fil

@@ -76,10 +76,10 @@ void gcode_M100() {
76 76
       // We want to start and end the dump on a nice 16 byte boundry even though
77 77
       // the values we are using are not 16 byte aligned.
78 78
       //
79
-      SERIAL_ECHOPAIR("\nbss_end : ", hex_word((uint16_t)ptr));
79
+      SERIAL_ECHOPAIR("\nbss_end : 0x", hex_word((uint16_t)ptr));
80 80
       ptr = (char*)((uint32_t)ptr & 0xfff0);
81 81
       sp = top_of_stack();
82
-      SERIAL_ECHOLNPAIR("\nStack Pointer : ", hex_word((uint16_t)sp));
82
+      SERIAL_ECHOLNPAIR("\nStack Pointer : 0x", hex_word((uint16_t)sp));
83 83
       sp = (char*)((uint32_t)sp | 0x000f);
84 84
       n = sp - ptr;
85 85
       //

+ 19
- 21
Marlin/Marlin_main.cpp Visa fil

@@ -299,13 +299,11 @@
299 299
 #if ENABLED(AUTO_BED_LEVELING_UBL)
300 300
   #include "UBL.h"
301 301
   unified_bed_leveling ubl;
302
-  #define UBL_MESH_VALID !( ( z_values[0][0] == z_values[0][1] && z_values[0][1] == z_values[0][2] \
303
-                           && z_values[1][0] == z_values[1][1] && z_values[1][1] == z_values[1][2] \
304
-                           && z_values[2][0] == z_values[2][1] && z_values[2][1] == z_values[2][2] \
305
-                           && z_values[0][0] == 0 && z_values[1][0] == 0 && z_values[2][0] == 0 )  \
306
-                           || isnan(z_values[0][0]))
307
-  extern bool g26_debug_flag;
308
-  extern int ubl_eeprom_start;
302
+  #define UBL_MESH_VALID !( ( ubl.z_values[0][0] == ubl.z_values[0][1] && ubl.z_values[0][1] == ubl.z_values[0][2] \
303
+                           && ubl.z_values[1][0] == ubl.z_values[1][1] && ubl.z_values[1][1] == ubl.z_values[1][2] \
304
+                           && ubl.z_values[2][0] == ubl.z_values[2][1] && ubl.z_values[2][1] == ubl.z_values[2][2] \
305
+                           && ubl.z_values[0][0] == 0 && ubl.z_values[1][0] == 0 && ubl.z_values[2][0] == 0 )  \
306
+                           || isnan(ubl.z_values[0][0]))
309 307
 #endif
310 308
 
311 309
 bool Running = true;
@@ -5349,11 +5347,9 @@ inline void gcode_M42() {
5349 5347
 #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_MESH_EDIT_ENABLED)
5350 5348
 
5351 5349
   inline void gcode_M49() {
5350
+    ubl.g26_debug_flag = !ubl.g26_debug_flag;
5352 5351
     SERIAL_PROTOCOLPGM("UBL Debug Flag turned ");
5353
-    if ((g26_debug_flag = !g26_debug_flag))
5354
-      SERIAL_PROTOCOLLNPGM("on.");
5355
-    else
5356
-      SERIAL_PROTOCOLLNPGM("off.");
5352
+    serialprintPGM(ubl.g26_debug_flag ? PSTR("on.") : PSTR("off."));
5357 5353
   }
5358 5354
 
5359 5355
 #endif // AUTO_BED_LEVELING_UBL && UBL_MESH_EDIT_ENABLED
@@ -7212,11 +7208,13 @@ void quickstop_stepper() {
7212 7208
   /**
7213 7209
    * M420: Enable/Disable Bed Leveling and/or set the Z fade height.
7214 7210
    *
7215
-   *       S[bool]   Turns leveling on or off
7216
-   *       Z[height] Sets the Z fade height (0 or none to disable)
7217
-   *       V[bool]   Verbose - Print the leveling grid
7211
+   *   S[bool]   Turns leveling on or off
7212
+   *   Z[height] Sets the Z fade height (0 or none to disable)
7213
+   *   V[bool]   Verbose - Print the leveling grid
7214
+   *
7215
+   *   With AUTO_BED_LEVELING_UBL only:
7218 7216
    *
7219
-   *       L[index]  Load UBL mesh from index (0 is default)
7217
+   *     L[index]  Load UBL mesh from index (0 is default)
7220 7218
    */
7221 7219
   inline void gcode_M420() {
7222 7220
 
@@ -7224,15 +7222,15 @@ void quickstop_stepper() {
7224 7222
       // L to load a mesh from the EEPROM
7225 7223
       if (code_seen('L')) {
7226 7224
         const int8_t storage_slot = code_has_value() ? code_value_int() : ubl.state.eeprom_storage_slot;
7227
-        const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(z_values);
7225
+        const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
7228 7226
         if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
7229 7227
           SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
7230 7228
           return;
7231 7229
         }
7232
-        ubl.load_mesh(Storage_Slot);
7233
-        ubl.state.eeprom_storage_slot = Storage_Slot;
7234
-        if (Storage_Slot != ubl.state.eeprom_storage_slot)
7235
-          ubl.store_state();
7230
+
7231
+        ubl.load_mesh(storage_slot);
7232
+        if (storage_slot != ubl.state.eeprom_storage_slot) ubl.store_state();
7233
+        ubl.state.eeprom_storage_slot = storage_slot;
7236 7234
         ubl.display_map(0);  // Right now, we only support one type of map
7237 7235
         SERIAL_ECHOLNPAIR("UBL_MESH_VALID =  ", UBL_MESH_VALID);
7238 7236
         SERIAL_ECHOLNPAIR("eeprom_storage_slot = ", ubl.state.eeprom_storage_slot);
@@ -8736,7 +8734,7 @@ void process_next_command() {
8736 8734
       #endif // Z_MIN_PROBE_REPEATABILITY_TEST
8737 8735
 
8738 8736
       #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_MESH_EDIT_ENABLED)
8739
-        case 49: // M49: Turn on or off g26_debug_flag for verbose output
8737
+        case 49: // M49: Turn on or off G26 debug flag for verbose output
8740 8738
           gcode_M49();
8741 8739
           break;
8742 8740
       #endif // AUTO_BED_LEVELING_UBL && UBL_MESH_EDIT_ENABLED

+ 42
- 25
Marlin/UBL.h Visa fil

@@ -81,20 +81,33 @@
81 81
     #define MESH_X_DIST ((float(UBL_MESH_MAX_X) - float(UBL_MESH_MIN_X)) / (float(UBL_MESH_NUM_X_POINTS) - 1.0))
82 82
     #define MESH_Y_DIST ((float(UBL_MESH_MAX_Y) - float(UBL_MESH_MIN_Y)) / (float(UBL_MESH_NUM_Y_POINTS) - 1.0))
83 83
 
84
-    extern float last_specified_z;
85
-    extern float fade_scaling_factor_for_current_height;
86
-    extern float z_values[UBL_MESH_NUM_X_POINTS][UBL_MESH_NUM_Y_POINTS];
87 84
     extern float mesh_index_to_x_location[UBL_MESH_NUM_X_POINTS + 1]; // +1 just because of paranoia that we might end up on the
88 85
     extern float mesh_index_to_y_location[UBL_MESH_NUM_Y_POINTS + 1]; // the last Mesh Line and that is the start of a whole new cell
89 86
 
90 87
     class unified_bed_leveling {
88
+      private:
89
+
90
+      float last_specified_z,
91
+            fade_scaling_factor_for_current_height;
92
+
91 93
       public:
94
+
95
+      float z_values[UBL_MESH_NUM_X_POINTS][UBL_MESH_NUM_Y_POINTS];
96
+
97
+      bool g26_debug_flag = false,
98
+           has_control_of_lcd_panel = false;
99
+
100
+      int8_t eeprom_start = -1;
101
+
102
+      volatile int encoder_diff; // Volatile because it's changed at interrupt time.
103
+
92 104
       struct ubl_state {
93 105
         bool active = false;
94 106
         float z_offset = 0.0;
95
-        int eeprom_storage_slot = -1,
96
-            n_x = UBL_MESH_NUM_X_POINTS,
97
-            n_y = UBL_MESH_NUM_Y_POINTS;
107
+        int8_t eeprom_storage_slot = -1,
108
+               n_x = UBL_MESH_NUM_X_POINTS,
109
+               n_y = UBL_MESH_NUM_Y_POINTS;
110
+
98 111
         float mesh_x_min = UBL_MESH_MIN_X,
99 112
               mesh_y_min = UBL_MESH_MIN_Y,
100 113
               mesh_x_max = UBL_MESH_MAX_X,
@@ -104,23 +117,26 @@
104 117
 
105 118
         #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
106 119
           float g29_correction_fade_height = 10.0,
107
-                g29_fade_height_multiplier = 1.0 / 10.0; // It is cheaper to do a floating point multiply than a floating
108
-                                                         // point divide. So, we keep this number in both forms. The first
109
-                                                         // is for the user. The second one is the one that is actually used
110
-                                                         // again and again and again during the correction calculations.
120
+                g29_fade_height_multiplier = 1.0 / 10.0; // It's cheaper to do a floating point multiply than divide,
121
+                                                         // so keep this value and its reciprocal.
122
+        #else
123
+          const float g29_correction_fade_height = 10.0,
124
+                      g29_fade_height_multiplier = 1.0 / 10.0;
111 125
         #endif
112 126
 
113
-        unsigned char padding[24];  // This is just to allow room to add state variables without
114
-                                    // changing the location of data structures in the EEPROM.
115
-                                    // This is for compatability with future versions to keep
116
-                                    // people from having to regenerate thier mesh data.
117
-                                    //
118
-                                    // If you change the contents of this struct, please adjust
119
-                                    // the padding[] to keep the size the same!
127
+        // If you change this struct, adjust TOTAL_STRUCT_SIZE
128
+
129
+        #define TOTAL_STRUCT_SIZE 43 // Total size of the above fields
130
+
131
+        // padding provides space to add state variables without
132
+        // changing the location of data structures in the EEPROM.
133
+        // This is for compatibility with future versions to keep
134
+        // users from having to regenerate their mesh data.
135
+        unsigned char padding[64 - TOTAL_STRUCT_SIZE];
136
+
120 137
       } state, pre_initialized;
121 138
 
122 139
       unified_bed_leveling();
123
-      //  ~unified_bed_leveling();  // No destructor because this object never goes away!
124 140
 
125 141
       void display_map(const int);
126 142
 
@@ -269,8 +285,9 @@
269 285
         #if ENABLED(DEBUG_LEVELING_FEATURE)
270 286
           if (DEBUGGING(MESH_ADJUST)) {
271 287
             SERIAL_ECHOPAIR(" raw get_z_correction(", x0);
272
-            SERIAL_ECHOPAIR(",", y0);
273
-            SERIAL_ECHOPGM(")=");
288
+            SERIAL_CHAR(',')
289
+            SERIAL_ECHO(y0);
290
+            SERIAL_ECHOPGM(") = ");
274 291
             SERIAL_ECHO_F(z0, 6);
275 292
           }
276 293
         #endif
@@ -291,11 +308,11 @@
291 308
 
292 309
           #if ENABLED(DEBUG_LEVELING_FEATURE)
293 310
             if (DEBUGGING(MESH_ADJUST)) {
294
-              SERIAL_ECHOPGM("??? Yikes!  NAN in get_z_correction( ");
295
-              SERIAL_ECHO(x0);
296
-              SERIAL_ECHOPGM(", ");
311
+              SERIAL_ECHOPAIR("??? Yikes!  NAN in get_z_correction(", x0);
312
+              SERIAL_CHAR(',');
297 313
               SERIAL_ECHO(y0);
298
-              SERIAL_ECHOLNPGM(" )");
314
+              SERIAL_CHAR(')');
315
+              SERIAL_EOL;
299 316
             }
300 317
           #endif
301 318
         }
@@ -313,7 +330,7 @@
313 330
        */
314 331
       #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
315 332
 
316
-        FORCE_INLINE float fade_scaling_factor_for_z(const float &lz) const {
333
+        FORCE_INLINE float fade_scaling_factor_for_z(const float &lz) {
317 334
           const float rz = RAW_Z_POSITION(lz);
318 335
           if (last_specified_z != rz) {
319 336
             last_specified_z = rz;

+ 19
- 32
Marlin/UBL_Bed_Leveling.cpp Visa fil

@@ -27,7 +27,6 @@
27 27
 
28 28
   #include "UBL.h"
29 29
   #include "hex_print_routines.h"
30
-  extern int ubl_eeprom_start;
31 30
 
32 31
   /**
33 32
    * These support functions allow the use of large bit arrays of flags that take very
@@ -65,10 +64,7 @@
65 64
    * 'member data'. So, in the interest of speed, we do it this way. On a 32-bit CPU they can be
66 65
    * moved back inside the bed leveling class.
67 66
    */
68
-  float last_specified_z,
69
-        fade_scaling_factor_for_current_height,
70
-        z_values[UBL_MESH_NUM_X_POINTS][UBL_MESH_NUM_Y_POINTS],
71
-        mesh_index_to_x_location[UBL_MESH_NUM_X_POINTS + 1], // +1 just because of paranoia that we might end up on the
67
+  float mesh_index_to_x_location[UBL_MESH_NUM_X_POINTS + 1], // +1 just because of paranoia that we might end up on the
72 68
         mesh_index_to_y_location[UBL_MESH_NUM_Y_POINTS + 1]; // the last Mesh Line and that is the start of a whole new cell
73 69
 
74 70
   unified_bed_leveling::unified_bed_leveling() {
@@ -96,7 +92,7 @@
96 92
     #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
97 93
       /**
98 94
        * These lines can go away in a few weeks.  They are just
99
-       * to make sure people updating thier firmware won't be using
95
+       * to make sure people updating their firmware won't be using
100 96
        * an incomplete Bed_Leveling.state structure. For speed
101 97
        * we now multiply by the inverse of the Fade Height instead of
102 98
        * dividing by it. Soon... all of the old structures will be
@@ -111,7 +107,7 @@
111 107
   }
112 108
 
113 109
   void unified_bed_leveling::load_mesh(const int16_t m) {
114
-    int16_t j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values);
110
+    int16_t j = (UBL_LAST_EEPROM_INDEX - eeprom_start) / sizeof(z_values);
115 111
 
116 112
     if (m == -1) {
117 113
       SERIAL_PROTOCOLLNPGM("?No mesh saved in EEPROM. Zeroing mesh in memory.\n");
@@ -119,7 +115,7 @@
119 115
       return;
120 116
     }
121 117
 
122
-    if (m < 0 || m >= j || ubl_eeprom_start <= 0) {
118
+    if (m < 0 || m >= j || eeprom_start <= 0) {
123 119
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
124 120
       return;
125 121
     }
@@ -132,9 +128,9 @@
132 128
   }
133 129
 
134 130
   void unified_bed_leveling::store_mesh(const int16_t m) {
135
-    int16_t j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values);
131
+    int16_t j = (UBL_LAST_EEPROM_INDEX - eeprom_start) / sizeof(z_values);
136 132
 
137
-    if (m < 0 || m >= j || ubl_eeprom_start <= 0) {
133
+    if (m < 0 || m >= j || eeprom_start <= 0) {
138 134
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available to load mesh.\n");
139 135
       SERIAL_PROTOCOL(m);
140 136
       SERIAL_PROTOCOLLNPGM(" mesh slots available.\n");
@@ -202,9 +198,8 @@
202 198
       for (uint8_t i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
203 199
         const bool is_current = i == current_xi && j == current_yi;
204 200
 
205
-        // is the nozzle here?  if so, mark the number
206
-        if (map0)
207
-          SERIAL_CHAR(is_current ? '[' : ' ');
201
+        // is the nozzle here? then mark the number
202
+        if (map0) SERIAL_CHAR(is_current ? '[' : ' ');
208 203
 
209 204
         const float f = z_values[i][j];
210 205
         if (isnan(f)) {
@@ -212,12 +207,11 @@
212 207
         }
213 208
         else {
214 209
           // if we don't do this, the columns won't line up nicely
215
-          if (f >= 0.0 && map0) SERIAL_CHAR(' ');
210
+          if (map0 && f >= 0.0) SERIAL_CHAR(' ');
216 211
           SERIAL_PROTOCOL_F(f, 3);
217 212
           idle();
218 213
         }
219
-        if (!map0 && i < UBL_MESH_NUM_X_POINTS - 1)
220
-         SERIAL_CHAR(',');
214
+        if (!map0 && i < UBL_MESH_NUM_X_POINTS - 1) SERIAL_CHAR(',');
221 215
 
222 216
         #if TX_BUFFER_SIZE > 0
223 217
           MYSERIAL.flushTX();
@@ -252,47 +246,40 @@
252 246
   bool unified_bed_leveling::sanity_check() {
253 247
     uint8_t error_flag = 0;
254 248
 
255
-    if (state.n_x !=  UBL_MESH_NUM_X_POINTS) {
249
+    if (state.n_x != UBL_MESH_NUM_X_POINTS) {
256 250
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_NUM_X_POINTS set wrong\n");
257 251
       error_flag++;
258 252
     }
259
-
260
-    if (state.n_y !=  UBL_MESH_NUM_Y_POINTS) {
253
+    if (state.n_y != UBL_MESH_NUM_Y_POINTS) {
261 254
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_NUM_Y_POINTS set wrong\n");
262 255
       error_flag++;
263 256
     }
264
-
265
-    if (state.mesh_x_min !=  UBL_MESH_MIN_X) {
257
+    if (state.mesh_x_min != UBL_MESH_MIN_X) {
266 258
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_MIN_X set wrong\n");
267 259
       error_flag++;
268 260
     }
269
-
270
-    if (state.mesh_y_min !=  UBL_MESH_MIN_Y) {
261
+    if (state.mesh_y_min != UBL_MESH_MIN_Y) {
271 262
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_MIN_Y set wrong\n");
272 263
       error_flag++;
273 264
     }
274
-
275
-    if (state.mesh_x_max !=  UBL_MESH_MAX_X) {
265
+    if (state.mesh_x_max != UBL_MESH_MAX_X) {
276 266
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_MAX_X set wrong\n");
277 267
       error_flag++;
278 268
     }
279
-
280
-    if (state.mesh_y_max !=  UBL_MESH_MAX_Y) {
269
+    if (state.mesh_y_max != UBL_MESH_MAX_Y) {
281 270
       SERIAL_PROTOCOLLNPGM("?UBL_MESH_MAX_Y set wrong\n");
282 271
       error_flag++;
283 272
     }
284
-
285
-    if (state.mesh_x_dist !=  MESH_X_DIST) {
273
+    if (state.mesh_x_dist != MESH_X_DIST) {
286 274
       SERIAL_PROTOCOLLNPGM("?MESH_X_DIST set wrong\n");
287 275
       error_flag++;
288 276
     }
289
-
290
-    if (state.mesh_y_dist !=  MESH_Y_DIST) {
277
+    if (state.mesh_y_dist != MESH_Y_DIST) {
291 278
       SERIAL_PROTOCOLLNPGM("?MESH_Y_DIST set wrong\n");
292 279
       error_flag++;
293 280
     }
294 281
 
295
-    const int j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values);
282
+    const int j = (UBL_LAST_EEPROM_INDEX - eeprom_start) / sizeof(z_values);
296 283
     if (j < 1) {
297 284
       SERIAL_PROTOCOLLNPGM("?No EEPROM storage available for a mesh of this size.\n");
298 285
       error_flag++;

+ 90
- 94
Marlin/UBL_G29.cpp Visa fil

@@ -65,8 +65,6 @@
65 65
   #define SIZE_OF_LITTLE_RAISE 0
66 66
   #define BIG_RAISE_NOT_NEEDED 0
67 67
   extern void lcd_quick_feedback();
68
-  extern int ubl_eeprom_start;
69
-  extern volatile int ubl_encoderDiff; // This is volatile because it is getting changed at interrupt time.
70 68
 
71 69
   /**
72 70
    *   G29: Unified Bed Leveling by Roxy
@@ -146,7 +144,7 @@
146 144
    *   P0    Phase 0    Zero Mesh Data and turn off the Mesh Compensation System. This reverts the
147 145
    *                    3D Printer to the same state it was in before the Unified Bed Leveling Compensation
148 146
    *                    was turned on. Setting the entire Mesh to Zero is a special case that allows
149
-   *                    a subsequent G or T leveling operation for backward compatability.
147
+   *                    a subsequent G or T leveling operation for backward compatibility.
150 148
    *
151 149
    *   P1    Phase 1    Invalidate entire Mesh and continue with automatic generation of the Mesh data using
152 150
    *                    the Z-Probe. Depending upon the values of DELTA_PROBEABLE_RADIUS and
@@ -299,14 +297,10 @@
299 297
    *   this is going to be helpful to the users!)
300 298
    *
301 299
    *   The foundation of this Bed Leveling System is built on Epatel's Mesh Bed Leveling code. A big
302
-   *   'Thanks!' to him and the creators of 3-Point and Grid Based leveling. Combining thier contributions
300
+   *   'Thanks!' to him and the creators of 3-Point and Grid Based leveling. Combining their contributions
303 301
    *   we now have the functionality and features of all three systems combined.
304 302
    */
305 303
 
306
-  int ubl_eeprom_start = -1;
307
-  bool ubl_has_control_of_lcd_panel = false;
308
-  volatile int8_t ubl_encoderDiff = 0; // Volatile because it's changed by Temperature ISR button update
309
-
310 304
   // The simple parameter flags and values are 'static' so parameter parsing can be in a support routine.
311 305
   static int g29_verbose_level, phase_value = -1, repetition_cnt,
312 306
              storage_slot = 0, map_type; //unlevel_value = -1;
@@ -318,8 +312,8 @@
318 312
   #endif
319 313
 
320 314
   void gcode_G29() {
321
-    SERIAL_PROTOCOLLNPAIR("ubl_eeprom_start=", ubl_eeprom_start);
322
-    if (ubl_eeprom_start < 0) {
315
+    SERIAL_PROTOCOLLNPAIR("ubl.eeprom_start=", ubl.eeprom_start);
316
+    if (ubl.eeprom_start < 0) {
323 317
       SERIAL_PROTOCOLLNPGM("?You need to enable your EEPROM and initialize it");
324 318
       SERIAL_PROTOCOLLNPGM("with M502, M500, M501 in that order.\n");
325 319
       return;
@@ -340,7 +334,7 @@
340 334
           SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
341 335
           break;            // No more invalid Mesh Points to populate
342 336
         }
343
-        z_values[location.x_index][location.y_index] = NAN;
337
+        ubl.z_values[location.x_index][location.y_index] = NAN;
344 338
       }
345 339
       SERIAL_PROTOCOLLNPGM("Locations invalidated.\n");
346 340
     }
@@ -359,21 +353,21 @@
359 353
             for (uint8_t y = 0; y < UBL_MESH_NUM_Y_POINTS; y++) { // a poorly calibrated Delta.
360 354
               const float p1 = 0.5 * (UBL_MESH_NUM_X_POINTS) - x,
361 355
                           p2 = 0.5 * (UBL_MESH_NUM_Y_POINTS) - y;
362
-              z_values[x][y] += 2.0 * HYPOT(p1, p2);
356
+              ubl.z_values[x][y] += 2.0 * HYPOT(p1, p2);
363 357
             }
364 358
           }
365 359
           break;
366 360
         case 1:
367 361
           for (uint8_t x = 0; x < UBL_MESH_NUM_X_POINTS; x++) {  // Create a diagonal line several Mesh cells thick that is raised
368
-            z_values[x][x] += 9.999;
369
-            z_values[x][x + (x < UBL_MESH_NUM_Y_POINTS - 1) ? 1 : -1] += 9.999; // We want the altered line several mesh points thick
362
+            ubl.z_values[x][x] += 9.999;
363
+            ubl.z_values[x][x + (x < UBL_MESH_NUM_Y_POINTS - 1) ? 1 : -1] += 9.999; // We want the altered line several mesh points thick
370 364
           }
371 365
           break;
372 366
         case 2:
373 367
           // Allow the user to specify the height because 10mm is a little extreme in some cases.
374 368
           for (uint8_t x = (UBL_MESH_NUM_X_POINTS) / 3; x < 2 * (UBL_MESH_NUM_X_POINTS) / 3; x++)   // Create a rectangular raised area in
375 369
             for (uint8_t y = (UBL_MESH_NUM_Y_POINTS) / 3; y < 2 * (UBL_MESH_NUM_Y_POINTS) / 3; y++) // the center of the bed
376
-              z_values[x][y] += code_seen('C') ? ubl_constant : 9.99;
370
+              ubl.z_values[x][y] += code_seen('C') ? ubl_constant : 9.99;
377 371
           break;
378 372
       }
379 373
     }
@@ -395,17 +389,18 @@
395 389
         return;
396 390
       }
397 391
       switch (phase_value) {
398
-        //
399
-        // Zero Mesh Data
400
-        //
401 392
         case 0:
393
+          //
394
+          // Zero Mesh Data
395
+          //
402 396
           ubl.reset();
403 397
           SERIAL_PROTOCOLLNPGM("Mesh zeroed.\n");
404 398
           break;
405
-        //
406
-        // Invalidate Entire Mesh and Automatically Probe Mesh in areas that can be reached by the probe
407
-        //
399
+
408 400
         case 1:
401
+          //
402
+          // Invalidate Entire Mesh and Automatically Probe Mesh in areas that can be reached by the probe
403
+          //
409 404
           if (!code_seen('C') ) {
410 405
             ubl.invalidate();
411 406
             SERIAL_PROTOCOLLNPGM("Mesh invalidated. Probing mesh.\n");
@@ -419,10 +414,11 @@
419 414
           probe_entire_mesh(x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER,
420 415
                             code_seen('O') || code_seen('M'), code_seen('E'), code_seen('U'));
421 416
           break;
422
-        //
423
-        // Manually Probe Mesh in areas that can't be reached by the probe
424
-        //
417
+
425 418
         case 2: {
419
+          //
420
+          // Manually Probe Mesh in areas that can't be reached by the probe
421
+          //
426 422
           SERIAL_PROTOCOLLNPGM("Manually probing unreachable mesh locations.\n");
427 423
           do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
428 424
           if (!x_flag && !y_flag) {      // use a good default location for the path
@@ -455,24 +451,24 @@
455 451
 
456 452
         } break;
457 453
 
458
-        //
459
-        // Populate invalid Mesh areas with a constant
460
-        //
461 454
         case 3: {
455
+          //
456
+          // Populate invalid Mesh areas with a constant
457
+          //
462 458
           const float height = code_seen('C') ? ubl_constant : 0.0;
463 459
           // If no repetition is specified, do the whole Mesh
464 460
           if (!repeat_flag) repetition_cnt = 9999;
465 461
           while (repetition_cnt--) {
466 462
             const mesh_index_pair location = find_closest_mesh_point_of_type(INVALID, x_pos, y_pos, 0, NULL, false); // The '0' says we want to use the nozzle's position
467 463
             if (location.x_index < 0) break; // No more invalid Mesh Points to populate
468
-            z_values[location.x_index][location.y_index] = height;
464
+            ubl.z_values[location.x_index][location.y_index] = height;
469 465
           }
470 466
         } break;
471 467
 
472
-        //
473
-        // Fine Tune (Or Edit) the Mesh
474
-        //
475 468
         case 4:
469
+          //
470
+          // Fine Tune (i.e., Edit) the Mesh
471
+          //
476 472
           fine_tune_mesh(x_pos, y_pos, code_seen('O') || code_seen('M'));
477 473
           break;
478 474
         case 5:
@@ -487,16 +483,16 @@
487 483
           SERIAL_ECHO_START;
488 484
           SERIAL_ECHOLNPGM("Checking G29 has control of LCD Panel:");
489 485
           KEEPALIVE_STATE(PAUSED_FOR_USER);
490
-          ubl_has_control_of_lcd_panel++;
486
+          ubl.has_control_of_lcd_panel++;
491 487
           while (!ubl_lcd_clicked()) {
492 488
             safe_delay(250);
493
-            if (ubl_encoderDiff) {
494
-              SERIAL_ECHOLN((int)ubl_encoderDiff);
495
-              ubl_encoderDiff = 0;
489
+            if (ubl.encoder_diff) {
490
+              SERIAL_ECHOLN((int)ubl.encoder_diff);
491
+              ubl.encoder_diff = 0;
496 492
             }
497 493
           }
498 494
           SERIAL_ECHOLNPGM("G29 giving back control of LCD Panel.");
499
-          ubl_has_control_of_lcd_panel = false;
495
+          ubl.has_control_of_lcd_panel = false;
500 496
           KEEPALIVE_STATE(IN_HANDLER);
501 497
           break;
502 498
 
@@ -508,9 +504,9 @@
508 504
           wait_for_user = true;
509 505
           while (wait_for_user) {
510 506
             safe_delay(250);
511
-            if (ubl_encoderDiff) {
512
-              SERIAL_ECHOLN((int)ubl_encoderDiff);
513
-              ubl_encoderDiff = 0;
507
+            if (ubl.encoder_diff) {
508
+              SERIAL_ECHOLN((int)ubl.encoder_diff);
509
+              ubl.encoder_diff = 0;
514 510
             }
515 511
           }
516 512
           SERIAL_ECHOLNPGM("G29 giving back control of LCD Panel.");
@@ -562,9 +558,9 @@
562 558
     if (code_seen('L')) {     // Load Current Mesh Data
563 559
       storage_slot = code_has_value() ? code_value_int() : ubl.state.eeprom_storage_slot;
564 560
 
565
-      const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values);
561
+      const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
566 562
 
567
-      if (storage_slot < 0 || storage_slot >= j || ubl_eeprom_start <= 0) {
563
+      if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
568 564
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
569 565
         return;
570 566
       }
@@ -586,19 +582,19 @@
586 582
         SERIAL_ECHOLNPGM("G29 I 999");              // host in a form it can be reconstructed on a different machine
587 583
         for (uint8_t x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
588 584
           for (uint8_t y = 0;  y < UBL_MESH_NUM_Y_POINTS; y++)
589
-            if (!isnan(z_values[x][y])) {
585
+            if (!isnan(ubl.z_values[x][y])) {
590 586
               SERIAL_ECHOPAIR("M421 I ", x);
591 587
               SERIAL_ECHOPAIR(" J ", y);
592 588
               SERIAL_ECHOPGM(" Z ");
593
-              SERIAL_ECHO_F(z_values[x][y], 6);
589
+              SERIAL_ECHO_F(ubl.z_values[x][y], 6);
594 590
               SERIAL_EOL;
595 591
             }
596 592
         return;
597 593
       }
598 594
 
599
-      const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values);
595
+      const int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values);
600 596
 
601
-      if (storage_slot < 0 || storage_slot >= j || ubl_eeprom_start <= 0) {
597
+      if (storage_slot < 0 || storage_slot >= j || ubl.eeprom_start <= 0) {
602 598
         SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
603 599
         SERIAL_PROTOCOLLNPAIR("?Use 0 to ", j - 1);
604 600
         goto LEAVE;
@@ -622,7 +618,7 @@
622 618
         save_ubl_active_state_and_disable();
623 619
         //measured_z = probe_pt(x_pos + X_PROBE_OFFSET_FROM_EXTRUDER, y_pos + Y_PROBE_OFFSET_FROM_EXTRUDER, ProbeDeployAndStow, g29_verbose_level);
624 620
 
625
-        ubl_has_control_of_lcd_panel++;     // Grab the LCD Hardware
621
+        ubl.has_control_of_lcd_panel++;     // Grab the LCD Hardware
626 622
         measured_z = 1.5;
627 623
         do_blocking_move_to_z(measured_z);  // Get close to the bed, but leave some space so we don't damage anything
628 624
                                             // The user is not going to be locking in a new Z-Offset very often so
@@ -638,7 +634,7 @@
638 634
           do_blocking_move_to_z(measured_z);
639 635
         } while (!ubl_lcd_clicked());
640 636
 
641
-        ubl_has_control_of_lcd_panel++;   // There is a race condition for the Encoder Wheel getting clicked.
637
+        ubl.has_control_of_lcd_panel++;   // There is a race condition for the Encoder Wheel getting clicked.
642 638
                                           // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune)
643 639
                                           // or here. So, until we are done looking for a long Encoder Wheel Press,
644 640
                                           // we need to take control of the panel
@@ -658,7 +654,7 @@
658 654
             goto LEAVE;
659 655
           }
660 656
         }
661
-        ubl_has_control_of_lcd_panel = false;
657
+        ubl.has_control_of_lcd_panel = false;
662 658
         safe_delay(20); // We don't want any switch noise.
663 659
 
664 660
         ubl.state.z_offset = measured_z;
@@ -675,7 +671,7 @@
675 671
       lcd_quick_feedback();
676 672
     #endif
677 673
 
678
-    ubl_has_control_of_lcd_panel = false;
674
+    ubl.has_control_of_lcd_panel = false;
679 675
   }
680 676
 
681 677
   void find_mean_mesh_height() {
@@ -687,8 +683,8 @@
687 683
     n = 0;
688 684
     for (x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
689 685
       for (y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
690
-        if (!isnan(z_values[x][y])) {
691
-          sum += z_values[x][y];
686
+        if (!isnan(ubl.z_values[x][y])) {
687
+          sum += ubl.z_values[x][y];
692 688
           n++;
693 689
         }
694 690
 
@@ -699,8 +695,8 @@
699 695
     //
700 696
     for (x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
701 697
       for (y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
702
-        if (!isnan(z_values[x][y])) {
703
-          difference = (z_values[x][y] - mean);
698
+        if (!isnan(ubl.z_values[x][y])) {
699
+          difference = (ubl.z_values[x][y] - mean);
704 700
           sum_of_diff_squared += difference * difference;
705 701
         }
706 702
 
@@ -717,15 +713,15 @@
717 713
     if (c_flag)
718 714
       for (x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
719 715
         for (y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
720
-          if (!isnan(z_values[x][y]))
721
-            z_values[x][y] -= mean + ubl_constant;
716
+          if (!isnan(ubl.z_values[x][y]))
717
+            ubl.z_values[x][y] -= mean + ubl_constant;
722 718
   }
723 719
 
724 720
   void shift_mesh_height() {
725 721
     for (uint8_t x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
726 722
       for (uint8_t y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
727
-        if (!isnan(z_values[x][y]))
728
-          z_values[x][y] += ubl_constant;
723
+        if (!isnan(ubl.z_values[x][y]))
724
+          ubl.z_values[x][y] += ubl_constant;
729 725
   }
730 726
 
731 727
   /**
@@ -735,7 +731,7 @@
735 731
   void probe_entire_mesh(const float &lx, const float &ly, const bool do_ubl_mesh_map, const bool stow_probe, bool do_furthest) {
736 732
     mesh_index_pair location;
737 733
 
738
-    ubl_has_control_of_lcd_panel++;
734
+    ubl.has_control_of_lcd_panel++;
739 735
     save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
740 736
     DEPLOY_PROBE();
741 737
 
@@ -745,7 +741,7 @@
745 741
         lcd_quick_feedback();
746 742
         STOW_PROBE();
747 743
         while (ubl_lcd_clicked()) idle();
748
-        ubl_has_control_of_lcd_panel = false;
744
+        ubl.has_control_of_lcd_panel = false;
749 745
         restore_ubl_active_state_and_leave();
750 746
         safe_delay(50);  // Debounce the Encoder wheel
751 747
         return;
@@ -761,11 +757,11 @@
761 757
         if (rawx < (MIN_PROBE_X) || rawx > (MAX_PROBE_X) || rawy < (MIN_PROBE_Y) || rawy > (MAX_PROBE_Y)) {
762 758
           SERIAL_ERROR_START;
763 759
           SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
764
-          ubl_has_control_of_lcd_panel = false;
760
+          ubl.has_control_of_lcd_panel = false;
765 761
           goto LEAVE;
766 762
         }
767 763
         const float measured_z = probe_pt(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy), stow_probe, g29_verbose_level);
768
-        z_values[location.x_index][location.y_index] = measured_z + zprobe_zoffset;
764
+        ubl.z_values[location.x_index][location.y_index] = measured_z + zprobe_zoffset;
769 765
       }
770 766
 
771 767
       if (do_ubl_mesh_map) ubl.display_map(map_type);
@@ -842,7 +838,7 @@
842 838
     for (i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
843 839
       for (j = 0; j < UBL_MESH_NUM_Y_POINTS; j++) {
844 840
         c = -((normal.x * (UBL_MESH_MIN_X + i * (MESH_X_DIST)) + normal.y * (UBL_MESH_MIN_Y + j * (MESH_Y_DIST))) - d);
845
-        z_values[i][j] += c;
841
+        ubl.z_values[i][j] += c;
846 842
       }
847 843
     }
848 844
     return normal;
@@ -852,9 +848,9 @@
852 848
     KEEPALIVE_STATE(PAUSED_FOR_USER);
853 849
     while (!ubl_lcd_clicked()) {     // we need the loop to move the nozzle based on the encoder wheel here!
854 850
       idle();
855
-      if (ubl_encoderDiff) {
856
-        do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(ubl_encoderDiff));
857
-        ubl_encoderDiff = 0;
851
+      if (ubl.encoder_diff) {
852
+        do_blocking_move_to_z(current_position[Z_AXIS] + 0.01 * float(ubl.encoder_diff));
853
+        ubl.encoder_diff = 0;
858 854
       }
859 855
     }
860 856
     KEEPALIVE_STATE(IN_HANDLER);
@@ -863,7 +859,7 @@
863 859
 
864 860
   float measure_business_card_thickness(const float &in_height) {
865 861
 
866
-    ubl_has_control_of_lcd_panel++;
862
+    ubl.has_control_of_lcd_panel++;
867 863
     save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
868 864
 
869 865
     SERIAL_PROTOCOLLNPGM("Place Shim Under Nozzle and Perform Measurement.");
@@ -873,7 +869,7 @@
873 869
 
874 870
     const float z1 = use_encoder_wheel_to_measure_point();
875 871
     do_blocking_move_to_z(current_position[Z_AXIS] + SIZE_OF_LITTLE_RAISE);
876
-    ubl_has_control_of_lcd_panel = false;
872
+    ubl.has_control_of_lcd_panel = false;
877 873
 
878 874
     SERIAL_PROTOCOLLNPGM("Remove Shim and Measure Bed Height.");
879 875
     const float z2 = use_encoder_wheel_to_measure_point();
@@ -890,7 +886,7 @@
890 886
 
891 887
   void manually_probe_remaining_mesh(const float &lx, const float &ly, const float &z_clearance, const float &card_thickness, const bool do_ubl_mesh_map) {
892 888
 
893
-    ubl_has_control_of_lcd_panel++;
889
+    ubl.has_control_of_lcd_panel++;
894 890
     save_ubl_active_state_and_disable();   // we don't do bed level correction because we want the raw data when we probe
895 891
     do_blocking_move_to_z(z_clearance);
896 892
     do_blocking_move_to_xy(lx, ly);
@@ -911,7 +907,7 @@
911 907
       if (rawx < (X_MIN_POS) || rawx > (X_MAX_POS) || rawy < (Y_MIN_POS) || rawy > (Y_MAX_POS)) {
912 908
         SERIAL_ERROR_START;
913 909
         SERIAL_ERRORLNPGM("Attempt to probe off the bed.");
914
-        ubl_has_control_of_lcd_panel = false;
910
+        ubl.has_control_of_lcd_panel = false;
915 911
         goto LEAVE;
916 912
       }
917 913
 
@@ -931,13 +927,13 @@
931 927
       last_y = yProbe;
932 928
 
933 929
       KEEPALIVE_STATE(PAUSED_FOR_USER);
934
-      ubl_has_control_of_lcd_panel = true;
930
+      ubl.has_control_of_lcd_panel = true;
935 931
 
936 932
       while (!ubl_lcd_clicked()) {     // we need the loop to move the nozzle based on the encoder wheel here!
937 933
         idle();
938
-        if (ubl_encoderDiff) {
939
-          do_blocking_move_to_z(current_position[Z_AXIS] + float(ubl_encoderDiff) / 100.0);
940
-          ubl_encoderDiff = 0;
934
+        if (ubl.encoder_diff) {
935
+          do_blocking_move_to_z(current_position[Z_AXIS] + float(ubl.encoder_diff) / 100.0);
936
+          ubl.encoder_diff = 0;
941 937
         }
942 938
       }
943 939
 
@@ -949,17 +945,17 @@
949 945
           do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
950 946
           lcd_quick_feedback();
951 947
           while (ubl_lcd_clicked()) idle();
952
-          ubl_has_control_of_lcd_panel = false;
948
+          ubl.has_control_of_lcd_panel = false;
953 949
           KEEPALIVE_STATE(IN_HANDLER);
954 950
           restore_ubl_active_state_and_leave();
955 951
           return;
956 952
         }
957 953
       }
958 954
 
959
-      z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - card_thickness;
955
+      ubl.z_values[location.x_index][location.y_index] = current_position[Z_AXIS] - card_thickness;
960 956
       if (g29_verbose_level > 2) {
961 957
         SERIAL_PROTOCOLPGM("Mesh Point Measured at: ");
962
-        SERIAL_PROTOCOL_F(z_values[location.x_index][location.y_index], 6);
958
+        SERIAL_PROTOCOL_F(ubl.z_values[location.x_index][location.y_index], 6);
963 959
         SERIAL_EOL;
964 960
       }
965 961
     } while (location.x_index >= 0 && location.y_index >= 0);
@@ -1110,7 +1106,7 @@
1110 1106
    * good to have the extra information. Soon... we prune this to just a few items
1111 1107
    */
1112 1108
   void g29_what_command() {
1113
-    const uint16_t k = E2END - ubl_eeprom_start;
1109
+    const uint16_t k = E2END - ubl.eeprom_start;
1114 1110
 
1115 1111
     SERIAL_PROTOCOLPGM("Unified Bed Leveling System Version 1.00 ");
1116 1112
     if (ubl.state.active)  
@@ -1167,21 +1163,21 @@
1167 1163
     SERIAL_PROTOCOLLNPAIR("ubl_state_recursion_chk :", ubl_state_recursion_chk);
1168 1164
     SERIAL_EOL;
1169 1165
     safe_delay(50);
1170
-    SERIAL_PROTOCOLLNPAIR("Free EEPROM space starts at: 0x", hex_word(ubl_eeprom_start));
1166
+    SERIAL_PROTOCOLLNPAIR("Free EEPROM space starts at: 0x", hex_word(ubl.eeprom_start));
1171 1167
 
1172
-    SERIAL_PROTOCOLLNPAIR("end of EEPROM              : ", hex_word(E2END));
1168
+    SERIAL_PROTOCOLLNPAIR("end of EEPROM              : 0x", hex_word(E2END));
1173 1169
     safe_delay(50);
1174 1170
 
1175 1171
     SERIAL_PROTOCOLLNPAIR("sizeof(ubl) :  ", (int)sizeof(ubl));
1176 1172
     SERIAL_EOL;
1177
-    SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(z_values));
1173
+    SERIAL_PROTOCOLLNPAIR("z_value[][] size: ", (int)sizeof(ubl.z_values));
1178 1174
     SERIAL_EOL;
1179 1175
     safe_delay(50);
1180 1176
 
1181 1177
     SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: 0x", hex_word(k));
1182 1178
     safe_delay(50);
1183 1179
 
1184
-    SERIAL_PROTOCOLPAIR("EEPROM can hold ", k / sizeof(z_values));
1180
+    SERIAL_PROTOCOLPAIR("EEPROM can hold ", k / sizeof(ubl.z_values));
1185 1181
     SERIAL_PROTOCOLLNPGM(" meshes.\n");
1186 1182
     safe_delay(50);
1187 1183
 
@@ -1245,9 +1241,9 @@
1245 1241
     }
1246 1242
     storage_slot = code_value_int();
1247 1243
 
1248
-    int16_t j = (UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(tmp_z_values);
1244
+    int16_t j = (UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(tmp_z_values);
1249 1245
 
1250
-    if (storage_slot < 0 || storage_slot > j || ubl_eeprom_start <= 0) {
1246
+    if (storage_slot < 0 || storage_slot > j || ubl.eeprom_start <= 0) {
1251 1247
       SERIAL_PROTOCOLLNPGM("?EEPROM storage not available for use.\n");
1252 1248
       return;
1253 1249
     }
@@ -1256,12 +1252,12 @@
1256 1252
     eeprom_read_block((void *)&tmp_z_values, (void *)j, sizeof(tmp_z_values));
1257 1253
 
1258 1254
     SERIAL_ECHOPAIR("Subtracting Mesh ", storage_slot);
1259
-    SERIAL_PROTOCOLLNPAIR(" loaded from EEPROM address ", hex_word(j)); // Soon, we can remove the extra clutter of printing
1255
+    SERIAL_PROTOCOLLNPAIR(" loaded from EEPROM address 0x", hex_word(j)); // Soon, we can remove the extra clutter of printing
1260 1256
                                                                         // the address in the EEPROM where the Mesh is stored.
1261 1257
 
1262 1258
     for (uint8_t x = 0; x < UBL_MESH_NUM_X_POINTS; x++)
1263 1259
       for (uint8_t y = 0; y < UBL_MESH_NUM_Y_POINTS; y++)
1264
-        z_values[x][y] = z_values[x][y] - tmp_z_values[x][y];
1260
+        ubl.z_values[x][y] -= tmp_z_values[x][y];
1265 1261
   }
1266 1262
 
1267 1263
   mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType type, const float &lx, const float &ly, const bool probe_as_reference, unsigned int bits[16], bool far_flag) {
@@ -1280,8 +1276,8 @@
1280 1276
     for (uint8_t i = 0; i < UBL_MESH_NUM_X_POINTS; i++) {
1281 1277
       for (uint8_t j = 0; j < UBL_MESH_NUM_Y_POINTS; j++) {
1282 1278
 
1283
-        if ( (type == INVALID && isnan(z_values[i][j]))  // Check to see if this location holds the right thing
1284
-          || (type == REAL && !isnan(z_values[i][j]))
1279
+        if ( (type == INVALID && isnan(ubl.z_values[i][j]))  // Check to see if this location holds the right thing
1280
+          || (type == REAL && !isnan(ubl.z_values[i][j]))
1285 1281
           || (type == SET_IN_BITMAP && is_bit_set(bits, i, j))
1286 1282
         ) {
1287 1283
 
@@ -1308,7 +1304,7 @@
1308 1304
           if (far_flag) {                                           // If doing the far_flag action, we want to be as far as possible
1309 1305
             for (uint8_t k = 0; k < UBL_MESH_NUM_X_POINTS; k++) {   // from the starting point and from any other probed points.  We
1310 1306
               for (uint8_t l = 0; l < UBL_MESH_NUM_Y_POINTS; l++) { // want the next point spread out and filling in any blank spaces
1311
-                if (!isnan(z_values[k][l])) {                       // in the mesh. So we add in some of the distance to every probed
1307
+                if (!isnan(ubl.z_values[k][l])) {                       // in the mesh. So we add in some of the distance to every probed
1312 1308
                   distance += sq(i - k) * (MESH_X_DIST) * .05       // point we can find.
1313 1309
                             + sq(j - l) * (MESH_Y_DIST) * .05;
1314 1310
                 }
@@ -1361,19 +1357,19 @@
1361 1357
       if (rawx < (X_MIN_POS) || rawx > (X_MAX_POS) || rawy < (Y_MIN_POS) || rawy > (Y_MAX_POS)) { // In theory, we don't need this check.
1362 1358
         SERIAL_ERROR_START;
1363 1359
         SERIAL_ERRORLNPGM("Attempt to edit off the bed."); // This really can't happen, but do the check for now
1364
-        ubl_has_control_of_lcd_panel = false;
1360
+        ubl.has_control_of_lcd_panel = false;
1365 1361
         goto FINE_TUNE_EXIT;
1366 1362
       }
1367 1363
 
1368 1364
       do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);    // Move the nozzle to where we are going to edit
1369 1365
       do_blocking_move_to_xy(LOGICAL_X_POSITION(rawx), LOGICAL_Y_POSITION(rawy));
1370
-      float new_z = z_values[location.x_index][location.y_index];
1366
+      float new_z = ubl.z_values[location.x_index][location.y_index];
1371 1367
       
1372 1368
       round_off = (int32_t)(new_z * 1000.0);    // we chop off the last digits just to be clean. We are rounding to the
1373 1369
       new_z = float(round_off) / 1000.0;
1374 1370
 
1375 1371
       KEEPALIVE_STATE(PAUSED_FOR_USER);
1376
-      ubl_has_control_of_lcd_panel = true;
1372
+      ubl.has_control_of_lcd_panel = true;
1377 1373
 
1378 1374
       lcd_implementation_clear();
1379 1375
       lcd_mesh_edit_setup(new_z);
@@ -1385,7 +1381,7 @@
1385 1381
 
1386 1382
       lcd_return_to_status();
1387 1383
 
1388
-      ubl_has_control_of_lcd_panel = true; // There is a race condition for the Encoder Wheel getting clicked.
1384
+      ubl.has_control_of_lcd_panel = true; // There is a race condition for the Encoder Wheel getting clicked.
1389 1385
                                            // It could get detected in lcd_mesh_edit (actually _lcd_mesh_fine_tune)
1390 1386
                                            // or here.
1391 1387
 
@@ -1406,7 +1402,7 @@
1406 1402
 
1407 1403
       safe_delay(20);                       // We don't want any switch noise.
1408 1404
 
1409
-      z_values[location.x_index][location.y_index] = new_z;
1405
+      ubl.z_values[location.x_index][location.y_index] = new_z;
1410 1406
 
1411 1407
       lcd_implementation_clear();
1412 1408
 
@@ -1414,7 +1410,7 @@
1414 1410
 
1415 1411
     FINE_TUNE_EXIT:
1416 1412
 
1417
-    ubl_has_control_of_lcd_panel = false;
1413
+    ubl.has_control_of_lcd_panel = false;
1418 1414
     KEEPALIVE_STATE(IN_HANDLER);
1419 1415
 
1420 1416
     if (do_ubl_mesh_map) ubl.display_map(map_type);

+ 7
- 8
Marlin/UBL_line_to_destination.cpp Visa fil

@@ -32,12 +32,11 @@
32 32
   extern float destination[XYZE];
33 33
   extern void set_current_to_destination();
34 34
   extern float destination[];
35
-  bool g26_debug_flag = false;
36 35
   void debug_current_and_destination(char *title) {
37 36
 
38 37
     // if the title message starts with a '!' it is so important, we are going to
39 38
     // ignore the status of the g26_debug_flag
40
-    if (*title != '!' && !g26_debug_flag) return;
39
+    if (*title != '!' && !ubl.g26_debug_flag) return;
41 40
 
42 41
     const float de = destination[E_AXIS] - current_position[E_AXIS];
43 42
 
@@ -122,7 +121,7 @@
122 121
               cell_dest_xi  = ubl.get_cell_index_x(RAW_X_POSITION(x_end)),
123 122
               cell_dest_yi  = ubl.get_cell_index_y(RAW_Y_POSITION(y_end));
124 123
 
125
-    if (g26_debug_flag) {
124
+    if (ubl.g26_debug_flag) {
126 125
       SERIAL_ECHOPGM(" ubl_line_to_destination(xe=");
127 126
       SERIAL_ECHO(x_end);
128 127
       SERIAL_ECHOPGM(", ye=");
@@ -151,7 +150,7 @@
151 150
         planner.buffer_line(x_end, y_end, z_end + ubl.state.z_offset, e_end, feed_rate, extruder);
152 151
         set_current_to_destination();
153 152
 
154
-        if (g26_debug_flag)
153
+        if (ubl.g26_debug_flag)
155 154
           debug_current_and_destination((char*)"out of bounds in ubl_line_to_destination()");
156 155
 
157 156
         return;
@@ -213,7 +212,7 @@
213 212
 
214 213
       planner.buffer_line(x_end, y_end, z_end + z0 + ubl.state.z_offset, e_end, feed_rate, extruder);
215 214
 
216
-      if (g26_debug_flag)
215
+      if (ubl.g26_debug_flag)
217 216
         debug_current_and_destination((char*)"FINAL_MOVE in ubl_line_to_destination()");
218 217
 
219 218
       set_current_to_destination();
@@ -340,7 +339,7 @@
340 339
         } //else printf("FIRST MOVE PRUNED  ");
341 340
       }
342 341
 
343
-      if (g26_debug_flag)
342
+      if (ubl.g26_debug_flag)
344 343
         debug_current_and_destination((char*)"vertical move done in ubl_line_to_destination()");
345 344
 
346 345
       //
@@ -425,7 +424,7 @@
425 424
         } //else printf("FIRST MOVE PRUNED  ");
426 425
       }
427 426
 
428
-      if (g26_debug_flag)
427
+      if (ubl.g26_debug_flag)
429 428
         debug_current_and_destination((char*)"horizontal move done in ubl_line_to_destination()");
430 429
 
431 430
       if (current_position[X_AXIS] != x_end || current_position[Y_AXIS] != y_end)
@@ -564,7 +563,7 @@
564 563
       }
565 564
     }
566 565
 
567
-    if (g26_debug_flag)
566
+    if (ubl.g26_debug_flag)
568 567
       debug_current_and_destination((char*)"generic move done in ubl_line_to_destination()");
569 568
 
570 569
     if (current_position[0] != x_end || current_position[1] != y_end)

+ 2
- 3
Marlin/configuration_store.cpp Visa fil

@@ -166,7 +166,6 @@
166 166
 
167 167
 #if ENABLED(AUTO_BED_LEVELING_UBL)
168 168
   #include "UBL.h"
169
-  int ubl_eeprom_start = -1;
170 169
 #endif
171 170
 
172 171
 #if ENABLED(ABL_BILINEAR_SUBDIVISION)
@@ -847,7 +846,7 @@ void Config_Postprocess() {
847 846
       }
848 847
 
849 848
       #if ENABLED(AUTO_BED_LEVELING_UBL)
850
-        ubl_eeprom_start = (eeprom_index + 32) & 0xFFF8; // Pad the end of configuration data so it
849
+        ubl.eeprom_start = (eeprom_index + 32) & 0xFFF8; // Pad the end of configuration data so it
851 850
                                                          // can float up or down a little bit without
852 851
                                                          // disrupting the Unified Bed Leveling data
853 852
         ubl.load_state();
@@ -1233,7 +1232,7 @@ void Config_ResetDefault() {
1233 1232
         SERIAL_ECHO_F(ubl.state.z_offset, 6);
1234 1233
         SERIAL_EOL;
1235 1234
 
1236
-        SERIAL_ECHOPAIR("EEPROM can hold ", (int)((UBL_LAST_EEPROM_INDEX - ubl_eeprom_start) / sizeof(z_values)));
1235
+        SERIAL_ECHOPAIR("EEPROM can hold ", (int)((UBL_LAST_EEPROM_INDEX - ubl.eeprom_start) / sizeof(ubl.z_values)));
1237 1236
         SERIAL_ECHOLNPGM(" meshes.\n");
1238 1237
 
1239 1238
         SERIAL_ECHOLNPGM("UBL_MESH_NUM_X_POINTS  " STRINGIFY(UBL_MESH_NUM_X_POINTS));

+ 7
- 8
Marlin/ultralcd.cpp Visa fil

@@ -124,8 +124,7 @@ uint16_t max_display_update_time = 0;
124 124
   int32_t lastEncoderMovementMillis;
125 125
 
126 126
   #if ENABLED(AUTO_BED_LEVELING_UBL)
127
-    extern bool ubl_has_control_of_lcd_panel;
128
-    extern int8_t ubl_encoderDiff;
127
+    #include "UBL.h"
129 128
   #endif
130 129
 
131 130
   #if HAS_POWER_SWITCH
@@ -860,9 +859,9 @@ void kill_screen(const char* lcd_msg) {
860 859
 
861 860
     static void _lcd_mesh_fine_tune(const char* msg) {
862 861
       defer_return_to_status = true;
863
-      if (ubl_encoderDiff) {
864
-        ubl_encoderPosition = (ubl_encoderDiff > 0) ? 1 : -1;
865
-        ubl_encoderDiff = 0;
862
+      if (ubl.encoder_diff) {
863
+        ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
864
+        ubl.encoder_diff = 0;
866 865
 
867 866
         mesh_edit_accumulator += float(ubl_encoderPosition) * 0.005 / 2.0;
868 867
         mesh_edit_value = mesh_edit_accumulator;
@@ -3206,7 +3205,7 @@ void lcd_update() {
3206 3205
     lcd_buttons_update();
3207 3206
 
3208 3207
     #if ENABLED(AUTO_BED_LEVELING_UBL)
3209
-      const bool UBL_CONDITION = !ubl_has_control_of_lcd_panel;
3208
+      const bool UBL_CONDITION = !ubl.has_control_of_lcd_panel;
3210 3209
     #else
3211 3210
       constexpr bool UBL_CONDITION = true;
3212 3211
     #endif
@@ -3622,8 +3621,8 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
3622 3621
         case encrot3: ENCODER_SPIN(encrot2, encrot0); break;
3623 3622
       }
3624 3623
       #if ENABLED(AUTO_BED_LEVELING_UBL)
3625
-        if (ubl_has_control_of_lcd_panel) {
3626
-          ubl_encoderDiff = encoderDiff;    // Make the encoder's rotation available to G29's Mesh Editor
3624
+        if (ubl.has_control_of_lcd_panel) {
3625
+          ubl.encoder_diff = encoderDiff;    // Make the encoder's rotation available to G29's Mesh Editor
3627 3626
           encoderDiff = 0;                  // We are going to lie to the LCD Panel and claim the encoder
3628 3627
                                             // wheel has not turned.
3629 3628
         }

Laddar…
Avbryt
Spara