Bläddra i källkod

New Controller Fan options and M710 gcode (#17149)

Erkan Colak 4 år sedan
förälder
incheckning
83eec683c9
Inget konto är kopplat till bidragsgivarens mejladress

+ 13
- 6
Marlin/Configuration_adv.h Visa fil

@@ -338,15 +338,22 @@
338 338
  * Controller Fan
339 339
  * To cool down the stepper drivers and MOSFETs.
340 340
  *
341
- * The fan will turn on automatically whenever any stepper is enabled
342
- * and turn off after a set period after all steppers are turned off.
341
+ * The fan turns on automatically whenever any driver is enabled and turns
342
+ * off (or reduces to idle speed) shortly after drivers are turned off.
343
+ *
343 344
  */
344 345
 //#define USE_CONTROLLER_FAN
345 346
 #if ENABLED(USE_CONTROLLER_FAN)
346
-  //#define CONTROLLER_FAN_PIN -1           // Set a custom pin for the controller fan
347
-  #define CONTROLLERFAN_SECS 60             // Duration in seconds for the fan to run after all motors are disabled
348
-  #define CONTROLLERFAN_SPEED 255           // 255 == full speed
349
-  //#define CONTROLLERFAN_SPEED_Z_ONLY 127  // Reduce noise on machines that keep Z enabled
347
+  //#define CONTROLLER_FAN_PIN -1        // Set a custom pin for the controller fan
348
+  //#define CONTROLLER_FAN_USE_Z_ONLY    // With this option only the Z axis is considered
349
+  #define CONTROLLERFAN_SPEED_MIN      0 // (0-255) Minimum speed. (If set below this value the fan is turned off.)
350
+  #define CONTROLLERFAN_SPEED_ACTIVE 255 // (0-255) Active speed, used when any motor is enabled
351
+  #define CONTROLLERFAN_SPEED_IDLE     0 // (0-255) Idle speed, used when motors are disabled
352
+  #define CONTROLLERFAN_IDLE_TIME     60 // (seconds) Extra time to keep the fan running after disabling motors
353
+  //#define CONTROLLER_FAN_EDITABLE      // Enable M710 configurable settings
354
+  #if ENABLED(CONTROLLER_FAN_EDITABLE)
355
+    #define CONTROLLER_FAN_MENU          // Enable the Controller Fan submenu
356
+  #endif
350 357
 #endif
351 358
 
352 359
 // When first starting the main fan, run it at full speed for the

+ 5
- 5
Marlin/src/MarlinCore.cpp Visa fil

@@ -567,7 +567,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
567 567
   #endif
568 568
 
569 569
   #if ENABLED(USE_CONTROLLER_FAN)
570
-    controllerfan_update(); // Check if fan should be turned on to cool stepper drivers down
570
+    controllerFan.update(); // Check if fan should be turned on to cool stepper drivers down
571 571
   #endif
572 572
 
573 573
   #if ENABLED(AUTO_POWER_CONTROL)
@@ -984,6 +984,10 @@ void setup() {
984 984
     SETUP_RUN(leds.setup());
985 985
   #endif
986 986
 
987
+  #if ENABLED(USE_CONTROLLER_FAN)     // Set up fan controller to initialize also the default configurations.
988
+    SETUP_RUN(controllerFan.setup());
989
+  #endif
990
+
987 991
   SETUP_RUN(ui.init());
988 992
   SETUP_RUN(ui.reset_status());       // Load welcome message early. (Retained if no errors exist.)
989 993
 
@@ -1047,10 +1051,6 @@ void setup() {
1047 1051
     SETUP_RUN(endstops.enable_z_probe(false));
1048 1052
   #endif
1049 1053
 
1050
-  #if ENABLED(USE_CONTROLLER_FAN)
1051
-    SET_OUTPUT(CONTROLLER_FAN_PIN);
1052
-  #endif
1053
-
1054 1054
   #if HAS_STEPPER_RESET
1055 1055
     SETUP_RUN(enableStepperDrivers());
1056 1056
   #endif

+ 52
- 33
Marlin/src/feature/controllerfan.cpp Visa fil

@@ -24,60 +24,79 @@
24 24
 
25 25
 #if ENABLED(USE_CONTROLLER_FAN)
26 26
 
27
+#include "controllerfan.h"
27 28
 #include "../module/stepper/indirection.h"
28 29
 #include "../module/temperature.h"
29 30
 
30
-uint8_t controllerfan_speed;
31
+ControllerFan controllerFan;
31 32
 
32
-void controllerfan_update() {
33
-  static millis_t lastMotorOn = 0, // Last time a motor was turned on
33
+uint8_t ControllerFan::speed;
34
+
35
+#if ENABLED(CONTROLLER_FAN_EDITABLE)
36
+  controllerFan_settings_t ControllerFan::settings; // {0}
37
+#endif
38
+
39
+void ControllerFan::setup() {
40
+  SET_OUTPUT(CONTROLLER_FAN_PIN);
41
+  init();
42
+}
43
+
44
+void ControllerFan::set_fan_speed(const uint8_t s) {
45
+  speed = s < (CONTROLLERFAN_SPEED_MIN) ? 0 : s; // Fan OFF below minimum
46
+}
47
+
48
+void ControllerFan::update() {
49
+  static millis_t lastMotorOn = 0,    // Last time a motor was turned on
34 50
                   nextMotorCheck = 0; // Last time the state was checked
35 51
   const millis_t ms = millis();
36 52
   if (ELAPSED(ms, nextMotorCheck)) {
37 53
     nextMotorCheck = ms + 2500UL; // Not a time critical function, so only check every 2.5s
38 54
 
39
-    const bool xory = X_ENABLE_READ() == bool(X_ENABLE_ON) || Y_ENABLE_READ() == bool(Y_ENABLE_ON);
55
+    #define MOTOR_IS_ON(A,B) (A##_ENABLE_READ() == bool(B##_ENABLE_ON))
56
+    #define _OR_ENABLED_E(N) || MOTOR_IS_ON(E##N,E)
57
+
58
+    const bool
59
+    xy_motor_on = MOTOR_IS_ON(X,X) || MOTOR_IS_ON(Y,Y)
60
+                  #if HAS_X2_ENABLE
61
+                    || MOTOR_IS_ON(X2,X)
62
+                  #endif
63
+                  #if HAS_Y2_ENABLE
64
+                    || MOTOR_IS_ON(Y2,Y)
65
+                  #endif
66
+                  ,
67
+    z_motor_on  = MOTOR_IS_ON(Z,Z)
68
+                  #if HAS_Z2_ENABLE
69
+                    || MOTOR_IS_ON(Z2,Z)
70
+                  #endif
71
+                  #if HAS_Z3_ENABLE
72
+                    || MOTOR_IS_ON(Z3,Z)
73
+                  #endif
74
+                  #if HAS_Z4_ENABLE
75
+                    || MOTOR_IS_ON(Z4,Z)
76
+                  #endif
77
+                  ;
40 78
 
41 79
     // If any of the drivers or the bed are enabled...
42
-    if (xory || Z_ENABLE_READ() == bool(Z_ENABLE_ON)
80
+    if (xy_motor_on || z_motor_on
43 81
       #if HAS_HEATED_BED
44 82
         || thermalManager.temp_bed.soft_pwm_amount > 0
45 83
       #endif
46
-      #if HAS_X2_ENABLE
47
-        || X2_ENABLE_READ() == bool(X_ENABLE_ON)
48
-      #endif
49
-      #if HAS_Y2_ENABLE
50
-        || Y2_ENABLE_READ() == bool(Y_ENABLE_ON)
51
-      #endif
52
-      #if HAS_Z2_ENABLE
53
-        || Z2_ENABLE_READ() == bool(Z_ENABLE_ON)
54
-      #endif
55
-      #if HAS_Z3_ENABLE
56
-        || Z3_ENABLE_READ() == bool(Z_ENABLE_ON)
57
-      #endif
58
-      #if HAS_Z4_ENABLE
59
-        || Z4_ENABLE_READ() == bool(Z_ENABLE_ON)
60
-      #endif
61 84
       #if E_STEPPERS
62
-        #define _OR_ENABLED_E(N) || E##N##_ENABLE_READ() == bool(E_ENABLE_ON)
63 85
         REPEAT(E_STEPPERS, _OR_ENABLED_E)
64 86
       #endif
65
-    ) {
66
-      lastMotorOn = ms; //... set time to NOW so the fan will turn on
67
-    }
87
+    ) lastMotorOn = ms; //... set time to NOW so the fan will turn on
68 88
 
69
-    // Fan off if no steppers have been enabled for CONTROLLERFAN_SECS seconds
70
-    controllerfan_speed = (!lastMotorOn || ELAPSED(ms, lastMotorOn + (CONTROLLERFAN_SECS) * 1000UL)) ? 0 : (
71
-      #ifdef CONTROLLERFAN_SPEED_Z_ONLY
72
-        xory ? CONTROLLERFAN_SPEED : CONTROLLERFAN_SPEED_Z_ONLY
73
-      #else
74
-        CONTROLLERFAN_SPEED
75
-      #endif
89
+    // Fan Settings. Set fan > 0:
90
+    //  - If AutoMode is on and steppers have been enabled for CONTROLLERFAN_IDLE_TIME seconds.
91
+    //  - If System is on idle and idle fan speed settings is activated.
92
+    set_fan_speed(
93
+      settings.auto_mode && lastMotorOn && PENDING(ms, lastMotorOn + settings.duration * 1000UL)
94
+      ? settings.active_speed : settings.idle_speed
76 95
     );
77 96
 
78 97
     // Allow digital or PWM fan output (see M42 handling)
79
-    WRITE(CONTROLLER_FAN_PIN, controllerfan_speed);
80
-    analogWrite(pin_t(CONTROLLER_FAN_PIN), controllerfan_speed);
98
+    WRITE(CONTROLLER_FAN_PIN, speed);
99
+    analogWrite(pin_t(CONTROLLER_FAN_PIN), speed);
81 100
   }
82 101
 }
83 102
 

+ 53
- 1
Marlin/src/feature/controllerfan.h Visa fil

@@ -21,4 +21,56 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-void controllerfan_update();
24
+#include "../inc/MarlinConfigPre.h"
25
+
26
+typedef struct {
27
+  uint8_t   active_speed,    // 0-255 (fullspeed); Speed with enabled stepper motors
28
+            idle_speed;      // 0-255 (fullspeed); Speed after idle period with all motors are disabled
29
+  uint16_t  duration;        // Duration in seconds for the fan to run after all motors are disabled
30
+  bool      auto_mode;       // Default true
31
+} controllerFan_settings_t;
32
+
33
+#ifndef CONTROLLERFAN_SPEED_ACTIVE
34
+  #define CONTROLLERFAN_SPEED_ACTIVE 255
35
+#endif
36
+#ifndef CONTROLLERFAN_SPEED_IDLE
37
+  #define CONTROLLERFAN_SPEED_IDLE     0
38
+#endif
39
+#ifndef CONTROLLERFAN_IDLE_TIME
40
+  #define CONTROLLERFAN_IDLE_TIME     60
41
+#endif
42
+
43
+static constexpr controllerFan_settings_t controllerFan_defaults = {
44
+  CONTROLLERFAN_SPEED_ACTIVE,
45
+  CONTROLLERFAN_SPEED_IDLE,
46
+  CONTROLLERFAN_IDLE_TIME,
47
+  true
48
+};
49
+
50
+#if ENABLED(USE_CONTROLLER_FAN)
51
+
52
+class ControllerFan {
53
+  private:
54
+    static uint8_t speed;
55
+    static void set_fan_speed(const uint8_t s);
56
+
57
+  public:
58
+    #if ENABLED(CONTROLLER_FAN_EDITABLE)
59
+      static controllerFan_settings_t settings;
60
+    #else
61
+      static const controllerFan_settings_t &settings = controllerFan_defaults;
62
+    #endif
63
+    static inline bool state() { return speed > 0; }
64
+    static inline void init() { reset(); }
65
+    static inline void reset() {
66
+      #if ENABLED(CONTROLLER_FAN_EDITABLE)
67
+        settings = controllerFan_defaults;
68
+      #endif
69
+    }
70
+    static void setup();
71
+    static void update();
72
+};
73
+
74
+extern ControllerFan controllerFan;
75
+
76
+#endif

+ 2
- 2
Marlin/src/feature/power.cpp Visa fil

@@ -46,8 +46,8 @@ bool Power::is_power_needed() {
46 46
     HOTEND_LOOP() if (thermalManager.autofan_speed[e]) return true;
47 47
   #endif
48 48
 
49
-  #if ENABLED(AUTO_POWER_CONTROLLERFAN, USE_CONTROLLER_FAN) && HAS_CONTROLLER_FAN
50
-    if (controllerfan_speed) return true;
49
+  #if BOTH(USE_CONTROLLER_FAN, AUTO_POWER_CONTROLLERFAN)
50
+    if (controllerFan.state()) return true;
51 51
   #endif
52 52
 
53 53
   #if ENABLED(AUTO_POWER_CHAMBER_FAN)

+ 83
- 0
Marlin/src/gcode/feature/controllerfan/M710.cpp Visa fil

@@ -0,0 +1,83 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(CONTROLLER_FAN_EDITABLE)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../feature/controllerfan.h"
29
+
30
+void M710_report(const bool forReplay) {
31
+  if (!forReplay) { SERIAL_ECHOLNPGM("; Controller Fan"); SERIAL_ECHO_START(); }
32
+  SERIAL_ECHOLNPAIR("M710 "
33
+    "S", int(controllerFan.settings.active_speed),
34
+    "I", int(controllerFan.settings.idle_speed),
35
+    "A", int(controllerFan.settings.auto_mode),
36
+    "D", controllerFan.settings.duration,
37
+    " ; (", (int(controllerFan.settings.active_speed) * 100) / 255, "%"
38
+    " ", (int(controllerFan.settings.idle_speed) * 100) / 255, "%)"
39
+  );
40
+}
41
+
42
+/**
43
+ * M710: Set controller fan settings
44
+ *
45
+ *  R         : Reset to defaults
46
+ *  S[0-255]  : Fan speed when motors are active
47
+ *  I[0-255]  : Fan speed when motors are idle
48
+ *  A[0|1]    : Turn auto mode on or off
49
+ *  D         : Set auto mode idle duration
50
+ *
51
+ * Examples:
52
+ *   M710                   ; Report current Settings
53
+ *   M710 R                 ; Reset SIAD to defaults
54
+ *   M710 I64               ; Set controller fan Idle Speed to 25%
55
+ *   M710 S255              ; Set controller fan Active Speed to 100%
56
+ *   M710 S0                ; Set controller fan Active Speed to OFF
57
+ *   M710 I255 A0           ; Set controller fan Idle Speed to 100% with Auto Mode OFF
58
+ *   M710 I127 A1 S255 D160 ; Set controller fan idle speed 50%, AutoMode On, Fan speed 100%, duration to 160 Secs
59
+ */
60
+void GcodeSuite::M710() {
61
+
62
+  const bool seenR = parser.seen('R');
63
+  if (seenR) controllerFan.reset();
64
+
65
+  const bool seenS = parser.seenval('S');
66
+  if (seenS) controllerFan.settings.active_speed = parser.value_byte();
67
+
68
+  const bool seenI = parser.seenval('I');
69
+  if (seenI) controllerFan.settings.idle_speed = parser.value_byte();
70
+
71
+  const bool seenA = parser.seenval('A');
72
+  if (seenA) controllerFan.settings.auto_mode = parser.value_bool();
73
+
74
+  const bool seenD = parser.seenval('D');
75
+  if (seenD) controllerFan.settings.duration = parser.value_ushort();
76
+
77
+  if (seenR || seenS || seenI || seenA || seenD)
78
+    controllerFan.update();
79
+  else
80
+    M710_report(false);
81
+}
82
+
83
+#endif // CONTROLLER_FAN_EDITABLE

+ 4
- 0
Marlin/src/gcode/gcode.cpp Visa fil

@@ -752,6 +752,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
752 752
         case 702: M702(); break;                                  // M702: Unload Filament
753 753
       #endif
754 754
 
755
+      #if ENABLED(CONTROLLER_FAN_EDITABLE)
756
+        case 710: M710(); break;                                  // M710: Set Controller Fan settings
757
+      #endif
758
+
755 759
       #if ENABLED(GCODE_MACROS)
756 760
         case 810: case 811: case 812: case 813: case 814:
757 761
         case 815: case 816: case 817: case 818: case 819:

+ 4
- 0
Marlin/src/gcode/gcode.h Visa fil

@@ -972,6 +972,10 @@ private:
972 972
     static void M7219();
973 973
   #endif
974 974
 
975
+  #if ENABLED(CONTROLLER_FAN_EDITABLE)
976
+    static void M710();
977
+  #endif
978
+
975 979
   static void T(const uint8_t tool_index);
976 980
 
977 981
 };

+ 2
- 0
Marlin/src/inc/SanityCheck.h Visa fil

@@ -270,6 +270,8 @@
270 270
   #error "Replace SLED_PIN with SOL1_PIN (applies to both Z_PROBE_SLED and SOLENOID_PROBE)."
271 271
 #elif defined(CONTROLLERFAN_PIN)
272 272
   #error "CONTROLLERFAN_PIN is now CONTROLLER_FAN_PIN, enabled with USE_CONTROLLER_FAN. Please update your Configuration_adv.h."
273
+#elif defined(CONTROLLERFAN_SPEED)
274
+  #error "CONTROLLERFAN_SPEED is now CONTROLLERFAN_SPEED_ACTIVE. Please update your Configuration_adv.h."
273 275
 #elif defined(MIN_RETRACT)
274 276
   #error "MIN_RETRACT is now MIN_AUTORETRACT and MAX_AUTORETRACT. Please update your Configuration_adv.h."
275 277
 #elif defined(ADVANCE)

+ 5
- 0
Marlin/src/lcd/language/language_de.h Visa fil

@@ -236,6 +236,11 @@ namespace Language_de {
236 236
   PROGMEM Language_Str MSG_FAN_SPEED_N                     = _UxGT("Lüfter ~");
237 237
   PROGMEM Language_Str MSG_EXTRA_FAN_SPEED                 = _UxGT("Geschw. Extralüfter");
238 238
   PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N               = _UxGT("Geschw. Extralüfter ~");
239
+  PROGMEM Language_Str MSG_CONTROLLER_FAN                  = _UxGT("Lüfter Kontroller");
240
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_IDLE_SPEED       = _UxGT("Lüfter Leerlauf");
241
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_AUTO_ON          = _UxGT("Motorlast Modus");
242
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_SPEED            = _UxGT("Lüfter Motorlast");
243
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_DURATION         = _UxGT("Ausschalt Delay");
239 244
   PROGMEM Language_Str MSG_FLOW                            = _UxGT("Flussrate");
240 245
   PROGMEM Language_Str MSG_FLOW_N                          = _UxGT("Flussrate ~");
241 246
   PROGMEM Language_Str MSG_CONTROL                         = _UxGT("Einstellungen");

+ 5
- 0
Marlin/src/lcd/language/language_en.h Visa fil

@@ -247,6 +247,11 @@ namespace Language_en {
247 247
   PROGMEM Language_Str MSG_STORED_FAN_N                    = _UxGT("Stored Fan ~");
248 248
   PROGMEM Language_Str MSG_EXTRA_FAN_SPEED                 = _UxGT("Extra Fan Speed");
249 249
   PROGMEM Language_Str MSG_EXTRA_FAN_SPEED_N               = _UxGT("Extra Fan Speed ~");
250
+  PROGMEM Language_Str MSG_CONTROLLER_FAN                  = _UxGT("Controller Fan");
251
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_IDLE_SPEED       = _UxGT("Idle Speed");
252
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_AUTO_ON          = _UxGT("Auto Mode");
253
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_SPEED            = _UxGT("Active Speed");
254
+  PROGMEM Language_Str MSG_CONTROLLER_FAN_DURATION         = _UxGT("Idle Period");
250 255
   PROGMEM Language_Str MSG_FLOW                            = _UxGT("Flow");
251 256
   PROGMEM Language_Str MSG_FLOW_N                          = _UxGT("Flow ~");
252 257
   PROGMEM Language_Str MSG_CONTROL                         = _UxGT("Control");

+ 25
- 0
Marlin/src/lcd/menu/menu_configuration.cpp Visa fil

@@ -227,6 +227,24 @@ void menu_advanced_settings();
227 227
   }
228 228
 #endif
229 229
 
230
+#if ENABLED(CONTROLLER_FAN_MENU)
231
+
232
+  #include "../../feature/controllerfan.h"
233
+
234
+  void menu_controller_fan() {
235
+    START_MENU();
236
+    BACK_ITEM(MSG_CONFIGURATION);
237
+    EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_IDLE_SPEED, &controllerFan.settings.idle_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255, controllerFan.update);
238
+    EDIT_ITEM(bool, MSG_CONTROLLER_FAN_AUTO_ON, &controllerFan.settings.auto_mode, controllerFan.update);
239
+    if (controllerFan.settings.auto_mode) {
240
+      EDIT_ITEM_FAST(percent, MSG_CONTROLLER_FAN_SPEED, &controllerFan.settings.active_speed, _MAX(1, CONTROLLERFAN_SPEED_MIN) - 1, 255, controllerFan.update);
241
+      EDIT_ITEM(uint16_4, MSG_CONTROLLER_FAN_DURATION, &controllerFan.settings.duration, 0, 4800, controllerFan.update);
242
+    }
243
+    END_MENU();
244
+  }
245
+
246
+#endif
247
+
230 248
 #if ENABLED(CASE_LIGHT_MENU)
231 249
 
232 250
   #include "../../feature/caselight.h"
@@ -320,6 +338,13 @@ void menu_configuration() {
320 338
     EDIT_ITEM(LCD_Z_OFFSET_TYPE, MSG_ZPROBE_ZOFFSET, &probe.offset.z, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
321 339
   #endif
322 340
 
341
+  //
342
+  // Set Fan Controller speed
343
+  //
344
+  #if ENABLED(CONTROLLER_FAN_MENU)
345
+    SUBMENU(MSG_CONTROLLER_FAN, menu_controller_fan);
346
+  #endif
347
+
323 348
   const bool busy = printer_busy();
324 349
   if (!busy) {
325 350
     #if EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION)

+ 47
- 0
Marlin/src/module/configuration_store.cpp Visa fil

@@ -122,6 +122,11 @@
122 122
   #include "../feature/probe_temp_comp.h"
123 123
 #endif
124 124
 
125
+#include "../feature/controllerfan.h"
126
+#if ENABLED(CONTROLLER_FAN_EDITABLE)
127
+  void M710_report(const bool forReplay);
128
+#endif
129
+
125 130
 #pragma pack(push, 1) // No padding between variables
126 131
 
127 132
 typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t;
@@ -293,6 +298,11 @@ typedef struct SettingsDataStruct {
293 298
   int16_t lcd_contrast;                                 // M250 C
294 299
 
295 300
   //
301
+  // Controller fan settings
302
+  //
303
+  controllerFan_settings_t controllerFan_settings;      // M710
304
+
305
+  //
296 306
   // POWER_LOSS_RECOVERY
297 307
   //
298 308
   bool recovery_enabled;                                // M413 S
@@ -881,6 +891,19 @@ void MarlinSettings::postprocess() {
881 891
     }
882 892
 
883 893
     //
894
+    // Controller Fan
895
+    //
896
+    {
897
+      _FIELD_TEST(controllerFan_settings);
898
+      #if ENABLED(USE_CONTROLLER_FAN)
899
+        const controllerFan_settings_t &cfs = controllerFan.settings;
900
+      #else
901
+        controllerFan_settings_t cfs = controllerFan_defaults;
902
+      #endif
903
+      EEPROM_WRITE(cfs);
904
+    }
905
+
906
+    //
884 907
     // Power-Loss Recovery
885 908
     //
886 909
     {
@@ -1720,6 +1743,19 @@ void MarlinSettings::postprocess() {
1720 1743
       }
1721 1744
 
1722 1745
       //
1746
+      // Controller Fan
1747
+      //
1748
+      {
1749
+        _FIELD_TEST(controllerFan_settings);
1750
+        #if ENABLED(CONTROLLER_FAN_EDITABLE)
1751
+          const controllerFan_settings_t &cfs = controllerFan.settings;
1752
+        #else
1753
+          controllerFan_settings_t cfs = { 0 };
1754
+        #endif
1755
+        EEPROM_READ(cfs);
1756
+      }
1757
+
1758
+      //
1723 1759
       // Power-Loss Recovery
1724 1760
       //
1725 1761
       {
@@ -2591,6 +2627,13 @@ void MarlinSettings::reset() {
2591 2627
   #endif
2592 2628
 
2593 2629
   //
2630
+  // Controller Fan
2631
+  //
2632
+  #if ENABLED(USE_CONTROLLER_FAN)
2633
+    controllerFan.reset();
2634
+  #endif
2635
+
2636
+  //
2594 2637
   // Power-Loss Recovery
2595 2638
   //
2596 2639
 
@@ -3154,6 +3197,10 @@ void MarlinSettings::reset() {
3154 3197
       SERIAL_ECHOLNPAIR("  M250 C", ui.contrast);
3155 3198
     #endif
3156 3199
 
3200
+    #if ENABLED(CONTROLLER_FAN_EDITABLE)
3201
+      M710_report(forReplay);
3202
+    #endif
3203
+
3157 3204
     #if ENABLED(POWER_LOSS_RECOVERY)
3158 3205
       CONFIG_ECHO_HEADING("Power-Loss Recovery:");
3159 3206
       CONFIG_ECHO_START();

+ 7
- 5
buildroot/share/tests/mega2560-tests Visa fil

@@ -115,21 +115,23 @@ exec_test $1 $2 "RAMPS | ZONESTAR_LCD | MMU2 | Servo Probe | ABL 3-Pt | Debug Le
115 115
 # Test MINIRAMBO with PWM_MOTOR_CURRENT and many features
116 116
 #
117 117
 restore_configs
118
-opt_set MOTHERBOARD BOARD_MINIRAMBO
118
+opt_set MOTHERBOARD BOARD_MEGACONTROLLER
119 119
 opt_set LCD_LANGUAGE de
120 120
 opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT \
121
-           ULTIMAKERCONTROLLER SDSUPPORT PCA9632 LCD_INFO_MENU \
121
+           MINIPANEL SDSUPPORT PCA9632 LCD_INFO_MENU \
122 122
            AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY LCD_BED_LEVELING G26_MESH_VALIDATION MESH_EDIT_MENU \
123
-            LIN_ADVANCE EXTRA_LIN_ADVANCE_K \
123
+           LIN_ADVANCE EXTRA_LIN_ADVANCE_K \
124 124
            INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT EXPERIMENTAL_I2CBUS M100_FREE_MEMORY_WATCHER \
125 125
            NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE \
126 126
            ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE ADVANCED_PAUSE_CONTINUOUS_PURGE FILAMENT_LOAD_UNLOAD_GCODES \
127
-           PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 M114_DETAIL
127
+           PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 M114_DETAIL \
128
+           USE_CONTROLLER_FAN CONTROLLER_FAN_EDITABLE
129
+opt_set CONTROLLERFAN_SPEED_IDLE 128
128 130
 opt_add M100_FREE_MEMORY_DUMPER
129 131
 opt_add M100_FREE_MEMORY_CORRUPTOR
130 132
 opt_set PWM_MOTOR_CURRENT "{ 1300, 1300, 1250 }"
131 133
 opt_set I2C_SLAVE_ADDRESS 63
132
-exec_test $1 $2 "MINIRAMBO | Ultimaker LCD | M100 | PWM_MOTOR_CURRENT | PRINTCOUNTER | Advanced Pause ..."
134
+exec_test $1 $2 "MEGACONTROLLER | Ultimaker LCD | M100 | PWM_MOTOR_CURRENT | PRINTCOUNTER | Advanced Pause ..."
133 135
 
134 136
 #
135 137
 # Mixing Extruder with 5 steppers, Cyrillic

Laddar…
Avbryt
Spara