#include <spindle_laser.h>
◆ init()
void SpindleLaser::init |
( |
| ) |
|
|
static |
41 #if ENABLED(SPINDLE_CHANGE_DIR)
44 #if ENABLED(SPINDLE_LASER_PWM)
◆ enabled()
static bool SpindleLaser::enabled |
( |
| ) |
|
|
static |
◆ set_power()
◆ refresh()
static void SpindleLaser::refresh |
( |
| ) |
|
|
static |
◆ set_enabled()
static void SpindleLaser::set_enabled |
( |
const bool |
enable | ) |
|
|
static |
◆ apply_power()
66 if (inpow == last_power_applied)
return;
67 last_power_applied = inpow;
68 #if ENABLED(SPINDLE_LASER_PWM)
70 #define _scaled(F) ((F - (SPEED_POWER_INTERCEPT)) * inv_slope)
71 constexpr
float inv_slope =
RECIPROCAL(SPEED_POWER_SLOPE),
72 min_ocr = _scaled(SPEED_POWER_MIN),
73 max_ocr = _scaled(SPEED_POWER_MAX);
75 if (inpow <= SPEED_POWER_MIN) ocr_val = min_ocr;
76 else if (inpow >= SPEED_POWER_MAX) ocr_val = max_ocr;
77 else ocr_val = _scaled(inpow);
78 set_ocr(ocr_val & 0xFF);
◆ update_output()
static void SpindleLaser::update_output |
( |
| ) |
|
|
static |
◆ power_delay()
static void SpindleLaser::power_delay |
( |
| ) |
|
|
static |
77 #if SPINDLE_LASER_POWERUP_DELAY || SPINDLE_LASER_POWERDOWN_DELAY
78 safe_delay(
enabled() ? SPINDLE_LASER_POWERUP_DELAY : SPINDLE_LASER_POWERDOWN_DELAY);
◆ set_direction()
static void SpindleLaser::set_direction |
( |
const bool |
| ) |
|
|
static |
◆ disable()
static void SpindleLaser::disable |
( |
| ) |
|
|
static |
◆ enable_forward()
static void SpindleLaser::enable_forward |
( |
| ) |
|
|
static |
◆ enable_reverse()
static void SpindleLaser::enable_reverse |
( |
| ) |
|
|
static |
◆ power