Browse Source

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

vanilla_fb_2.0.x
Tanguy Pruvot 4 years ago
committed by Scott Lahteine
parent
commit
19c38f1a8a
  1. 3
      Marlin/src/MarlinCore.cpp
  2. 6
      Marlin/src/module/temperature.cpp
  3. 13
      Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h

3
Marlin/src/MarlinCore.cpp

@ -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

6
Marlin/src/module/temperature.cpp

@ -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);

13
Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h

@ -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
@ -92,10 +91,20 @@
#define FAN_MAX_PWM 255 #define FAN_MAX_PWM 255
//#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor //#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor
// Can drive a PC Buzzer, if connected between PWM and 5V pins // Can drive a PC Buzzer, if connected between PWM and 5V pins
#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!

Loading…
Cancel
Save