Add BOARD_PREINIT (for Longer3D open drain pins) (#21159)

This commit is contained in:
Tanguy Pruvot 2021-02-25 11:35:18 +01:00 committed by Scott Lahteine
parent ac5f2a9300
commit 19c38f1a8a
3 changed files with 17 additions and 5 deletions

View file

@ -870,6 +870,9 @@ inline void tmc_standby_setup() {
* Max7219 * Max7219
*/ */
void setup() { void setup() {
#ifdef BOARD_PREINIT
BOARD_PREINIT(); // Low-level init (before serial init)
#endif
tmc_standby_setup(); // TMC Low Power Standby pins must be set early or they're not usable tmc_standby_setup(); // TMC Low Power Standby pins must be set early or they're not usable

View file

@ -1793,7 +1793,7 @@ void Temperature::updateTemperaturesFromRawValues() {
#endif #endif
// Init fans according to whether they're native PWM or Software PWM // Init fans according to whether they're native PWM or Software PWM
#ifdef ALFAWISE_UX0 #ifdef BOARD_OPENDRAIN_MOSFETS
#define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH) #define _INIT_SOFT_FAN(P) OUT_WRITE_OD(P, FAN_INVERTING ? LOW : HIGH)
#else #else
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH) #define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
@ -1886,7 +1886,7 @@ void Temperature::init() {
#endif #endif
#if HAS_HEATER_0 #if HAS_HEATER_0
#ifdef ALFAWISE_UX0 #ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING); OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING);
#else #else
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING); OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
@ -1916,7 +1916,7 @@ void Temperature::init() {
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
#ifdef ALFAWISE_UX0 #ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING); OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING);
#else #else
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING); OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);

View file

@ -29,7 +29,6 @@
#endif #endif
#define BOARD_INFO_NAME "Longer3D" #define BOARD_INFO_NAME "Longer3D"
#define ALFAWISE_UX0 // Common to all Longer3D STM32F1 boards (used for Open drain mosfets)
#define BOARD_NO_NATIVE_USB #define BOARD_NO_NATIVE_USB
@ -96,6 +95,16 @@
#define LED_PIN PC2 // pin 17 #define LED_PIN PC2 // pin 17
// Longer3D board mosfets are passing by default
// Avoid nozzle heat and fan start before serial init
#define BOARD_OPENDRAIN_MOSFETS
#define BOARD_PREINIT() { \
OUT_WRITE_OD(HEATER_0_PIN, 0); \
OUT_WRITE_OD(HEATER_BED_PIN, 0); \
OUT_WRITE_OD(FAN_PIN, 0); \
}
// //
// PWM for a servo probe // PWM for a servo probe
// Other servo devices are not supported on this board! // Other servo devices are not supported on this board!