|
@@ -37,7 +37,7 @@ cutter_power_t SpindleLaser::menuPower, // Power s
|
37
|
37
|
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM
|
38
|
38
|
|
39
|
39
|
#if ENABLED(MARLIN_DEV_MODE)
|
40
|
|
- cutter_frequency_t SpindleLaser::frequency; // setting PWM frequency; range: 2K - 50K
|
|
40
|
+ cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K
|
41
|
41
|
#endif
|
42
|
42
|
#define SPINDLE_LASER_PWM_OFF ((SPINDLE_LASER_PWM_INVERT) ? 255 : 0)
|
43
|
43
|
|
|
@@ -45,13 +45,13 @@ cutter_power_t SpindleLaser::menuPower, // Power s
|
45
|
45
|
// Init the cutter to a safe OFF state
|
46
|
46
|
//
|
47
|
47
|
void SpindleLaser::init() {
|
48
|
|
- OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH); // Init spindle to off
|
|
48
|
+ OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Init spindle to off
|
49
|
49
|
#if ENABLED(SPINDLE_CHANGE_DIR)
|
50
|
50
|
OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // Init rotation to clockwise (M3)
|
51
|
51
|
#endif
|
52
|
52
|
#if ENABLED(SPINDLE_LASER_PWM)
|
53
|
53
|
SET_PWM(SPINDLE_LASER_PWM_PIN);
|
54
|
|
- analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // set to lowest speed
|
|
54
|
+ analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed
|
55
|
55
|
#endif
|
56
|
56
|
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
|
57
|
57
|
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY);
|
|
@@ -64,14 +64,14 @@ void SpindleLaser::init() {
|
64
|
64
|
* Set the cutter PWM directly to the given ocr value
|
65
|
65
|
*/
|
66
|
66
|
void SpindleLaser::set_ocr(const uint8_t ocr) {
|
67
|
|
- WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_HIGH); // turn spindle on
|
|
67
|
+ WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Turn spindle on
|
68
|
68
|
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
69
|
69
|
#if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY
|
70
|
70
|
set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
71
|
71
|
#endif
|
72
|
72
|
}
|
73
|
73
|
void SpindleLaser::ocr_off() {
|
74
|
|
- WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH); // Turn spindle off
|
|
74
|
+ WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Turn spindle off
|
75
|
75
|
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Only write low byte
|
76
|
76
|
}
|
77
|
77
|
#endif
|
|
@@ -98,7 +98,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
|
98
|
98
|
isReady = false;
|
99
|
99
|
}
|
100
|
100
|
#else
|
101
|
|
- WRITE(SPINDLE_LASER_ENA_PIN, enabled() == SPINDLE_LASER_ACTIVE_HIGH);
|
|
101
|
+ WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE);
|
102
|
102
|
isReady = true;
|
103
|
103
|
#endif
|
104
|
104
|
}
|