Laser Test Fire (#20452)

This commit is contained in:
Mike La Spina
2021-01-10 06:01:25 -06:00
committed by Scott Lahteine
parent 4e46de66d3
commit 9901b4e9f1
6 changed files with 43 additions and 1 deletions

View File

@ -36,6 +36,9 @@
SpindleLaser cutter;
uint8_t SpindleLaser::power;
#if ENABLED(LASER_FEATURE)
cutter_test_pulse_t SpindleLaser::testPulse = 50; // Test fire Pulse time ms value.
#endif
bool SpindleLaser::isReady; // Ready to apply power setting from the UI to OCR
cutter_power_t SpindleLaser::menuPower, // Power set via LCD menu in PWM, PERCENT, or RPM
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM

View File

@ -30,6 +30,10 @@
#include "spindle_laser_types.h"
#if USE_BEEPER
#include "../libs/buzzer.h"
#endif
#if ENABLED(LASER_POWER_INLINE)
#include "../module/planner.h"
#endif
@ -90,6 +94,10 @@ public:
static const cutter_power_t mpower_min() { return cpwr_to_upwr(SPEED_POWER_MIN); }
static const cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); }
#if ENABLED(LASER_FEATURE)
static cutter_test_pulse_t testPulse; // Test fire Pulse ms value
#endif
static bool isReady; // Ready to apply power setting from the UI to OCR
static uint8_t power;
@ -230,7 +238,21 @@ public:
}
#endif
#endif
#if ENABLED(LASER_FEATURE)
/**
* Test fire the laser using the testPulse ms duration
* Also fires with any PWM power that was previous set
* If not set defaults to 80% power
*/
static inline void test_fire_pulse() {
enable_forward(); // Turn Laser on (Spindle speak but same funct)
TERN_(USE_BEEPER, buzzer.tone(30, 3000));
delay(testPulse); // Delay for time set by user in pulse ms menu screen.
disable(); // Turn laser off
}
#endif
#endif // HAS_LCD_MENU
#if ENABLED(LASER_POWER_INLINE)
/**

View File

@ -52,6 +52,11 @@ typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t;
#endif
#endif
#if ENABLED(LASER_FEATURE)
typedef uint16_t cutter_test_pulse_t;
#define CUTTER_MENU_PULSE_TYPE uint16_3
#endif
#if ENABLED(MARLIN_DEV_MODE)
typedef uint16_t cutter_frequency_t;
#define CUTTER_MENU_FREQUENCY_TYPE uint16_5