@@ -1034,37 +1034,37 @@ uint8_t gc_execute_line(char *line)
10341034 // refill and can only be resumed by the cycle start run-time command.
10351035 gc_state .modal .program_flow = gc_block .modal .program_flow ;
10361036 if (gc_state .modal .program_flow ) {
1037- protocol_buffer_synchronize (); // Sync and finish all remaining buffered motions before moving on.
1038- if (gc_state .modal .program_flow == PROGRAM_FLOW_PAUSED ) {
1039- if (sys .state != STATE_CHECK_MODE ) {
1040- bit_true_atomic (sys .rt_exec_state , EXEC_FEED_HOLD ); // Use feed hold for program pause.
1041- protocol_execute_realtime (); // Execute suspend.
1042- }
1043- } else { // == PROGRAM_FLOW_COMPLETED
1044- // Upon program complete, only a subset of g-codes reset to certain defaults, according to
1045- // LinuxCNC's program end descriptions and testing. Only modal groups [G-code 1,2,3,5,7,12]
1046- // and [M-code 7,8,9] reset to [G1,G17,G90,G94,G40,G54,M5,M9,M48]. The remaining modal groups
1047- // [G-code 4,6,8,10,13,14,15] and [M-code 4,5,6] and the modal words [F,S,T,H] do not reset.
1048- gc_state .modal .motion = MOTION_MODE_LINEAR ;
1049- gc_state .modal .plane_select = PLANE_SELECT_XY ;
1050- gc_state .modal .distance = DISTANCE_MODE_ABSOLUTE ;
1051- gc_state .modal .feed_rate = FEED_RATE_MODE_UNITS_PER_MIN ;
1052- // gc_state.modal.cutter_comp = CUTTER_COMP_DISABLE; // Not supported.
1053- gc_state .modal .coord_select = 0 ; // G54
1054- gc_state .modal .spindle = SPINDLE_DISABLE ;
1055- gc_state .modal .coolant = COOLANT_DISABLE ;
1056- // gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
1057-
1058- // Execute coordinate change and spindle/coolant stop.
1059- if (sys .state != STATE_CHECK_MODE ) {
1060- if (!(settings_read_coord_data (gc_state .modal .coord_select ,coordinate_data ))) { FAIL (STATUS_SETTING_READ_FAIL ); }
1061- memcpy (gc_state .coord_system ,coordinate_data ,sizeof (coordinate_data ));
1062- spindle_stop ();
1063- coolant_stop ();
1064- }
1065-
1066- report_feedback_message (MESSAGE_PROGRAM_END );
1067- }
1037+ protocol_buffer_synchronize (); // Sync and finish all remaining buffered motions before moving on.
1038+ if (gc_state .modal .program_flow == PROGRAM_FLOW_PAUSED ) {
1039+ if (sys .state != STATE_CHECK_MODE ) {
1040+ bit_true_atomic (sys .rt_exec_state , EXEC_FEED_HOLD ); // Use feed hold for program pause.
1041+ protocol_execute_realtime (); // Execute suspend.
1042+ }
1043+ } else { // == PROGRAM_FLOW_COMPLETED
1044+ // Upon program complete, only a subset of g-codes reset to certain defaults, according to
1045+ // LinuxCNC's program end descriptions and testing. Only modal groups [G-code 1,2,3,5,7,12]
1046+ // and [M-code 7,8,9] reset to [G1,G17,G90,G94,G40,G54,M5,M9,M48]. The remaining modal groups
1047+ // [G-code 4,6,8,10,13,14,15] and [M-code 4,5,6] and the modal words [F,S,T,H] do not reset.
1048+ gc_state .modal .motion = MOTION_MODE_LINEAR ;
1049+ gc_state .modal .plane_select = PLANE_SELECT_XY ;
1050+ gc_state .modal .distance = DISTANCE_MODE_ABSOLUTE ;
1051+ gc_state .modal .feed_rate = FEED_RATE_MODE_UNITS_PER_MIN ;
1052+ // gc_state.modal.cutter_comp = CUTTER_COMP_DISABLE; // Not supported.
1053+ gc_state .modal .coord_select = 0 ; // G54
1054+ gc_state .modal .spindle = SPINDLE_DISABLE ;
1055+ gc_state .modal .coolant = COOLANT_DISABLE ;
1056+ // gc_state.modal.override = OVERRIDE_DISABLE; // Not supported.
1057+
1058+ // Execute coordinate change and spindle/coolant stop.
1059+ if (sys .state != STATE_CHECK_MODE ) {
1060+ if (!(settings_read_coord_data (gc_state .modal .coord_select ,coordinate_data ))) { FAIL (STATUS_SETTING_READ_FAIL ); }
1061+ memcpy (gc_state .coord_system ,coordinate_data ,sizeof (coordinate_data ));
1062+ spindle_stop ();
1063+ coolant_stop ();
1064+ }
1065+
1066+ report_feedback_message (MESSAGE_PROGRAM_END );
1067+ }
10681068 gc_state .modal .program_flow = PROGRAM_FLOW_RUNNING ; // Reset program flow.
10691069 }
10701070
0 commit comments