Kaynağa Gözat

Make G26 compatible with inches and thermal unit modes

Scott Lahteine 8 yıl önce
ebeveyn
işleme
1b2c7ec20a
3 değiştirilmiş dosya ile 29 ekleme ve 23 silme
  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 Dosyayı Görüntüle

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

+ 12
- 2
Marlin/Marlin.h Dosyayı Görüntüle

290
 // GCode support for external objects
290
 // GCode support for external objects
291
 bool code_seen(char);
291
 bool code_seen(char);
292
 int code_value_int();
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
 #if IS_KINEMATIC
306
 #if IS_KINEMATIC
297
   extern float delta[ABC];
307
   extern float delta[ABC];

+ 0
- 7
Marlin/Marlin_main.cpp Dosyayı Görüntüle

1292
   inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
1292
   inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
1293
   inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
1293
   inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
1294
   inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); }
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
 #endif
1295
 #endif
1303
 
1296
 
1304
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
1297
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)

Loading…
İptal
Kaydet