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 GitHub
parent 3061a31c92
commit d167af4c38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View file

@ -870,6 +870,9 @@ inline void tmc_standby_setup() {
* Max7219
*/
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

View file

@ -1793,7 +1793,7 @@ void Temperature::updateTemperaturesFromRawValues() {
#endif
// 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)
#else
#define _INIT_SOFT_FAN(P) OUT_WRITE(P, FAN_INVERTING ? LOW : HIGH)
@ -1886,7 +1886,7 @@ void Temperature::init() {
#endif
#if HAS_HEATER_0
#ifdef ALFAWISE_UX0
#ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING);
#else
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
@ -1916,7 +1916,7 @@ void Temperature::init() {
#endif
#if HAS_HEATED_BED
#ifdef ALFAWISE_UX0
#ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING);
#else
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);

View file

@ -29,7 +29,6 @@
#endif
#define BOARD_INFO_NAME "Longer3D"
#define ALFAWISE_UX0 // Common to all Longer3D STM32F1 boards (used for Open drain mosfets)
#define BOARD_NO_NATIVE_USB
@ -92,10 +91,20 @@
#define FAN_MAX_PWM 255
//#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
// 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
// Other servo devices are not supported on this board!