ソースを参照

Use uint8_t for all fan speeds (#12032)

Scott Lahteine 6年前
コミット
d6b0fbd771
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 4
- 5
Marlin/src/Marlin.cpp ファイルの表示

170
 #endif
170
 #endif
171
 
171
 
172
 #if FAN_COUNT > 0
172
 #if FAN_COUNT > 0
173
-  int16_t fanSpeeds[FAN_COUNT] = { 0 };
173
+  uint8_t fan_speed[FAN_COUNT] = { 0 };
174
   #if ENABLED(EXTRA_FAN_SPEED)
174
   #if ENABLED(EXTRA_FAN_SPEED)
175
-    int16_t old_fanSpeeds[FAN_COUNT],
176
-            new_fanSpeeds[FAN_COUNT];
175
+    uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
177
   #endif
176
   #endif
178
   #if ENABLED(PROBING_FANS_OFF)
177
   #if ENABLED(PROBING_FANS_OFF)
179
     bool fans_paused; // = false;
178
     bool fans_paused; // = false;
180
-    int16_t paused_fanSpeeds[FAN_COUNT] = { 0 };
179
+    uint8_t paused_fan_speed[FAN_COUNT] = { 0 };
181
   #endif
180
   #endif
182
 #endif
181
 #endif
183
 
182
 
972
         print_job_timer.stop();
971
         print_job_timer.stop();
973
         thermalManager.disable_all_heaters();
972
         thermalManager.disable_all_heaters();
974
         #if FAN_COUNT > 0
973
         #if FAN_COUNT > 0
975
-          for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
974
+          for (uint8_t i = 0; i < FAN_COUNT; i++) fan_speed[i] = 0;
976
         #endif
975
         #endif
977
         wait_for_heatup = false;
976
         wait_for_heatup = false;
978
         #if ENABLED(POWER_LOSS_RECOVERY)
977
         #if ENABLED(POWER_LOSS_RECOVERY)

+ 4
- 5
Marlin/src/Marlin.h ファイルの表示

208
 extern millis_t max_inactive_time, stepper_inactive_time;
208
 extern millis_t max_inactive_time, stepper_inactive_time;
209
 
209
 
210
 #if FAN_COUNT > 0
210
 #if FAN_COUNT > 0
211
-  extern int16_t fanSpeeds[FAN_COUNT];
211
+  extern uint8_t fan_speed[FAN_COUNT];
212
   #if ENABLED(EXTRA_FAN_SPEED)
212
   #if ENABLED(EXTRA_FAN_SPEED)
213
-    extern int16_t old_fanSpeeds[FAN_COUNT],
214
-                   new_fanSpeeds[FAN_COUNT];
213
+    extern uint8_t old_fan_speed[FAN_COUNT], new_fan_speed[FAN_COUNT];
215
   #endif
214
   #endif
216
   #if ENABLED(PROBING_FANS_OFF)
215
   #if ENABLED(PROBING_FANS_OFF)
217
     extern bool fans_paused;
216
     extern bool fans_paused;
218
-    extern int16_t paused_fanSpeeds[FAN_COUNT];
217
+    extern uint8_t paused_fan_speed[FAN_COUNT];
219
   #endif
218
   #endif
220
 #endif
219
 #endif
221
 
220
 
222
 #if ENABLED(USE_CONTROLLER_FAN)
221
 #if ENABLED(USE_CONTROLLER_FAN)
223
-  extern uint8_t controllerFanSpeed;
222
+  extern uint8_t controllerfan_speed;
224
 #endif
223
 #endif
225
 
224
 
226
 #if HAS_POWER_SWITCH
225
 #if HAS_POWER_SWITCH

+ 2
- 2
Marlin/src/feature/controllerfan.cpp ファイルの表示

27
 #include "../module/stepper_indirection.h"
27
 #include "../module/stepper_indirection.h"
28
 #include "../module/temperature.h"
28
 #include "../module/temperature.h"
29
 
29
 
30
-uint8_t controllerFanSpeed;
30
+uint8_t controllerfan_speed;
31
 
31
 
32
 void controllerfan_update() {
32
 void controllerfan_update() {
33
   static millis_t lastMotorOn = 0, // Last time a motor was turned on
33
   static millis_t lastMotorOn = 0, // Last time a motor was turned on
75
 
75
 
76
     // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
76
     // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
77
     uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
77
     uint8_t speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : CONTROLLERFAN_SPEED;
78
-    controllerFanSpeed = speed;
78
+    controllerfan_speed = speed;
79
 
79
 
80
     // allows digital or PWM fan output to be used (see M42 handling)
80
     // allows digital or PWM fan output to be used (see M42 handling)
81
     WRITE(CONTROLLER_FAN_PIN, speed);
81
     WRITE(CONTROLLER_FAN_PIN, speed);

+ 3
- 3
Marlin/src/feature/power.cpp ファイルの表示

39
 
39
 
40
 bool Power::is_power_needed() {
40
 bool Power::is_power_needed() {
41
   #if ENABLED(AUTO_POWER_FANS)
41
   #if ENABLED(AUTO_POWER_FANS)
42
-    for (uint8_t i = 0; i < FAN_COUNT; i++) if (fanSpeeds[i] > 0) return true;
42
+    for (uint8_t i = 0; i < FAN_COUNT; i++) if (fan_speed[i]) return true;
43
   #endif
43
   #endif
44
 
44
 
45
   #if ENABLED(AUTO_POWER_E_FANS)
45
   #if ENABLED(AUTO_POWER_E_FANS)
46
-    HOTEND_LOOP() if (thermalManager.autofan_speed[e] > 0) return true;
46
+    HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true;
47
   #endif
47
   #endif
48
 
48
 
49
   #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN)
49
   #if ENABLED(AUTO_POWER_CONTROLLERFAN) && HAS_CONTROLLER_FAN && ENABLED(USE_CONTROLLER_FAN)
50
-    if (controllerFanSpeed > 0) return true;
50
+    if (controllerfan_speed) return true;
51
   #endif
51
   #endif
52
 
52
 
53
   // If any of the drivers or the bed are enabled...
53
   // If any of the drivers or the bed are enabled...

+ 3
- 3
Marlin/src/feature/power_loss_recovery.cpp ファイルの表示

82
         #endif
82
         #endif
83
 
83
 
84
         #if FAN_COUNT
84
         #if FAN_COUNT
85
-          SERIAL_PROTOCOLPGM("fanSpeeds: ");
85
+          SERIAL_PROTOCOLPGM("fan_speed: ");
86
           for (int8_t i = 0; i < FAN_COUNT; i++) {
86
           for (int8_t i = 0; i < FAN_COUNT; i++) {
87
-            SERIAL_PROTOCOL(job_recovery_info.fanSpeeds[i]);
87
+            SERIAL_PROTOCOL(job_recovery_info.fan_speed[i]);
88
             if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
88
             if (i < FAN_COUNT - 1) SERIAL_CHAR(',');
89
           }
89
           }
90
           SERIAL_EOL();
90
           SERIAL_EOL();
264
     #endif
264
     #endif
265
 
265
 
266
     #if FAN_COUNT
266
     #if FAN_COUNT
267
-      COPY(job_recovery_info.fanSpeeds, fanSpeeds);
267
+      COPY(job_recovery_info.fan_speed, fan_speed);
268
     #endif
268
     #endif
269
 
269
 
270
     #if HAS_LEVELING
270
     #if HAS_LEVELING

+ 1
- 1
Marlin/src/feature/power_loss_recovery.h ファイルの表示

52
   #endif
52
   #endif
53
 
53
 
54
   #if FAN_COUNT
54
   #if FAN_COUNT
55
-    int16_t fanSpeeds[FAN_COUNT];
55
+    uint8_t fan_speed[FAN_COUNT];
56
   #endif
56
   #endif
57
 
57
 
58
   #if HAS_LEVELING
58
   #if HAS_LEVELING

+ 3
- 3
Marlin/src/gcode/control/M42.cpp ファイルの表示

52
   #if FAN_COUNT > 0
52
   #if FAN_COUNT > 0
53
     switch (pin) {
53
     switch (pin) {
54
       #if HAS_FAN0
54
       #if HAS_FAN0
55
-        case FAN_PIN: fanSpeeds[0] = pin_status; break;
55
+        case FAN_PIN: fan_speed[0] = pin_status; break;
56
       #endif
56
       #endif
57
       #if HAS_FAN1
57
       #if HAS_FAN1
58
-        case FAN1_PIN: fanSpeeds[1] = pin_status; break;
58
+        case FAN1_PIN: fan_speed[1] = pin_status; break;
59
       #endif
59
       #endif
60
       #if HAS_FAN2
60
       #if HAS_FAN2
61
-        case FAN2_PIN: fanSpeeds[2] = pin_status; break;
61
+        case FAN2_PIN: fan_speed[2] = pin_status; break;
62
       #endif
62
       #endif
63
     }
63
     }
64
   #endif
64
   #endif

+ 2
- 2
Marlin/src/gcode/control/M80_M81.cpp ファイルの表示

98
   planner.finish_and_disable();
98
   planner.finish_and_disable();
99
 
99
 
100
   #if FAN_COUNT > 0
100
   #if FAN_COUNT > 0
101
-    for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
101
+    for (uint8_t i = 0; i < FAN_COUNT; i++) fan_speed[i] = 0;
102
     #if ENABLED(PROBING_FANS_OFF)
102
     #if ENABLED(PROBING_FANS_OFF)
103
       fans_paused = false;
103
       fans_paused = false;
104
-      ZERO(paused_fanSpeeds);
104
+      ZERO(paused_fan_speed);
105
     #endif
105
     #endif
106
   #endif
106
   #endif
107
 
107
 

+ 1
- 1
Marlin/src/gcode/lcd/M145.cpp ファイルの表示

49
     }
49
     }
50
     if (parser.seenval('F')) {
50
     if (parser.seenval('F')) {
51
       v = parser.value_int();
51
       v = parser.value_int();
52
-      lcd_preheat_fan_speed[material] = constrain(v, 0, 255);
52
+      lcd_preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255);
53
     }
53
     }
54
     #if TEMP_SENSOR_BED != 0
54
     #if TEMP_SENSOR_BED != 0
55
       if (parser.seenval('B')) {
55
       if (parser.seenval('B')) {

+ 2
- 2
Marlin/src/gcode/parser.h ファイルの表示

325
   FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort()       : dval; }
325
   FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort()       : dval; }
326
   FORCE_INLINE static int32_t  longval(const char c, const int32_t dval=0)    { return seenval(c) ? value_long()         : dval; }
326
   FORCE_INLINE static int32_t  longval(const char c, const int32_t dval=0)    { return seenval(c) ? value_long()         : dval; }
327
   FORCE_INLINE static uint32_t ulongval(const char c, const uint32_t dval=0)  { return seenval(c) ? value_ulong()        : dval; }
327
   FORCE_INLINE static uint32_t ulongval(const char c, const uint32_t dval=0)  { return seenval(c) ? value_ulong()        : dval; }
328
-  FORCE_INLINE static float    linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; }
329
-  FORCE_INLINE static float    celsiusval(const char c, const float dval=0){ return seenval(c) ? value_celsius()      : dval; }
328
+  FORCE_INLINE static float    linearval(const char c, const float dval=0)    { return seenval(c) ? value_linear_units() : dval; }
329
+  FORCE_INLINE static float    celsiusval(const char c, const float dval=0)   { return seenval(c) ? value_celsius()      : dval; }
330
 
330
 
331
 };
331
 };
332
 
332
 

+ 8
- 7
Marlin/src/gcode/temperature/M106_M107.cpp ファイルの表示

25
 #if FAN_COUNT > 0
25
 #if FAN_COUNT > 0
26
 
26
 
27
 #include "../gcode.h"
27
 #include "../gcode.h"
28
-#include "../../Marlin.h" // for fanSpeeds — should move those to Planner
28
+#include "../../Marlin.h" // for fan_speed — should move those to Planner
29
 
29
 
30
 /**
30
 /**
31
  * M106: Set Fan Speed
31
  * M106: Set Fan Speed
48
       if (t > 0) {
48
       if (t > 0) {
49
         switch (t) {
49
         switch (t) {
50
           case 1:
50
           case 1:
51
-            fanSpeeds[p] = old_fanSpeeds[p];
51
+            fan_speed[p] = old_fan_speed[p];
52
             break;
52
             break;
53
           case 2:
53
           case 2:
54
-            old_fanSpeeds[p] = fanSpeeds[p];
55
-            fanSpeeds[p] = new_fanSpeeds[p];
54
+            old_fan_speed[p] = fan_speed[p];
55
+            fan_speed[p] = new_fan_speed[p];
56
             break;
56
             break;
57
           default:
57
           default:
58
-            new_fanSpeeds[p] = MIN(t, 255);
58
+            new_fan_speed[p] = MIN(t, 255);
59
             break;
59
             break;
60
         }
60
         }
61
         return;
61
         return;
62
+
62
       }
63
       }
63
     #endif // EXTRA_FAN_SPEED
64
     #endif // EXTRA_FAN_SPEED
64
     const uint16_t s = parser.ushortval('S', 255);
65
     const uint16_t s = parser.ushortval('S', 255);
65
-    fanSpeeds[p] = MIN(s, 255U);
66
+    fan_speed[p] = MIN(s, 255U);
66
   }
67
   }
67
 }
68
 }
68
 
69
 
71
  */
