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