Skip to content

Commit 1d79d2f

Browse files
authored
Merge pull request #2761 from LinuxCNC/s_code_fix
S code fix
2 parents a15cbdf + 79c0966 commit 1d79d2f

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/emc/motion/command.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,12 +1609,14 @@ void emcmotCommandHandler_locked(void *arg, long servo_period)
16091609
emcmotStatus->spindle_status[n].speed = emcmotCommand->vel;
16101610
emcmotStatus->spindle_status[n].css_factor = emcmotCommand->ini_maxvel;
16111611
emcmotStatus->spindle_status[n].xoffset = emcmotCommand->acc;
1612-
if (emcmotCommand->vel >= 0) {
1613-
emcmotStatus->spindle_status[n].direction = 1;
1614-
} else {
1615-
emcmotStatus->spindle_status[n].direction = -1;
1616-
}
1617-
emcmotStatus->spindle_status[n].brake = 0; //disengage brake
1612+
if (emcmotCommand->state) {
1613+
if (emcmotCommand->vel >= 0) {
1614+
emcmotStatus->spindle_status[n].direction = 1;
1615+
} else {
1616+
emcmotStatus->spindle_status[n].direction = -1;
1617+
}
1618+
emcmotStatus->spindle_status[n].brake = 0; //disengage brake
1619+
}
16181620
apply_spindle_limits(&emcmotStatus->spindle_status[n]);
16191621
}
16201622
emcmotStatus->atspeed_next_feed = emcmotCommand->wait_for_spindle_at_speed;

src/emc/motion/control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ static void output_to_hal(void)
19061906
*(emcmot_hal_data->spindle[spindle_num].spindle_speed_out_abs) = fabs(speed);
19071907
*(emcmot_hal_data->spindle[spindle_num].spindle_speed_out_rps_abs) = fabs(speed / 60);
19081908
*(emcmot_hal_data->spindle[spindle_num].spindle_on) =
1909-
((emcmotStatus->spindle_status[spindle_num].state * speed) !=0) ? 1 : 0;
1909+
((emcmotStatus->spindle_status[spindle_num].state) !=0) ? 1 : 0;
19101910
*(emcmot_hal_data->spindle[spindle_num].spindle_forward) = (speed > 0) ? 1 : 0;
19111911
*(emcmot_hal_data->spindle[spindle_num].spindle_reverse) = (speed < 0) ? 1 : 0;
19121912
*(emcmot_hal_data->spindle[spindle_num].spindle_brake) =

0 commit comments

Comments
 (0)