Move inline laser state to fix EEPROM error
This commit is contained in:
parent
a06a0c5b88
commit
181739d0d1
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
// Force disengage planner power control
|
||||
static inline void inline_disable() { planner.settings.laser.status = 0; planner.settings.laser.power = 0; isOn = false;}
|
||||
static inline void inline_disable() { planner.laser.status = 0; planner.laser.power = 0; isOn = false;}
|
||||
|
||||
// Inline modes of all other functions; all enable planner inline power control
|
||||
static inline void inline_enabled(const bool enable) { enable ? inline_power(SPEED_POWER_STARTUP) : inline_ocr_power(0); }
|
||||
|
@ -146,8 +146,8 @@ public:
|
|||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
inline_ocr_power(translate_power(pwr));
|
||||
#else
|
||||
planner.settings.laser.status = enabled(pwr) ? 0x03 : 0x01;
|
||||
planner.settings.laser.power = pwr;
|
||||
planner.laser.status = enabled(pwr) ? 0x03 : 0x01;
|
||||
planner.laser.power = pwr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,8 @@ public:
|
|||
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
static inline void inline_ocr_power(const uint8_t pwr) {
|
||||
planner.settings.laser.status = pwr ? 0x03 : 0x01;
|
||||
planner.settings.laser.power = pwr;
|
||||
planner.laser.status = pwr ? 0x03 : 0x01;
|
||||
planner.laser.power = pwr;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -128,6 +128,10 @@ uint8_t Planner::delay_before_delivering; // This counter delays delivery
|
|||
|
||||
planner_settings_t Planner::settings; // Initialized by settings.load()
|
||||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
laser_state_t Planner::laser; // Current state for blocks
|
||||
#endif
|
||||
|
||||
uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
|
||||
|
||||
float Planner::steps_to_mm[XYZE_N]; // (mm) Millimeters per step
|
||||
|
@ -1799,8 +1803,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
|
|||
|
||||
// Update block laser power
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
block->laser.status = settings.laser.status;
|
||||
block->laser.power = settings.laser.power;
|
||||
block->laser.status = laser.status;
|
||||
block->laser.power = laser.power;
|
||||
#endif
|
||||
|
||||
// Number of steps for each axis
|
||||
|
|
|
@ -248,7 +248,7 @@ typedef struct block_t {
|
|||
* as it avoids floating points during move loop
|
||||
*/
|
||||
uint8_t power;
|
||||
} settings_laser_t;
|
||||
} laser_state_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
@ -261,9 +261,6 @@ typedef struct {
|
|||
travel_acceleration; // (mm/s^2) M204 T - Travel acceleration. DEFAULT ACCELERATION for all NON printing moves.
|
||||
feedRate_t min_feedrate_mm_s, // (mm/s) M205 S - Minimum linear feedrate
|
||||
min_travel_feedrate_mm_s; // (mm/s) M205 T - Minimum travel feedrate
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
settings_laser_t laser;
|
||||
#endif
|
||||
} planner_settings_t;
|
||||
|
||||
#if DISABLED(SKEW_CORRECTION)
|
||||
|
@ -334,6 +331,10 @@ class Planner {
|
|||
|
||||
static planner_settings_t settings;
|
||||
|
||||
#if ENABLED(LASER_POWER_INLINE)
|
||||
static laser_state_t laser;
|
||||
#endif
|
||||
|
||||
static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2
|
||||
static float steps_to_mm[XYZE_N]; // Millimeters per step
|
||||
|
||||
|
|
|
@ -2239,11 +2239,11 @@ uint32_t Stepper::block_phase_isr() {
|
|||
#if ENABLED(LASER_POWER_INLINE_CONTINUOUS)
|
||||
else { // No new block found; so apply inline laser parameters
|
||||
// This should mean ending file with 'M5 I' will stop the laser; thus the inline flag isn't needed
|
||||
const uint8_t stat = planner.settings.laser.status;
|
||||
const uint8_t stat = planner.laser.status;
|
||||
if (TEST(stat, 0)) { // Planner controls the laser
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
if (TEST(stat, 1)) // Laser is on
|
||||
cutter.set_ocr_power(planner.settings.laser.power);
|
||||
cutter.set_ocr_power(planner.laser.power);
|
||||
else
|
||||
cutter.set_power(0);
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue