1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 03:13:25 +02:00

spindles now say if in laser mode

This commit is contained in:
bdring
2020-11-29 17:33:25 -06:00
parent 3105943fd8
commit 46db1472cf
9 changed files with 16 additions and 16 deletions

View File

@@ -473,7 +473,7 @@ Error gc_execute_line(char* line, uint8_t client) {
gc_block.modal.spindle = SpindleState::Cw;
break;
case 4: // Supported if SPINDLE_DIR_PIN is defined or laser mode is on.
if (spindle->is_reversable || laser_mode->get()) {
if (spindle->is_reversable || spindle->inLaserMode()) {
gc_block.modal.spindle = SpindleState::Ccw;
} else {
FAIL(Error::GcodeUnsupportedCommand);
@@ -1290,7 +1290,7 @@ Error gc_execute_line(char* line, uint8_t client) {
return status;
}
// If in laser mode, setup laser power based on current and past parser conditions.
if (laser_mode->get()) {
if (spindle->inLaserMode()) {
if (!((gc_block.modal.motion == Motion::Linear) || (gc_block.modal.motion == Motion::CwArc) ||
(gc_block.modal.motion == Motion::CcwArc))) {
gc_parser_flags |= GCParserLaserDisable;

View File

@@ -96,7 +96,7 @@ bool can_park() {
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
sys.override_ctrl == Override::ParkingMotion &&
#endif
homing_enable->get() && !laser_mode->get();
homing_enable->get() && !spindle->inLaserMode();
}
/*
@@ -558,7 +558,7 @@ static void protocol_exec_rt_suspend() {
restore_spindle_speed = block->spindle_speed;
}
#ifdef DISABLE_LASER_DURING_HOLD
if (laser_mode->get()) {
if (spindle->inLaserMode()) {
sys_rt_exec_accessory_override.bit.spindleOvrStop = true;
}
#endif
@@ -661,7 +661,7 @@ static void protocol_exec_rt_suspend() {
if (gc_state.modal.spindle != SpindleState::Disable) {
// Block if safety door re-opened during prior restore actions.
if (!sys.suspend.bit.restartRetract) {
if (laser_mode->get()) {
if (spindle->inLaserMode()) {
// When in laser mode, ignore spindle spin-up delay. Set to turn on laser when cycle starts.
sys.step_control.updateSpindleRpm = true;
} else {
@@ -717,7 +717,7 @@ static void protocol_exec_rt_suspend() {
} else if (sys.spindle_stop_ovr.bit.restore || sys.spindle_stop_ovr.bit.restoreCycle) {
if (gc_state.modal.spindle != SpindleState::Disable) {
report_feedback_message(Message::SpindleRestore);
if (laser_mode->get()) {
if (spindle->inLaserMode()) {
// When in laser mode, ignore spindle spin-up delay. Set to turn on laser when cycle starts.
sys.step_control.updateSpindleRpm = true;
} else {

View File

@@ -347,7 +347,7 @@ void make_settings() {
startup_line_1 = new StringSetting(GRBL, WG, "N1", "GCode/Line1", "", checkStartupLine);
// GRBL Numbered Settings
laser_mode = new FlagSetting(GRBL, WG, "32", "GCode/LaserMode", DEFAULT_LASER_MODE);
laser_mode = new FlagSetting(GRBL, WG, "32", "GCode/inLaserMode", DEFAULT_LASER_MODE);
laser_full_power = new IntSetting(EXTENDED, WG, NULL, "Laser/FullPower", DEFAULT_LASER_FULL_POWER, 0, 10000, checkSpindleChange);
// TODO Settings - also need to call my_spindle->init();

View File

@@ -24,8 +24,8 @@
// ===================================== Laser ==============================================
namespace Spindles {
bool Laser::isRateAdjusted() {
return true; // can use M4 (CCW) laser mode.
bool Laser::inLaserMode() {
return laser_mode->get(); // can use M4 (CCW) laser mode.
}
void Laser::config_message() {

View File

@@ -34,7 +34,7 @@ namespace Spindles {
Laser& operator=(const Laser&) = delete;
Laser& operator=(Laser&&) = delete;
bool isRateAdjusted() override;
bool inLaserMode() override;
void config_message() override;
void get_pins_and_settings() override;
void deinit() override;

View File

@@ -89,7 +89,7 @@ namespace Spindles {
// ========================= Spindle ==================================
bool Spindle::isRateAdjusted() {
bool Spindle::inLaserMode() {
return false; // default for basic spindle is false
}

View File

@@ -64,7 +64,7 @@ namespace Spindles {
virtual SpindleState get_state() = 0;
virtual void stop() = 0;
virtual void config_message() = 0;
virtual bool isRateAdjusted();
virtual bool inLaserMode();
virtual void sync(SpindleState state, uint32_t rpm);
virtual void deinit();

View File

@@ -273,10 +273,10 @@ namespace Spindles {
}
// Initialization is complete, so now it's okay to run the queue task:
task_active = true;
task_active = true;
if (vfd_cmd_queue != nullptr) {
vfd_cmd_queue = xQueueCreate(VFD_RS485_QUEUE_SIZE, sizeof(ModbusCommand));
}
}
xTaskCreatePinnedToCore(vfd_cmd_task, // task
"vfd_cmdTaskHandle", // name for task
2048, // size of task stack
@@ -324,7 +324,7 @@ namespace Spindles {
#endif
if (laser_mode->get()) {
grbl_msg_sendf(CLIENT_ALL, MsgLevel::Info, "VFD spindle disabled in laser mode. Set $GCode/LaserMode=Off and restart");
grbl_msg_sendf(CLIENT_ALL, MsgLevel::Info, "VFD spindle disabled in laser mode. Set $GCode/inLaserMode=Off and restart");
pins_settings_ok = false;
}

View File

@@ -551,7 +551,7 @@ void st_prep_buffer() {
prep.current_speed = sqrt(pl_block->entry_speed_sqr);
}
if (spindle->isRateAdjusted()) { // laser_mode->get() {
if (spindle->inLaserMode()) { //
if (pl_block->spindle == SpindleState::Ccw) {
// Pre-compute inverse programmed rate to speed up PWM updating per step segment.
prep.inv_rate = 1.0 / pl_block->programmed_rate;