保留多主轴 spindle canon selector
This commit is contained in:
@@ -211,10 +211,10 @@ void SET_FEED_RATE(double rate) {
|
||||
}
|
||||
}
|
||||
|
||||
void SET_SPINDLE_SPEED(int, double speed) {
|
||||
void SET_SPINDLE_SPEED(int spindle, double speed) {
|
||||
trace_call("SET_SPINDLE_SPEED");
|
||||
if (active_sink) {
|
||||
active_sink->set_spindle_speed(speed, event_line());
|
||||
active_sink->set_spindle_speed(spindle, speed, event_line());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,21 +486,21 @@ void SET_SPINDLE_MODE(int spindle, double mode) {
|
||||
void SPINDLE_RETRACT_TRAVERSE() {
|
||||
}
|
||||
|
||||
void START_SPINDLE_CLOCKWISE(int, int) {
|
||||
void START_SPINDLE_CLOCKWISE(int spindle, int) {
|
||||
if (active_sink) {
|
||||
active_sink->start_spindle(1, event_line());
|
||||
active_sink->start_spindle(spindle, 1, event_line());
|
||||
}
|
||||
}
|
||||
|
||||
void START_SPINDLE_COUNTERCLOCKWISE(int, int) {
|
||||
void START_SPINDLE_COUNTERCLOCKWISE(int spindle, int) {
|
||||
if (active_sink) {
|
||||
active_sink->start_spindle(-1, event_line());
|
||||
active_sink->start_spindle(spindle, -1, event_line());
|
||||
}
|
||||
}
|
||||
|
||||
void STOP_SPINDLE_TURNING(int) {
|
||||
void STOP_SPINDLE_TURNING(int spindle) {
|
||||
if (active_sink) {
|
||||
active_sink->stop_spindle(event_line());
|
||||
active_sink->stop_spindle(spindle, event_line());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,13 @@ CNC_SIM_RS274_VAR="$var_file" \
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_spindle_direction.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_spindle_direction.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc init reads
|
||||
# [TRAJ] SPINDLES from INI_FILE_NAME, interp_execute.cc passes S-word $
|
||||
# through convert_speed(), and interp_convert.cc routes M3/M4/M5 with a $
|
||||
# selector to the selected spindle.
|
||||
INI_FILE_NAME="$multi_spindle_modes_file" CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_multi_spindle_direction.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_multi_spindle_direction.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_spindle_modes.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_spindle_modes.json"
|
||||
@@ -1789,6 +1796,24 @@ if (3, 1200, 2) not in spindle_states:
|
||||
if (4, 0, 0) not in spindle_states:
|
||||
raise SystemExit("missing source-linked M5 stopped spindle state")
|
||||
|
||||
multi_spindle_direction = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_multi_spindle_direction.json").read_text())
|
||||
multi_spindle_direction_states = [
|
||||
(event["line"], event["tool"], event["spindle"], event["reserved"])
|
||||
for event in multi_spindle_direction
|
||||
if event["type"] == "set-spindle" and event["line"] in {5, 6, 7, 8}
|
||||
]
|
||||
expected_multi_spindle_direction_states = [
|
||||
(5, 1, 1200, 0),
|
||||
(6, 1, 1200, 1),
|
||||
(7, 1, 1200, 2),
|
||||
(8, 1, 0, 0),
|
||||
]
|
||||
if multi_spindle_direction_states != expected_multi_spindle_direction_states:
|
||||
raise SystemExit(
|
||||
"unexpected source-linked selected-spindle M3/M4/M5 states: "
|
||||
f"{multi_spindle_direction_states!r}"
|
||||
)
|
||||
|
||||
spindle_modes = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_spindle_modes.json").read_text())
|
||||
spindle_mode_states = [
|
||||
(event["line"], event["reserved"], event["feed"], event["tool"])
|
||||
@@ -3655,6 +3680,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_basic_mill.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_incremental_and_r_arc.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_rtcp_controls.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_spindle_direction.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_multi_spindle_direction.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_spindle_modes.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_spindle_orient.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_io_controls.json"
|
||||
|
||||
9
tests/gcode/linuxcnc_multi_spindle_direction.ngc
Normal file
9
tests/gcode/linuxcnc_multi_spindle_direction.ngc
Normal file
@@ -0,0 +1,9 @@
|
||||
G21 G90 G17
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc init reads [TRAJ] SPINDLES from INI_FILE_NAME.)
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/interp_execute.cc passes S-word $ through convert_speed.)
|
||||
(Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc M3/M4/M5 with $ selects a specific spindle.)
|
||||
S1200 $1
|
||||
M3 $1
|
||||
M4 $1
|
||||
M5 $1
|
||||
M30
|
||||
Reference in New Issue
Block a user