72
  */
72
 void GcodeSuite::M107() {
73
 void GcodeSuite::M107() {
73
   const uint16_t p = parser.ushortval('P');
74
   const uint16_t p = parser.ushortval('P');
74
-  if (p < FAN_COUNT) fanSpeeds[p] = 0;
75
+  if (p < FAN_COUNT) fan_speed[p] = 0;
75
 }
76
 }
76
 
77
 
77
 #endif // FAN_COUNT > 0
78
 #endif // FAN_COUNT > 0

+ 3
- 3
Marlin/src/lcd/dogm/status_screen_DOGM.h ファイルの表示

207
     static uint8_t fan_frame;
207
     static uint8_t fan_frame;
208
     if (old_blink != blink) {
208
     if (old_blink != blink) {
209
       old_blink = blink;
209
       old_blink = blink;
210
-      if (!fanSpeeds[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0;
210
+      if (!fan_speed[0] || ++fan_frame >= FAN_ANIM_FRAMES) fan_frame = 0;
211
     }
211
     }
212
   #endif
212
   #endif
213
 
213
 
245
             fan_frame == 3 ? status_screen3_bmp :
245
             fan_frame == 3 ? status_screen3_bmp :
246
           #endif
246
           #endif
247
         #else
247
         #else
248
-          blink && fanSpeeds[0] ? status_screen1_bmp :
248
+          blink && fan_speed[0] ? status_screen1_bmp :
249
         #endif
249
         #endif
250
       #endif
250
       #endif
251
       status_screen0_bmp
251
       status_screen0_bmp
269
     #if HAS_FAN0
269
     #if HAS_FAN0
270
       if (PAGE_CONTAINS(STATUS_SCREEN_FAN_TEXT_Y - 7, STATUS_SCREEN_FAN_TEXT_Y)) {
270
       if (PAGE_CONTAINS(STATUS_SCREEN_FAN_TEXT_Y - 7, STATUS_SCREEN_FAN_TEXT_Y)) {
271
         // Fan
271
         // Fan
272
-        const int16_t per = ((fanSpeeds[0] + 1) * 100) / 256;
272
+        const uint16_t per = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
273
         if (per) {
273
         if (per) {
274
           lcd_moveto(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y);
274
           lcd_moveto(STATUS_SCREEN_FAN_TEXT_X, STATUS_SCREEN_FAN_TEXT_Y);
275
           lcd_put_u8str(itostr3(per));
275
           lcd_put_u8str(itostr3(per));

+ 5
- 5
Marlin/src/lcd/dogm/status_screen_lite_ST7920.h ファイルの表示

710
   // them only during blinks we gain a bit of stability.
710
   // them only during blinks we gain a bit of stability.
711
   const bool       blink             = lcd_blink();
711
   const bool       blink             = lcd_blink();
712
   const uint16_t   feedrate_perc     = feedrate_percentage;
712
   const uint16_t   feedrate_perc     = feedrate_percentage;
713
-  const uint8_t    fan_speed         = ((fanSpeeds[0] + 1) * 100) / 256;
713
+  const uint8_t    fs                = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
714
   const int16_t    extruder_1_target = thermalManager.degTargetHotend(0);
714
   const int16_t    extruder_1_target = thermalManager.degTargetHotend(0);
715
   #if HOTENDS > 1
715
   #if HOTENDS > 1
716
     const int16_t  extruder_2_target = thermalManager.degTargetHotend(1);
716
     const int16_t  extruder_2_target = thermalManager.degTargetHotend(1);
719
     const int16_t  bed_target        = thermalManager.degTargetBed();
719
     const int16_t  bed_target        = thermalManager.degTargetBed();
720
   #endif
720
   #endif
721
   static uint16_t last_checksum = 0;
721
   static uint16_t last_checksum = 0;
722
-  const uint16_t checksum = blink ^ feedrate_perc ^ fan_speed ^ extruder_1_target
722
+  const uint16_t checksum = blink ^ feedrate_perc ^ fs ^ extruder_1_target
723
     #if HOTENDS > 1
723
     #if HOTENDS > 1
724
       ^ extruder_2_target
724
       ^ extruder_2_target
725
     #endif
725
     #endif
737
     const bool       blink             = lcd_blink();
737
     const bool       blink             = lcd_blink();
738
     const duration_t elapsed           = print_job_timer.duration();
738
     const duration_t elapsed           = print_job_timer.duration();
739
     const uint16_t   feedrate_perc     = feedrate_percentage;
739
     const uint16_t   feedrate_perc     = feedrate_percentage;
740
-    const uint8_t    fan_speed         = ((fanSpeeds[0] + 1) * 100) / 256;
740
+    const uint8_t    fs                = (((uint16_t)fan_speed[0] + 1) * 100) / 256;
741
     const int16_t    extruder_1_temp   = thermalManager.degHotend(0),
741
     const int16_t    extruder_1_temp   = thermalManager.degHotend(0),
742
                      extruder_1_target = thermalManager.degTargetHotend(0);
742
                      extruder_1_target = thermalManager.degTargetHotend(0);
743
     #if HOTENDS > 1
743
     #if HOTENDS > 1
756
     #if HAS_HEATED_BED
756
     #if HAS_HEATED_BED
757
       draw_bed_temp(bed_temp, bed_target, forceUpdate);
757
       draw_bed_temp(bed_temp, bed_target, forceUpdate);
758
     #endif
758
     #endif
759
-    draw_fan_speed(fan_speed);
759
+    draw_fan_speed(fs);
760
     draw_print_time(elapsed);
760
     draw_print_time(elapsed);
761
     draw_feedrate_percentage(feedrate_perc);
761
     draw_feedrate_percentage(feedrate_perc);
762
 
762
 
763
     // Update the fan and bed animations
763
     // Update the fan and bed animations
764
-    if (fan_speed > 0) draw_fan_icon(blink);
764
+    if (fs) draw_fan_icon(blink);
765
     #if HAS_HEATED_BED
765
     #if HAS_HEATED_BED
766
       if (bed_target > 0)
766
       if (bed_target > 0)
767
         draw_heat_icon(blink, true);
767
         draw_heat_icon(blink, true);

+ 1
- 1
Marlin/src/lcd/dogm/u8g_dev_st7920_128x64_HAL.cpp ファイルの表示

85
   U8G_ESC_END         // end of sequence
85
   U8G_ESC_END         // end of sequence
86
 };
86
 };
87
 
87
 
88
-void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev){
88
+void clear_graphics_DRAM(u8g_t *u8g, u8g_dev_t *dev) {
89
   u8g_SetChipSelect(u8g, dev, 1);
89
   u8g_SetChipSelect(u8g, dev, 1);
90
   u8g_Delay(1);
90
   u8g_Delay(1);
91
   u8g_SetAddress(u8g, dev, 0);         // cmd mode
91
   u8g_SetAddress(u8g, dev, 0);         // cmd mode

+ 1
- 1
Marlin/src/lcd/malyanlcd.cpp ファイルの表示

255
         print_job_timer.stop();
255
         print_job_timer.stop();
256
         thermalManager.disable_all_heaters();
256
         thermalManager.disable_all_heaters();
257
         #if FAN_COUNT > 0
257
         #if FAN_COUNT > 0
258
-          for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
258
+          for (uint8_t i = 0; i < FAN_COUNT; i++) fan_speed[i] = 0;
259
         #endif
259
         #endif
260
         wait_for_heatup = false;
260
         wait_for_heatup = false;
261
         write_to_lcd_P(PSTR("{SYS:STARTED}"));
261
         write_to_lcd_P(PSTR("{SYS:STARTED}"));

+ 20
- 19
Marlin/src/lcd/ultralcd.cpp ファイルの表示

159
   constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION);
159
   constexpr int8_t menu_bottom = LCD_HEIGHT - (TALL_FONT_CORRECTION);
160
 
160
 
161
   // Initialized by settings.load()
161
   // Initialized by settings.load()
162
-  int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
162
+  int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
163
+  uint8_t lcd_preheat_fan_speed[2];
163
 
164
 
164
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
165
   #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
165
     bool lcd_external_control; // = false
166
     bool lcd_external_control; // = false
945
 
946
 
946
       // Restore print cooling fan speeds
947
       // Restore print cooling fan speeds
947
       for (uint8_t i = 0; i < FAN_COUNT; i++) {
948
       for (uint8_t i = 0; i < FAN_COUNT; i++) {
948
-        int16_t f = job_recovery_info.fanSpeeds[i];
949
+        uint8_t f = job_recovery_info.fan_speed[i];
949
         if (f) {
950
         if (f) {
950
           sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
951
           sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
951
           enqueue_and_echo_command(cmd);
952
           enqueue_and_echo_command(cmd);
1553
     //
1554
     //
1554
     #if FAN_COUNT > 0
1555
     #if FAN_COUNT > 0
1555
       #if HAS_FAN0
1556
       #if HAS_FAN0
1556
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
1557
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
1557
         #if ENABLED(EXTRA_FAN_SPEED)
1558
         #if ENABLED(EXTRA_FAN_SPEED)
1558
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
1559
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
1559
         #endif
1560
         #endif
1560
       #endif
1561
       #endif
1561
       #if HAS_FAN1
1562
       #if HAS_FAN1
1562
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
1563
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
1563
         #if ENABLED(EXTRA_FAN_SPEED)
1564
         #if ENABLED(EXTRA_FAN_SPEED)
1564
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255);
1565
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
1565
         #endif
1566
         #endif
1566
       #endif
1567
       #endif
1567
       #if HAS_FAN2
1568
       #if HAS_FAN2
1568
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255);
1569
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
1569
         #if ENABLED(EXTRA_FAN_SPEED)
1570
         #if ENABLED(EXTRA_FAN_SPEED)
1570
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255);
1571
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
1571
         #endif
1572
         #endif
1572
       #endif
1573
       #endif
1573
     #endif // FAN_COUNT > 0
1574
     #endif // FAN_COUNT > 0
1669
    * "Temperature" submenu items
1670
    * "Temperature" submenu items
1670
    *
1671
    *
1671
    */
1672
    */
1672
-  void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const int16_t fan) {
1673
+  void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) {
1673
     if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum);
1674
     if (temph > 0) thermalManager.setTargetHotend(MIN(heater_maxtemp[endnum], temph), endnum);
1674
     #if HAS_HEATED_BED
1675
     #if HAS_HEATED_BED
1675
       if (tempb >= 0) thermalManager.setTargetBed(tempb);
1676
       if (tempb >= 0) thermalManager.setTargetBed(tempb);
1678
     #endif
1679
     #endif
1679
     #if FAN_COUNT > 0
1680
     #if FAN_COUNT > 0
1680
       #if FAN_COUNT > 1
1681
       #if FAN_COUNT > 1
1681
-        fanSpeeds[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
1682
+        fan_speed[active_extruder < FAN_COUNT ? active_extruder : 0] = fan;
1682
       #else
1683
       #else
1683
-        fanSpeeds[0] = fan;
1684
+        fan_speed[0] = fan;
1684
       #endif
1685
       #endif
1685
     #else
1686
     #else
1686
       UNUSED(fan);
1687
       UNUSED(fan);
1915
 
1916
 
1916
   void lcd_cooldown() {
1917
   void lcd_cooldown() {
1917
     #if FAN_COUNT > 0
1918
     #if FAN_COUNT > 0
1918
-      for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
1919
+      for (uint8_t i = 0; i < FAN_COUNT; i++) fan_speed[i] = 0;
1919
     #endif
1920
     #endif
1920
     thermalManager.disable_all_heaters();
1921
     thermalManager.disable_all_heaters();
1921
     lcd_return_to_status();
1922
     lcd_return_to_status();
3609
     //
3610
     //
3610
     #if FAN_COUNT > 0
3611
     #if FAN_COUNT > 0
3611
       #if HAS_FAN0
3612
       #if HAS_FAN0
3612
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fanSpeeds[0], 0, 255);
3613
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED FAN_SPEED_1_SUFFIX, &fan_speed[0], 0, 255);
3613
         #if ENABLED(EXTRA_FAN_SPEED)
3614
         #if ENABLED(EXTRA_FAN_SPEED)
3614
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fanSpeeds[0], 3, 255);
3615
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED FAN_SPEED_1_SUFFIX, &new_fan_speed[0], 3, 255);
3615
         #endif
3616
         #endif
3616
       #endif
3617
       #endif
3617
       #if HAS_FAN1
3618
       #if HAS_FAN1
3618
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 2", &fanSpeeds[1], 0, 255);
3619
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 2", &fan_speed[1], 0, 255);
3619
         #if ENABLED(EXTRA_FAN_SPEED)
3620
         #if ENABLED(EXTRA_FAN_SPEED)
3620
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 2", &new_fanSpeeds[1], 3, 255);
3621
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 2", &new_fan_speed[1], 3, 255);
3621
         #endif
3622
         #endif
3622
       #endif
3623
       #endif
3623
       #if HAS_FAN2
3624
       #if HAS_FAN2
3624
-        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED " 3", &fanSpeeds[2], 0, 255);
3625
+        MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_FAN_SPEED " 3", &fan_speed[2], 0, 255);
3625
         #if ENABLED(EXTRA_FAN_SPEED)
3626
         #if ENABLED(EXTRA_FAN_SPEED)
3626
-          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_EXTRA_FAN_SPEED " 3", &new_fanSpeeds[2], 3, 255);
3627
+          MENU_MULTIPLIER_ITEM_EDIT(int8, MSG_EXTRA_FAN_SPEED " 3", &new_fan_speed[2], 3, 255);
3627
         #endif
