Skip to content

Commit

Permalink
Merge pull request #1397 from bdring/Fix1385
Browse files Browse the repository at this point in the history
Fix1385
  • Loading branch information
bdring authored Dec 10, 2024
2 parents ebc20ea + 748555c commit 7e73b08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 3 additions & 7 deletions FluidNC/esp32/i2s_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,10 @@ static int i2s_out_start() {

static bool timer_running = false;

//
// External functions
//
// i2s_out_delay() is used by synchronous_write(), to ensure that that
// the newly-written data has arrived at the shift register output
void i2s_out_delay() {
// Depending on the timing, it may not be reflected immediately,
// so wait twice as long just in case.
uint32_t wait_counts = timer_running ? FIFO_THRESHOLD + FIFO_RELOAD : 2;
delay_us(I2S_OUT_USEC_PER_PULSE * wait_counts);
delay_us((FIFO_LENGTH + FIFO_RELOAD) * (I2S_OUT_USEC_PER_PULSE / 2));
}

void IRAM_ATTR i2s_out_write(pinnum_t pin, uint8_t val) {
Expand Down
10 changes: 5 additions & 5 deletions FluidNC/src/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ Error gc_execute_line(char* line) {
// NOTE: Pass zero spindle speed for all restricted laser motions.
if (!disableLaser) {
pl_data->spindle_speed = gc_state.spindle_speed; // Record data for planner use.
} // else { pl_data->spindle_speed = 0.0; } // Initialized as zero already.
} // else { pl_data->spindle_speed = 0.0; } // Initialized as zero already.
// [5. Select tool ]: NOT SUPPORTED. Only tracks tool value.
// [M6. Change tool ]:
if (gc_block.modal.tool_change == ToolChange::Enable) {
Expand All @@ -1627,9 +1627,9 @@ Error gc_execute_line(char* line) {
}
if (gc_block.modal.set_tool_number == SetToolNumber::Enable) {
gc_state.selected_tool = gc_block.values.q;
bool stopped_spindle = false; // was spindle stopped via the change
bool new_spindle = false; // was the spindle changed
protocol_buffer_synchronize(); // wait for motion in buffer to finish
bool stopped_spindle = false; // was spindle stopped via the change
bool new_spindle = false; // was the spindle changed
protocol_buffer_synchronize(); // wait for motion in buffer to finish
Spindles::Spindle::switchSpindle(gc_state.selected_tool, Spindles::SpindleFactory::objects(), spindle, stopped_spindle, new_spindle);
if (stopped_spindle) {
gc_block.modal.spindle = SpindleState::Disable;
Expand Down Expand Up @@ -1786,10 +1786,10 @@ Error gc_execute_line(char* line) {
switch (gc_block.non_modal_command) {
case NonModal::SetCoordinateData:
coords[coord_select]->set(coord_data);
gc_wco_changed();
// Update system coordinate system if currently active.
if (gc_state.modal.coord_select == coord_select) {
copyAxes(gc_state.coord_system, coord_data);
gc_wco_changed();
}
break;
case NonModal::GoHome0:
Expand Down

0 comments on commit 7e73b08

Please sign in to comment.