소스 검색

Move inline laser state to fix EEPROM error

Scott Lahteine 5 년 전
부모
커밋
181739d0d1
4개의 변경된 파일18개의 추가작업 그리고 13개의 파일을 삭제
  1. 5
    5
      Marlin/src/feature/spindle_laser.h
  2. 6
    2
      Marlin/src/module/planner.cpp
  3. 5
    4
      Marlin/src/module/planner.h
  4. 2
    2
      Marlin/src/module/stepper.cpp

+ 5
- 5
Marlin/src/feature/spindle_laser.h 파일 보기

137
 
137
 
138
   #if ENABLED(LASER_POWER_INLINE)
138
   #if ENABLED(LASER_POWER_INLINE)
139
     // Force disengage planner power control
139
     // Force disengage planner power control
140
-    static inline void inline_disable() { planner.settings.laser.status = 0; planner.settings.laser.power = 0; isOn = false;}
140
+    static inline void inline_disable() { planner.laser.status = 0; planner.laser.power = 0; isOn = false;}
141
 
141
 
142
     // Inline modes of all other functions; all enable planner inline power control
142
     // Inline modes of all other functions; all enable planner inline power control
143
     static inline void inline_enabled(const bool enable) { enable ? inline_power(SPEED_POWER_STARTUP) : inline_ocr_power(0); }
143
     static inline void inline_enabled(const bool enable) { enable ? inline_power(SPEED_POWER_STARTUP) : inline_ocr_power(0); }
146
       #if ENABLED(SPINDLE_LASER_PWM)
146
       #if ENABLED(SPINDLE_LASER_PWM)
147
         inline_ocr_power(translate_power(pwr));
147
         inline_ocr_power(translate_power(pwr));
148
       #else
148
       #else
149
-        planner.settings.laser.status = enabled(pwr) ? 0x03 : 0x01;
150
-        planner.settings.laser.power = pwr;
149
+        planner.laser.status = enabled(pwr) ? 0x03 : 0x01;
150
+        planner.laser.power = pwr;
151
       #endif
151
       #endif
152
     }
152
     }
153
 
153
 
155
 
155
 
156
     #if ENABLED(SPINDLE_LASER_PWM)
156
     #if ENABLED(SPINDLE_LASER_PWM)
157
       static inline void inline_ocr_power(const uint8_t pwr) {
157
       static inline void inline_ocr_power(const uint8_t pwr) {
158
-        planner.settings.laser.status = pwr ? 0x03 : 0x01;
159
-        planner.settings.laser.power = pwr;
158
+        planner.laser.status = pwr ? 0x03 : 0x01;
159
+        planner.laser.power = pwr;
160
       }
160
       }
161
     #endif
161
     #endif
162
   #endif
162
   #endif

+ 6
- 2
Marlin/src/module/planner.cpp 파일 보기

128
 
128
 
129
 planner_settings_t Planner::settings;           // Initialized by settings.load()
129
 planner_settings_t Planner::settings;           // Initialized by settings.load()
130
 
130
 
131
+#if ENABLED(LASER_POWER_INLINE)
132
+  laser_state_t Planner::laser;              // Current state for blocks
133
+#endif
134
+
131
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
135
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
132
 
136
 
133
 float Planner::steps_to_mm[XYZE_N];             // (mm) Millimeters per step
137
 float Planner::steps_to_mm[XYZE_N];             // (mm) Millimeters per step
1799
 
1803
 
1800
   // Update block laser power
1804
   // Update block laser power
1801
   #if ENABLED(LASER_POWER_INLINE)
1805
   #if ENABLED(LASER_POWER_INLINE)
1802
-    block->laser.status = settings.laser.status;
1803
-    block->laser.power = settings.laser.power;
1806
+    block->laser.status = laser.status;
1807
+    block->laser.power = laser.power;
1804
   #endif
1808
   #endif
1805
 
1809
 
1806
   // Number of steps for each axis
1810
   // Number of steps for each axis

+ 5
- 4
Marlin/src/module/planner.h 파일 보기

248
      * as it avoids floating points during move loop
248
      * as it avoids floating points during move loop
249
      */
249
      */
250
     uint8_t power;
250
     uint8_t power;
251
-  } settings_laser_t;
251
+  } laser_state_t;
252
 #endif
252
 #endif
253
 
253
 
254
 typedef struct {
254
 typedef struct {
261
             travel_acceleration;                // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves.
261
             travel_acceleration;                // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves.
262
  feedRate_t min_feedrate_mm_s,                  // (mm/s) M205 S - Minimum linear feedrate
262
  feedRate_t min_feedrate_mm_s,                  // (mm/s) M205 S - Minimum linear feedrate
263
             min_travel_feedrate_mm_s;           // (mm/s) M205 T - Minimum travel feedrate
263
             min_travel_feedrate_mm_s;           // (mm/s) M205 T - Minimum travel feedrate
264
-  #if ENABLED(LASER_POWER_INLINE)
265
-    settings_laser_t laser;
266
-  #endif
267
 } planner_settings_t;
264
 } planner_settings_t;
268
 
265
 
269
 #if DISABLED(SKEW_CORRECTION)
266
 #if DISABLED(SKEW_CORRECTION)
334
 
331
 
335
     static planner_settings_t settings;
332
     static planner_settings_t settings;
336
 
333
 
334
+    #if ENABLED(LASER_POWER_INLINE)
335
+      static laser_state_t laser;
336
+    #endif
337
+
337
     static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
338
     static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
338
     static float steps_to_mm[XYZE_N];           // Millimeters per step
339
     static float steps_to_mm[XYZE_N];           // Millimeters per step
339
 
340
 

+ 2
- 2
Marlin/src/module/stepper.cpp 파일 보기

2239
     #if ENABLED(LASER_POWER_INLINE_CONTINUOUS)
2239
     #if ENABLED(LASER_POWER_INLINE_CONTINUOUS)
2240
       else { // No new block found; so apply inline laser parameters
2240
       else { // No new block found; so apply inline laser parameters
2241
         // This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed
2241
         // This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed
2242
-        const uint8_t stat = planner.settings.laser.status;
2242
+        const uint8_t stat = planner.laser.status;
2243
         if (TEST(stat, 0)) {             // Planner controls the laser
2243
         if (TEST(stat, 0)) {             // Planner controls the laser
2244
           #if ENABLED(SPINDLE_LASER_PWM)
2244
           #if ENABLED(SPINDLE_LASER_PWM)
2245
             if (TEST(stat, 1))           // Laser is on
2245
             if (TEST(stat, 1))           // Laser is on
2246
-              cutter.set_ocr_power(planner.settings.laser.power);
2246
+              cutter.set_ocr_power(planner.laser.power);
2247
             else
2247
             else
2248
               cutter.set_power(0);
2248
               cutter.set_power(0);
2249
           #else
2249
           #else

Loading…
취소
저장