浏览代码

settings: store runout sensor on/off (#13876)

Tanguy Pruvot 6 年前
父节点
当前提交
e5438a9a03
共有 1 个文件被更改,包括 60 次插入1 次删除
  1. 60
    1
      Marlin/src/module/configuration_store.cpp

+ 60
- 1
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 "V64"
40
+#define EEPROM_VERSION "V65"
41
 #define EEPROM_OFFSET 100
41
 #define EEPROM_OFFSET 100
42
 
42
 
43
 // Check the integrity of data offsets.
43
 // Check the integrity of data offsets.
90
 
90
 
91
 #include "../feature/pause.h"
91
 #include "../feature/pause.h"
92
 
92
 
93
+#if HAS_FILAMENT_SENSOR
94
+  #include "../feature/runout.h"
95
+#endif
96
+
93
 #if ENABLED(EXTRA_LIN_ADVANCE_K)
97
 #if ENABLED(EXTRA_LIN_ADVANCE_K)
94
 extern float saved_extruder_advance_K[EXTRUDERS];
98
 extern float saved_extruder_advance_K[EXTRUDERS];
95
 #endif
99
 #endif
142
   #endif
146
   #endif
143
 
147
 
144
   //
148
   //
149
+  // FILAMENT_RUNOUT_SENSOR
150
+  //
151
+  bool runout_sensor_enabled;                           // M412 S
152
+
153
+  //
145
   // ENABLE_LEVELING_FADE_HEIGHT
154
   // ENABLE_LEVELING_FADE_HEIGHT
146
   //
155
   //
147
   float planner_z_fade_height;                          // M420 Zn  planner.z_fade_height
156
   float planner_z_fade_height;                          // M420 Zn  planner.z_fade_height
291
 
300
 
292
 } SettingsData;
301
 } SettingsData;
293
 
302
 
303
+//static_assert(sizeof(SettingsData) <= E2END + 1, "EEPROM too small to contain SettingsData!");
304
+
294
 MarlinSettings settings;
305
 MarlinSettings settings;
295
 
306
 
296
 uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); }
307
 uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); }
513
     }
524
     }
514
 
525
 
515
     //
526
     //
527
+    // Filament Runout Sensor
528
+    //
529
+    {
530
+      #if HAS_FILAMENT_SENSOR
531
+        EEPROM_WRITE(runout.enabled);
532
+      #else
533
+        const bool runout_sensor_enabled = true;
534
+        EEPROM_WRITE(runout_sensor_enabled);
535
+      #endif
536
+    }
537
+
538
+    //
516
     // Global Leveling
539
     // Global Leveling
517
     //
540
     //
518
     {
541
     {
1238
       }
1261
       }
1239
 
1262
 
1240
       //
1263
       //
1264
+      // Filament Runout Sensor
1265
+      //
1266
+      {
1267
+        _FIELD_TEST(runout_sensor_enabled);
1268
+        #if HAS_FILAMENT_SENSOR
1269
+          EEPROM_READ(runout.enabled);
1270
+        #else
1271
+          bool runout_sensor_enabled;
1272
+          EEPROM_READ(runout_sensor_enabled);
1273
+        #endif
1274
+      }
1275
+
1276
+      //
1241
       // Global Leveling
1277
       // Global Leveling
1242
       //
1278
       //
1243
       {
1279
       {
2047
     reset_hotend_offsets();
2083
     reset_hotend_offsets();
2048
   #endif
2084
   #endif
2049
 
2085
 
2086
+  //
2087
+  // Filament Runout Sensor
2088
+  //
2089
+
2090
+  #if HAS_FILAMENT_SENSOR
2091
+    runout.enabled = true;
2092
+    runout.reset();
2093
+  #endif
2094
+
2095
+  //
2096
+  // Tool-change Settings
2097
+  //
2098
+
2050
   #if EXTRUDERS > 1
2099
   #if EXTRUDERS > 1
2051
     #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
2100
     #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
2052
       toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH;
2101
       toolchange_settings.swap_length = TOOLCHANGE_FIL_SWAP_LENGTH;
2059
     toolchange_settings.z_raise = TOOLCHANGE_ZRAISE;
2108
     toolchange_settings.z_raise = TOOLCHANGE_ZRAISE;
2060
   #endif
2109
   #endif
2061
 
2110
 
2111
+  //
2112
+  // Magnetic Parking Extruder
2113
+  //
2114
+
2062
   #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
2115
   #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
2063
     mpe_settings_init();
2116
     mpe_settings_init();
2064
   #endif
2117
   #endif
2540
       }
2593
       }
2541
     #endif
2594
     #endif
2542
 
2595
 
2596
+    #if HAS_FILAMENT_SENSOR
2597
+      CONFIG_ECHO_HEADING("Filament Runout Sensor:");
2598
+      CONFIG_ECHO_START();
2599
+      SERIAL_ECHOLNPAIR("  M412 S", int(runout.enabled));
2600
+    #endif
2601
+
2543
     /**
2602
     /**
2544
      * Bed Leveling
2603
      * Bed Leveling
2545
      */
2604
      */

正在加载...
取消
保存