Browse Source

Make G26 compatible with inches and thermal unit modes

Scott Lahteine 7 years ago
parent
commit
1b2c7ec20a
3 changed files with 29 additions and 23 deletions
  1. 17
    14
      Marlin/G26_Mesh_Validation_Tool.cpp
  2. 12
    2
      Marlin/Marlin.h
  3. 0
    7
      Marlin/Marlin_main.cpp

+ 17
- 14
Marlin/G26_Mesh_Validation_Tool.cpp View File

@@ -126,6 +126,8 @@
126 126
   void set_destination_to_current();
127 127
   void set_current_to_destination();
128 128
   float code_value_float();
129
+  float code_value_linear_units();
130
+  float code_value_axis_units(const AxisEnum axis);
129 131
   bool code_value_bool();
130 132
   bool code_has_value();
131 133
   void lcd_init();
@@ -164,10 +166,11 @@
164 166
                filament_diameter = FILAMENT,
165 167
                prime_length = PRIME_LENGTH,
166 168
                x_pos, y_pos,
167
-               bed_temp = BED_TEMP,
168
-               hotend_temp = HOTEND_TEMP,
169 169
                ooze_amount = OOZE_AMOUNT;
170 170
 
171
+  static int16_t bed_temp = BED_TEMP,
172
+                 hotend_temp = HOTEND_TEMP;
173
+
171 174
   static int8_t prime_flag = 0;
172 175
 
173 176
   static bool keep_heaters_on = false;
@@ -379,9 +382,9 @@
379 382
 
380 383
     if (!keep_heaters_on) {
381 384
       #if HAS_TEMP_BED
382
-        thermalManager.setTargetBed(0.0);
385
+        thermalManager.setTargetBed(0);
383 386
       #endif
384
-      thermalManager.setTargetHotend(0.0, 0);
387
+      thermalManager.setTargetHotend(0, 0);
385 388
     }
386 389
   }
387 390
 
@@ -640,8 +643,8 @@
640 643
     keep_heaters_on       = false;
641 644
 
642 645
     if (code_seen('B')) {
643
-      bed_temp = code_value_float();
644
-      if (!WITHIN(bed_temp, 15.0, 140.0)) {
646
+      bed_temp = code_value_temp_abs();
647
+      if (!WITHIN(bed_temp, 15, 140)) {
645 648
         SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
646 649
         return UBL_ERR;
647 650
       }
@@ -650,7 +653,7 @@
650 653
     if (code_seen('C')) continue_with_closest++;
651 654
 
652 655
     if (code_seen('L')) {
653
-      layer_height = code_value_float();
656
+      layer_height = code_value_linear_units();
654 657
       if (!WITHIN(layer_height, 0.0, 2.0)) {
655 658
         SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
656 659
         return UBL_ERR;
@@ -682,14 +685,14 @@
682 685
     if (code_seen('K')) keep_heaters_on++;
683 686
 
684 687
     if (code_seen('O') && code_has_value())
685
-      ooze_amount = code_value_float();
688
+      ooze_amount = code_value_linear_units();
686 689
 
687 690
     if (code_seen('P')) {
688 691
       if (!code_has_value())
689 692
         prime_flag = -1;
690 693
       else {
691 694
         prime_flag++;
692
-        prime_length = code_value_float();
695
+        prime_length = code_value_linear_units();
693 696
         if (!WITHIN(prime_length, 0.0, 25.0)) {
694 697
           SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
695 698
           return UBL_ERR;
@@ -698,7 +701,7 @@
698 701
     }
699 702
 
700 703
     if (code_seen('F')) {
701
-      filament_diameter = code_value_float();
704
+      filament_diameter = code_value_linear_units();
702 705
       if (!WITHIN(filament_diameter, 1.0, 4.0)) {
703 706
         SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
704 707
         return UBL_ERR;
@@ -711,8 +714,8 @@
711 714
     extrusion_multiplier *= filament_diameter * sq(nozzle) / sq(0.3); // Scale up by nozzle size
712 715
 
713 716
     if (code_seen('H')) {
714
-      hotend_temp = code_value_float();
715
-      if (!WITHIN(hotend_temp, 165.0, 280.0)) {
717
+      hotend_temp = code_value_temp_abs();
718
+      if (!WITHIN(hotend_temp, 165, 280)) {
716 719
         SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
717 720
         return UBL_ERR;
718 721
       }
@@ -727,7 +730,7 @@
727 730
     y_pos = current_position[Y_AXIS];
728 731
 
729 732
     if (code_seen('X')) {
730
-      x_pos = code_value_float();
733
+      x_pos = code_value_axis_units(X_AXIS);
731 734
       if (!WITHIN(x_pos, X_MIN_POS, X_MAX_POS)) {
732 735
         SERIAL_PROTOCOLLNPGM("?Specified X coordinate not plausible.");
733 736
         return UBL_ERR;
@@ -736,7 +739,7 @@
736 739
     else
737 740
 
738 741
     if (code_seen('Y')) {
739
-      y_pos = code_value_float();
742
+      y_pos = code_value_axis_units(Y_AXIS);
740 743
       if (!WITHIN(y_pos, Y_MIN_POS, Y_MAX_POS)) {
741 744
         SERIAL_PROTOCOLLNPGM("?Specified Y coordinate not plausible.");
742 745
         return UBL_ERR;

+ 12
- 2
Marlin/Marlin.h View File

@@ -290,8 +290,18 @@ extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
290 290
 // GCode support for external objects
291 291
 bool code_seen(char);
292 292
 int code_value_int();
293
-float code_value_temp_abs();
294
-float code_value_temp_diff();
293
+int16_t code_value_temp_abs();
294
+int16_t code_value_temp_diff();
295
+
296
+#if ENABLED(INCH_MODE_SUPPORT)
297
+  float code_value_linear_units();
298
+  float code_value_axis_units(const AxisEnum axis);
299
+  float code_value_per_axis_unit(const AxisEnum axis);
300
+#else
301
+  #define code_value_linear_units() code_value_float()
302
+  #define code_value_axis_units(A) code_value_float()
303
+  #define code_value_per_axis_unit(A) code_value_float()
304
+#endif
295 305
 
296 306
 #if IS_KINEMATIC
297 307
   extern float delta[ABC];

+ 0
- 7
Marlin/Marlin_main.cpp View File

@@ -1292,13 +1292,6 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() >
1292 1292
   inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
1293 1293
   inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
1294 1294
   inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); }
1295
-
1296
-#else
1297
-
1298
-  #define code_value_linear_units() code_value_float()
1299
-  #define code_value_axis_units(A) code_value_float()
1300
-  #define code_value_per_axis_unit(A) code_value_float()
1301
-
1302 1295
 #endif
1303 1296
 
1304 1297
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)

Loading…
Cancel
Save