From 3386f29e72b604c73485fa2c3463a7eb545711d8 Mon Sep 17 00:00:00 2001 From: crocsg <34553036+crocsg@users.noreply.github.com> Date: Mon, 11 Jul 2022 10:04:01 +0200 Subject: [PATCH] update M3 S1 to disable electromagnet after small delay --- MarlinBraille/Configuration.h | 5 +++-- MarlinBraille/Marlin_main.cpp | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/MarlinBraille/Configuration.h b/MarlinBraille/Configuration.h index ee526fb..4cb25e6 100644 --- a/MarlinBraille/Configuration.h +++ b/MarlinBraille/Configuration.h @@ -131,12 +131,13 @@ // You can use an online service to generate a random UUID. (eg http://www.uuidgenerator.net/version4) //#define MACHINE_UUID "00000000-0000-0000-0000-000000000000" -// BRAILLE RAP CONFIG +// BRAILLE RAP CONFIG SGN #define SPINDLE_LASER_ENABLE #define SPINDLE_LASER_ENABLE_PIN RAMPS_D8_PIN // !!! sortie BED MOSFET #define SPINDLE_LASER_PWM_PIN RAMPS_D10_PIN // !!! sortie E0 MOSFET #define SPINDLE_DIR_PIN 5 // pin servo - +#define BRAILLERAP_ELECTROMAGNET_DELAY 50 +#define BRAILLERAP_AUTODISABL_MAGNET 1 /* #if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENABLE) diff --git a/MarlinBraille/Marlin_main.cpp b/MarlinBraille/Marlin_main.cpp index fd82f7c..e7cabe1 100644 --- a/MarlinBraille/Marlin_main.cpp +++ b/MarlinBraille/Marlin_main.cpp @@ -6616,6 +6616,16 @@ inline void gcode_G92() { WRITE(SPINDLE_LASER_ENABLE_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) analogWrite(SPINDLE_LASER_PWM_PIN, ocr_val & 0xFF); // only write low byte delay_for_power_up(); + #if BRAILLERAP_AUTODISABL_MAGNET + // BRAILLERAP SGN disable electro magnet to avoid overheating + if (spindle_laser_power < 2) + { + WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT); // turn spindle off (active low) + analogWrite(SPINDLE_LASER_PWM_PIN, SPINDLE_LASER_PWM_INVERT ? 255 : 0); // only write low byte + delay_for_power_down(); + } + //spindle_laser_power = 0; + #endif } } #else