Improvements for Laser / Spindle (#17661)

This commit is contained in:
Luu Lac
2020-06-08 00:47:31 -05:00
committed by GitHub
parent 5ac66b0f95
commit eda2fd8dbe
16 changed files with 448 additions and 268 deletions

View File

@ -117,8 +117,15 @@ enum BlockFlag : char {
#if ENABLED(LASER_POWER_INLINE)
typedef struct {
uint8_t status, // See planner settings for meaning
power; // Ditto; When in trapezoid mode this is nominal power
bool isPlanned:1;
bool isEnabled:1;
bool dir:1;
bool Reserved:6;
} power_status_t;
typedef struct {
power_status_t status; // See planner settings for meaning
uint8_t power; // Ditto; When in trapezoid mode this is nominal power
#if ENABLED(LASER_POWER_INLINE_TRAPEZOID)
uint8_t power_entry; // Entry power for the laser
#if DISABLED(LASER_POWER_INLINE_TRAPEZOID_CONT)
@ -234,18 +241,15 @@ typedef struct block_t {
#if ENABLED(LASER_POWER_INLINE)
typedef struct {
/**
* Laser status bitmask; most bits are unused;
* 0: Planner buffer enable
* 1: Laser enable
* 2: Reserved for direction
* Laser status flags
*/
uint8_t status;
power_status_t status;
/**
* Laser power: 0 or 255 in case of PWM-less laser,
* or the OCR value;
* or the OCR (oscillator count register) value;
*
* Using OCR instead of raw power,
* as it avoids floating points during move loop
* Using OCR instead of raw power, because it avoids
* floating point operations during the move loop.
*/
uint8_t power;
} laser_state_t;
@ -332,7 +336,7 @@ class Planner {
static planner_settings_t settings;
#if ENABLED(LASER_POWER_INLINE)
static laser_state_t laser;
static laser_state_t laser_inline;
#endif
static uint32_t max_acceleration_steps_per_s2[XYZE_N]; // (steps/s^2) Derived from mm_per_s2