3628
         #endif
3628
       #endif
3629
       #endif
3629
     #endif // FAN_COUNT > 0
3630
     #endif // FAN_COUNT > 0
3755
       #endif
3756
       #endif
3756
       START_MENU();
3757
       START_MENU();
3757
       MENU_BACK(MSG_CONFIGURATION);
3758
       MENU_BACK(MSG_CONFIGURATION);
3758
-      MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
3759
+      MENU_ITEM_EDIT(int8, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
3759
       #if HAS_TEMP_HOTEND
3760
       #if HAS_TEMP_HOTEND
3760
         MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
3761
         MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
3761
       #endif
3762
       #endif

+ 2
- 1
Marlin/src/lcd/ultralcd.h ファイルの表示

107
     typedef void (*screenFunc_t)();
107
     typedef void (*screenFunc_t)();
108
     typedef void (*menuAction_t)();
108
     typedef void (*menuAction_t)();
109
 
109
 
110
-    extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
110
+    extern int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
111
+    extern uint8_t lcd_preheat_fan_speed[2];
111
 
112
 
112
     #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
113
     #if ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(G26_MESH_VALIDATION)
113
       extern bool lcd_external_control;
114
       extern bool lcd_external_control;

+ 3
- 3
Marlin/src/lcd/ultralcd_impl_HD44780.h ファイルの表示

1008
       #if FAN_COUNT > 0
1008
       #if FAN_COUNT > 0
1009
         if (0
1009
         if (0
1010
           #if HAS_FAN0
1010
           #if HAS_FAN0
1011
-            || fanSpeeds[0]
1011
+            || fan_speed[0]
1012
           #endif
1012
           #endif
1013
           #if HAS_FAN1
1013
           #if HAS_FAN1
1014
-            || fanSpeeds[1]
1014
+            || fan_speed[1]
1015
           #endif
1015
           #endif
1016
           #if HAS_FAN2
1016
           #if HAS_FAN2
1017
-            || fanSpeeds[2]
1017
+            || fan_speed[2]
1018
           #endif
1018
           #endif
1019
         ) leds |= LED_C;
1019
         ) leds |= LED_C;
1020
       #endif // FAN_COUNT > 0
1020
       #endif // FAN_COUNT > 0

+ 2
- 2
Marlin/src/libs/softspi.h ファイルの表示

31
  * @return value read
31
  * @return value read
32
  */
32
  */
33
 static inline __attribute__((always_inline))
33
 static inline __attribute__((always_inline))
34
-bool fastDigitalRead(uint8_t pin){
34
+bool fastDigitalRead(uint8_t pin) {
35
   return g_APinDescription[pin].pPort->PIO_PDSR & g_APinDescription[pin].ulPin;
35
   return g_APinDescription[pin].pPort->PIO_PDSR & g_APinDescription[pin].ulPin;
36
 }
36
 }
37
 //------------------------------------------------------------------------------
37
 //------------------------------------------------------------------------------
40
  * @param[in] level value to write
40
  * @param[in] level value to write
41
  */
41
  */
42
 static inline __attribute__((always_inline))
42
 static inline __attribute__((always_inline))
43
-void fastDigitalWrite(uint8_t pin, bool value){
43
+void fastDigitalWrite(uint8_t pin, bool value) {
44
   if (value)
44
   if (value)
45
     g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin;
45
     g_APinDescription[pin].pPort->PIO_SODR = g_APinDescription[pin].ulPin;
46
   else
46
   else

+ 8
- 12
Marlin/src/module/configuration_store.cpp ファイルの表示

37
  */
37
  */
38
 
38
 
39
 // Change EEPROM version if the structure changes
39
 // Change EEPROM version if the structure changes
40
-#define EEPROM_VERSION "V59"
40
+#define EEPROM_VERSION "V60"
41
 #define EEPROM_OFFSET 0
41
 #define EEPROM_OFFSET 0
42
 
42
 
43
 // Check the integrity of data offsets.
43
 // Check the integrity of data offsets.
214
   // ULTIPANEL
214
   // ULTIPANEL
215
   //
215
   //
216
   int16_t lcd_preheat_hotend_temp[2],                   // M145 S0 H
216
   int16_t lcd_preheat_hotend_temp[2],                   // M145 S0 H
217
-          lcd_preheat_bed_temp[2],                      // M145 S0 B
218
-          lcd_preheat_fan_speed[2];                     // M145 S0 F
217
+          lcd_preheat_bed_temp[2];                      // M145 S0 B
218
+  uint8_t lcd_preheat_fan_speed[2];                     // M145 S0 F
219
 
219
 
220
   //
220
   //
221
   // PIDTEMP
221
   // PIDTEMP
630
 
630
 
631
     #if DISABLED(ULTIPANEL)
631
     #if DISABLED(ULTIPANEL)
632
       constexpr int16_t lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
632
       constexpr int16_t lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
633
-                        lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
634
-                        lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
633
+                        lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED };
634
+      constexpr uint8_t lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
635
     #endif
635
     #endif
636
 
636
 
637
     EEPROM_WRITE(lcd_preheat_hotend_temp);
637
     EEPROM_WRITE(lcd_preheat_hotend_temp);
1238
       _FIELD_TEST(lcd_preheat_hotend_temp);
1238
       _FIELD_TEST(lcd_preheat_hotend_temp);
1239
 
1239
 
1240
       #if DISABLED(ULTIPANEL)
1240
       #if DISABLED(ULTIPANEL)
1241
-        int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
1241
+        int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2];
1242
+        uint8_t lcd_preheat_fan_speed[2];
1242
       #endif
1243
       #endif
1243
       EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
1244
       EEPROM_READ(lcd_preheat_hotend_temp); // 2 floats
1244
       EEPROM_READ(lcd_preheat_bed_temp);    // 2 floats
1245
       EEPROM_READ(lcd_preheat_bed_temp);    // 2 floats
1245
       EEPROM_READ(lcd_preheat_fan_speed);   // 2 floats
1246
       EEPROM_READ(lcd_preheat_fan_speed);   // 2 floats
1246
 
1247
 
1247
-      //EEPROM_ASSERT(
1248
-      //  WITHIN(lcd_preheat_fan_speed, 0, 255),
1249
-      //  "lcd_preheat_fan_speed out of range"
1250
-      //);
1251
-
1252
       //
1248
       //
1253
       // Hotend PID
1249
       // Hotend PID
1254
       //
1250
       //
2489
         SERIAL_ECHOPAIR_P(port, "  M145 S", (int)i);
2485
         SERIAL_ECHOPAIR_P(port, "  M145 S", (int)i);
2490
         SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(lcd_preheat_hotend_temp[i]));
2486
         SERIAL_ECHOPAIR_P(port, " H", TEMP_UNIT(lcd_preheat_hotend_temp[i]));
2491
         SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(lcd_preheat_bed_temp[i]));
2487
         SERIAL_ECHOPAIR_P(port, " B", TEMP_UNIT(lcd_preheat_bed_temp[i]));
2492
-        SERIAL_ECHOLNPAIR_P(port, " F", lcd_preheat_fan_speed[i]);
2488
+        SERIAL_ECHOLNPAIR_P(port, " F", int(lcd_preheat_fan_speed[i]));
2493
       }
2489
       }
2494
     #endif // ULTIPANEL
2490
     #endif // ULTIPANEL
2495
 
2491
 

+ 4
- 4
Marlin/src/module/planner.cpp ファイルの表示

1187
  * Maintain fans, paste extruder pressure,
1187
  * Maintain fans, paste extruder pressure,
1188
  */
1188
  */
1189
 void Planner::check_axes_activity() {
1189
 void Planner::check_axes_activity() {
1190
-  unsigned char axis_active[NUM_AXIS] = { 0 },
1191
-                tail_fan_speed[FAN_COUNT];
1190
+  uint8_t axis_active[NUM_AXIS] = { 0 },
1191
+          tail_fan_speed[FAN_COUNT];
1192
 
1192
 
1193
   #if ENABLED(BARICUDA)
1193
   #if ENABLED(BARICUDA)
1194
     #if HAS_HEATER_1
1194
     #if HAS_HEATER_1
1225
   }
1225
   }
1226
   else {
1226
   else {
1227
     #if FAN_COUNT > 0
1227
     #if FAN_COUNT > 0
1228
-      for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fanSpeeds[i];
1228
+      for (uint8_t i = 0; i < FAN_COUNT; i++) tail_fan_speed[i] = fan_speed[i];
1229
     #endif
1229
     #endif
1230
 
1230
 
1231
     #if ENABLED(BARICUDA)
1231
     #if ENABLED(BARICUDA)
1774
   #endif
1774
   #endif
1775
 
1775
 
1776
   #if FAN_COUNT > 0
1776
   #if FAN_COUNT > 0
1777
-    for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fanSpeeds[i];
1777
+    for (uint8_t i = 0; i < FAN_COUNT; i++) block->fan_speed[i] = fan_speed[i];
1778
   #endif
1778
   #endif
1779
 
1779
 
1780
   #if ENABLED(BARICUDA)
1780
   #if ENABLED(BARICUDA)

+ 1
- 1
Marlin/src/module/planner.h ファイルの表示

144
            acceleration_steps_per_s2;       // acceleration steps/sec^2
144
            acceleration_steps_per_s2;       // acceleration steps/sec^2
145
 
145
 
146
   #if FAN_COUNT > 0
146
   #if FAN_COUNT > 0
147
-    uint16_t fan_speed[FAN_COUNT];
147
+    uint8_t fan_speed[FAN_COUNT];
148
   #endif
148
   #endif
149
 
149
 
150
   #if ENABLED(BARICUDA)
150
   #if ENABLED(BARICUDA)

+ 3
- 3
Marlin/src/module/probe.cpp ファイルの表示

273
       fans_paused = p;
273
       fans_paused = p;
274
       if (p)
274
       if (p)
275
         for (uint8_t x = 0; x < FAN_COUNT; x++) {
275
         for (uint8_t x = 0; x < FAN_COUNT; x++) {
276
-          paused_fanSpeeds[x] = fanSpeeds[x];
277
-          fanSpeeds[x] = 0;
276
+          paused_fan_speed[x] = fan_speed[x];
277
+          fan_speed[x] = 0;
278
         }
278
         }
279
       else
279
       else
280
         for (uint8_t x = 0; x < FAN_COUNT; x++)
280
         for (uint8_t x = 0; x < FAN_COUNT; x++)
281
-          fanSpeeds[x] = paused_fanSpeeds[x];
281
+          fan_speed[x] = paused_fan_speed[x];
282
     }
282
     }
