|
|
@ -41,18 +41,10 @@
|
|
|
|
#define PCT_TO_PWM(X) ((X) * 255 / 100)
|
|
|
|
#define PCT_TO_PWM(X) ((X) * 255 / 100)
|
|
|
|
#define PCT_TO_SERVO(X) ((X) * 180 / 100)
|
|
|
|
#define PCT_TO_SERVO(X) ((X) * 180 / 100)
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SPEED_POWER_INTERCEPT
|
|
|
|
|
|
|
|
#define SPEED_POWER_INTERCEPT 0
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #define _MAP(N,S1,S2,D1,D2) ((N)*_MAX((D2)-(D1),0)/_MAX((S2)-(S1),1)+(D1))
|
|
|
|
// #define _MAP(N,S1,S2,D1,D2) ((N)*_MAX((D2)-(D1),0)/_MAX((S2)-(S1),1)+(D1))
|
|
|
|
|
|
|
|
|
|
|
|
class SpindleLaser {
|
|
|
|
class SpindleLaser {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
static constexpr float
|
|
|
|
|
|
|
|
min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)),
|
|
|
|
|
|
|
|
max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const inline uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); }
|
|
|
|
static const inline uint8_t pct_to_ocr(const_float_t pct) { return uint8_t(PCT_TO_PWM(pct)); }
|
|
|
|
|
|
|
|
|
|
|
|
// cpower = configured values (e.g., SPEED_POWER_MAX)
|
|
|
|
// cpower = configured values (e.g., SPEED_POWER_MAX)
|
|
|
@ -158,6 +150,9 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit) {
|
|
|
|
static inline cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit) {
|
|
|
|
|
|
|
|
static constexpr float
|
|
|
|
|
|
|
|
min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)),
|
|
|
|
|
|
|
|
max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX);
|
|
|
|
if (pwr <= 0) return 0;
|
|
|
|
if (pwr <= 0) return 0;
|
|
|
|
cutter_power_t upwr;
|
|
|
|
cutter_power_t upwr;
|
|
|
|
switch (pwrUnit) {
|
|
|
|
switch (pwrUnit) {
|
|
|
@ -186,6 +181,7 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return upwr;
|
|
|
|
return upwr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // SPINDLE_LASER_USE_PWM
|
|
|
|
#endif // SPINDLE_LASER_USE_PWM
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|