HIGH/LOW naming of pin state settings (#19089)
This commit is contained in:
parent
93167afaf5
commit
8652a7bdd2
@ -330,7 +330,7 @@
|
||||
//#define PSU_NAME "Power Supply"
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#define PSU_ACTIVE_HIGH false // Set 'false' for ATX, 'true' for X-Box
|
||||
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box
|
||||
|
||||
//#define PSU_DEFAULT_OFF // Keep power off until enabled directly with M80
|
||||
//#define PSU_POWERUP_DELAY 250 // (ms) Delay for the PSU to warm up to full power
|
||||
|
@ -2851,7 +2851,7 @@
|
||||
//#define SPINDLE_FEATURE
|
||||
//#define LASER_FEATURE
|
||||
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
|
||||
#define SPINDLE_LASER_ACTIVE_HIGH false // Set to "true" if the on/off function is active HIGH
|
||||
#define SPINDLE_LASER_ACTIVE_STATE LOW // Set to "HIGH" if the on/off function is active HIGH
|
||||
#define SPINDLE_LASER_PWM true // Set to "true" if your controller supports setting the speed/power
|
||||
#define SPINDLE_LASER_PWM_INVERT false // Set to "true" if the speed/power goes up when you want it to go slower
|
||||
|
||||
|
@ -93,5 +93,5 @@
|
||||
#define USB_VBOF_GPIO (PIO_PB10_IDX)
|
||||
#define USB_VBOF_FLAGS (PIO_PERIPH_A | PIO_DEFAULT)
|
||||
/*! Active level of the USB_VBOF output pin. */
|
||||
#define USB_VBOF_ACTIVE_LEVEL LOW
|
||||
#define USB_VBOF_ACTIVE_STATE LOW
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -89,8 +89,8 @@ extern bool wait_for_heatup;
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
extern bool powersupply_on;
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_HIGH); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_HIGH); powersupply_on = false; }while(0)
|
||||
#define PSU_PIN_ON() do{ OUT_WRITE(PS_ON_PIN, PSU_ACTIVE_STATE); powersupply_on = true; }while(0)
|
||||
#define PSU_PIN_OFF() do{ OUT_WRITE(PS_ON_PIN, !PSU_ACTIVE_STATE); powersupply_on = false; }while(0)
|
||||
#if ENABLED(AUTO_POWER_CONTROL)
|
||||
#define PSU_ON() powerManager.power_on()
|
||||
#define PSU_OFF() powerManager.power_off()
|
||||
|
@ -37,7 +37,7 @@ cutter_power_t SpindleLaser::menuPower, // Power s
|
||||
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
cutter_frequency_t SpindleLaser::frequency; // setting PWM frequency; range: 2K - 50K
|
||||
cutter_frequency_t SpindleLaser::frequency; // PWM frequency setting; range: 2K - 50K
|
||||
#endif
|
||||
#define SPINDLE_LASER_PWM_OFF ((SPINDLE_LASER_PWM_INVERT) ? 255 : 0)
|
||||
|
||||
@ -45,13 +45,13 @@ cutter_power_t SpindleLaser::menuPower, // Power s
|
||||
// Init the cutter to a safe OFF state
|
||||
//
|
||||
void SpindleLaser::init() {
|
||||
OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH); // Init spindle to off
|
||||
OUT_WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Init spindle to off
|
||||
#if ENABLED(SPINDLE_CHANGE_DIR)
|
||||
OUT_WRITE(SPINDLE_DIR_PIN, SPINDLE_INVERT_DIR ? 255 : 0); // Init rotation to clockwise (M3)
|
||||
#endif
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
SET_PWM(SPINDLE_LASER_PWM_PIN);
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // set to lowest speed
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Set to lowest speed
|
||||
#endif
|
||||
#if ENABLED(HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
|
||||
set_pwm_frequency(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_FREQUENCY);
|
||||
@ -64,14 +64,14 @@ void SpindleLaser::init() {
|
||||
* Set the cutter PWM directly to the given ocr value
|
||||
*/
|
||||
void SpindleLaser::set_ocr(const uint8_t ocr) {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_HIGH); // turn spindle on
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ACTIVE_STATE); // Turn spindle on
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
||||
#if NEEDS_HARDWARE_PWM && SPINDLE_LASER_FREQUENCY
|
||||
set_pwm_duty(pin_t(SPINDLE_LASER_PWM_PIN), ocr ^ SPINDLE_LASER_PWM_OFF);
|
||||
#endif
|
||||
}
|
||||
void SpindleLaser::ocr_off() {
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_HIGH); // Turn spindle off
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, !SPINDLE_LASER_ACTIVE_STATE); // Turn spindle off
|
||||
analogWrite(pin_t(SPINDLE_LASER_PWM_PIN), SPINDLE_LASER_PWM_OFF); // Only write low byte
|
||||
}
|
||||
#endif
|
||||
@ -98,7 +98,7 @@ void SpindleLaser::apply_power(const uint8_t opwr) {
|
||||
isReady = false;
|
||||
}
|
||||
#else
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, enabled() == SPINDLE_LASER_ACTIVE_HIGH);
|
||||
WRITE(SPINDLE_LASER_ENA_PIN, enabled() ? SPINDLE_LASER_ACTIVE_STATE : !SPINDLE_LASER_ACTIVE_STATE);
|
||||
isReady = true;
|
||||
#endif
|
||||
}
|
||||
|
@ -403,7 +403,7 @@
|
||||
#ifndef PSU_NAME
|
||||
#if DISABLED(PSU_CONTROL)
|
||||
#define PSU_NAME "Generic" // No control
|
||||
#elif PSU_ACTIVE_HIGH
|
||||
#elif PSU_ACTIVE_STATE
|
||||
#define PSU_NAME "XBox" // X-Box 360 (203W)
|
||||
#else
|
||||
#define PSU_NAME "ATX" // ATX style
|
||||
|
@ -419,8 +419,10 @@
|
||||
#error "SPINDLE_DIR_CHANGE is now SPINDLE_CHANGE_DIR. Please update your Configuration_adv.h."
|
||||
#elif defined(SPINDLE_STOP_ON_DIR_CHANGE)
|
||||
#error "SPINDLE_STOP_ON_DIR_CHANGE is now SPINDLE_CHANGE_DIR_STOP. Please update your Configuration_adv.h."
|
||||
#elif defined(SPINDLE_LASER_ACTIVE_HIGH)
|
||||
#error "SPINDLE_LASER_ACTIVE_HIGH is now SPINDLE_LASER_ACTIVE_STATE. Please update your Configuration_adv.h."
|
||||
#elif defined(SPINDLE_LASER_ENABLE_INVERT)
|
||||
#error "SPINDLE_LASER_ENABLE_INVERT is now SPINDLE_LASER_ACTIVE_HIGH. Please update your Configuration_adv.h."
|
||||
#error "SPINDLE_LASER_ENABLE_INVERT is now SPINDLE_LASER_ACTIVE_STATE. Please update your Configuration_adv.h."
|
||||
#elif defined(CUTTER_POWER_DISPLAY)
|
||||
#error "CUTTER_POWER_DISPLAY is now CUTTER_POWER_UNIT. Please update your Configuration_adv.h."
|
||||
#elif defined(CHAMBER_HEATER_PIN)
|
||||
@ -441,10 +443,12 @@
|
||||
#error "USB_SD_DISABLED is now NO_SD_HOST_DRIVE. Please update your Configuration_adv.h."
|
||||
#elif defined(USB_SD_ONBOARD)
|
||||
#error "USB_SD_ONBOARD is obsolete. Disable NO_SD_HOST_DRIVE instead."
|
||||
#elif defined(PSU_ACTIVE_HIGH)
|
||||
#error "PSU_ACTIVE_HIGH is now PSU_ACTIVE_STATE. Please update your configuration."
|
||||
#elif POWER_SUPPLY == 1
|
||||
#error "Replace POWER_SUPPLY 1 by enabling PSU_CONTROL and setting PSU_ACTIVE_HIGH to 'false'."
|
||||
#error "Replace POWER_SUPPLY 1 by enabling PSU_CONTROL and setting PSU_ACTIVE_STATE to 'LOW'."
|
||||
#elif POWER_SUPPLY == 2
|
||||
#error "Replace POWER_SUPPLY 2 by enabling PSU_CONTROL and setting PSU_ACTIVE_HIGH to 'true'."
|
||||
#error "Replace POWER_SUPPLY 2 by enabling PSU_CONTROL and setting PSU_ACTIVE_STATE to 'HIGH'."
|
||||
#elif defined(POWER_SUPPLY)
|
||||
#error "POWER_SUPPLY is now obsolete. Please remove it from Configuration.h."
|
||||
#elif defined(MKS_ROBIN_TFT)
|
||||
@ -2923,8 +2927,8 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
* Ensure this option is set intentionally
|
||||
*/
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
#ifndef PSU_ACTIVE_HIGH
|
||||
#error "PSU_CONTROL requires PSU_ACTIVE_HIGH to be defined as 'true' or 'false'."
|
||||
#ifndef PSU_ACTIVE_STATE
|
||||
#error "PSU_CONTROL requires PSU_ACTIVE_STATE to be defined as 'HIGH' or 'LOW'."
|
||||
#elif !PIN_EXISTS(PS_ON)
|
||||
#error "PSU_CONTROL requires PS_ON_PIN."
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user