283
   }
283
   }
284
 
284
 

+ 1
- 1
Marlin/src/module/temperature.cpp ファイルの表示

97
         Temperature::target_temperature[HOTENDS] = { 0 };
97
         Temperature::target_temperature[HOTENDS] = { 0 };
98
 
98
 
99
 #if ENABLED(AUTO_POWER_E_FANS)
99
 #if ENABLED(AUTO_POWER_E_FANS)
100
-  int16_t Temperature::autofan_speed[HOTENDS] = { 0 };
100
+  uint8_t Temperature::autofan_speed[HOTENDS] = { 0 };
101
 #endif
101
 #endif
102
 
102
 
103
 #if HAS_HEATED_BED
103
 #if HAS_HEATED_BED

+ 1
- 1
Marlin/src/module/temperature.h ファイルの表示

123
     static uint8_t soft_pwm_amount[HOTENDS];
123
     static uint8_t soft_pwm_amount[HOTENDS];
124
 
124
 
125
     #if ENABLED(AUTO_POWER_E_FANS)
125
     #if ENABLED(AUTO_POWER_E_FANS)
126
-      static int16_t autofan_speed[HOTENDS];
126
+      static uint8_t autofan_speed[HOTENDS];
127
     #endif
127
     #endif
128
 
128
 
129
     #if ENABLED(FAN_SOFT_PWM)
129
     #if ENABLED(FAN_SOFT_PWM)

読み込み中…
キャンセル
保存