Laser Test Fire (#20452)
This commit is contained in:
parent
d78f2926ec
commit
cf1f8aff77
|
@ -3055,6 +3055,10 @@
|
||||||
#define SPEED_POWER_MAX 100 // (%) 0-100
|
#define SPEED_POWER_MAX 100 // (%) 0-100
|
||||||
#define SPEED_POWER_STARTUP 80 // (%) M3/M4 speed/power default (with no arguments)
|
#define SPEED_POWER_STARTUP 80 // (%) M3/M4 speed/power default (with no arguments)
|
||||||
|
|
||||||
|
// Define the minimum and maximum test pulse time values for a laser test fire function
|
||||||
|
#define LASER_TEST_PULSE_MIN 1 // Used with Laser Control Menu
|
||||||
|
#define LASER_TEST_PULSE_MAX 999 // Caution: Menu may not show more than 3 characters
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable inline laser power to be handled in the planner / stepper routines.
|
* Enable inline laser power to be handled in the planner / stepper routines.
|
||||||
* Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I)
|
* Inline power is specified by the I (inline) flag in an M3 command (e.g., M3 S20 I)
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
|
|
||||||
SpindleLaser cutter;
|
SpindleLaser cutter;
|
||||||
uint8_t SpindleLaser::power;
|
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
|
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
|
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
|
SpindleLaser::unitPower; // LCD status power in PWM, PERCENT, or RPM
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
|
|
||||||
#include "spindle_laser_types.h"
|
#include "spindle_laser_types.h"
|
||||||
|
|
||||||
|
#if USE_BEEPER
|
||||||
|
#include "../libs/buzzer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(LASER_POWER_INLINE)
|
#if ENABLED(LASER_POWER_INLINE)
|
||||||
#include "../module/planner.h"
|
#include "../module/planner.h"
|
||||||
#endif
|
#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_min() { return cpwr_to_upwr(SPEED_POWER_MIN); }
|
||||||
static const cutter_power_t mpower_max() { return cpwr_to_upwr(SPEED_POWER_MAX); }
|
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 bool isReady; // Ready to apply power setting from the UI to OCR
|
||||||
static uint8_t power;
|
static uint8_t power;
|
||||||
|
|
||||||
|
@ -230,7 +238,21 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
#if ENABLED(LASER_POWER_INLINE)
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,6 +52,11 @@ typedef IF<(SPEED_POWER_MAX > 255), uint16_t, uint8_t>::type cutter_cpower_t;
|
||||||
#endif
|
#endif
|
||||||
#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)
|
#if ENABLED(MARLIN_DEV_MODE)
|
||||||
typedef uint16_t cutter_frequency_t;
|
typedef uint16_t cutter_frequency_t;
|
||||||
#define CUTTER_MENU_FREQUENCY_TYPE uint16_5
|
#define CUTTER_MENU_FREQUENCY_TYPE uint16_5
|
||||||
|
|
|
@ -114,6 +114,8 @@ namespace Language_en {
|
||||||
PROGMEM Language_Str MSG_LASER_POWER = _UxGT("Laser Power");
|
PROGMEM Language_Str MSG_LASER_POWER = _UxGT("Laser Power");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Pwr");
|
PROGMEM Language_Str MSG_SPINDLE_POWER = _UxGT("Spindle Pwr");
|
||||||
PROGMEM Language_Str MSG_LASER_TOGGLE = _UxGT("Toggle Laser");
|
PROGMEM Language_Str MSG_LASER_TOGGLE = _UxGT("Toggle Laser");
|
||||||
|
PROGMEM Language_Str MSG_LASER_PULSE_MS = _UxGT("Test Pulse ms");
|
||||||
|
PROGMEM Language_Str MSG_LASER_FIRE_PULSE = _UxGT("Fire Pulse");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_TOGGLE = _UxGT("Toggle Spindle");
|
PROGMEM Language_Str MSG_SPINDLE_TOGGLE = _UxGT("Toggle Spindle");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_FORWARD = _UxGT("Spindle Forward");
|
PROGMEM Language_Str MSG_SPINDLE_FORWARD = _UxGT("Spindle Forward");
|
||||||
PROGMEM Language_Str MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse");
|
PROGMEM Language_Str MSG_SPINDLE_REVERSE = _UxGT("Spindle Reverse");
|
||||||
|
|
|
@ -58,6 +58,12 @@
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(LASER_FEATURE)
|
||||||
|
// Setup and fire a test pulse using the current PWM power level for for a duration of test_pulse_min to test_pulse_max ms.
|
||||||
|
EDIT_ITEM_FAST(CUTTER_MENU_PULSE_TYPE, MSG_LASER_PULSE_MS, &cutter.testPulse, LASER_TEST_PULSE_MIN, LASER_TEST_PULSE_MAX);
|
||||||
|
ACTION_ITEM(MSG_LASER_FIRE_PULSE, cutter.test_fire_pulse);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
|
#if BOTH(MARLIN_DEV_MODE, HAL_CAN_SET_PWM_FREQ) && defined(SPINDLE_LASER_FREQUENCY)
|
||||||
EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency);
|
EDIT_ITEM_FAST(CUTTER_MENU_FREQUENCY_TYPE, MSG_CUTTER_FREQUENCY, &cutter.frequency, 2000, 80000, cutter.refresh_frequency);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue