@@ -253,7 +253,7 @@ static int emcIoNmlGet()
253253 emcioStatus.heartbeat = 0 ;
254254 emcioStatus.command_type = 0 ;
255255 emcioStatus.echo_serial_number = 0 ;
256- emcioStatus.status = RCS_DONE ;
256+ emcioStatus.status = RCS_STATUS::DONE ;
257257 emcioStatusBuffer->write (&emcioStatus);
258258 }
259259 }
@@ -515,7 +515,7 @@ void load_tool(int idx) {
515515 }
516516
517517 if (0 != tooldata_save (io_tool_table_file)) {
518- emcioStatus.status = RCS_ERROR ;
518+ emcioStatus.status = RCS_STATUS::ERROR ;
519519 }
520520 } else if (idx == 0 ) {
521521 // magic T0 = pocket 0 = no tool
@@ -736,14 +736,14 @@ static void do_hal_exit(void) {
736736}
737737
738738
739- static void update_status (int status, int serial)
739+ static void update_status (RCS_STATUS status, int serial)
740740{
741- static int status_reported = - 1 ;
741+ static RCS_STATUS status_reported = RCS_STATUS::UNINITIALIZED ;
742742
743743 emcioStatus.status = status;
744744 if (status_reported != status) {
745745 rtapi_print_msg (RTAPI_MSG_DBG, " %s: updating status=%s state=%s fault=%d reason=%d\n " ,
746- progname,strcs[emcioStatus.status ],strstate[*(iocontrol_data->state )],
746+ progname,strcs[( int ) emcioStatus.status ],strstate[*(iocontrol_data->state )],// BUG: array accessed at -1 when status is RCS_STATUS::UNINITIALIZED
747747 emcioStatus.fault , emcioStatus.reason
748748 );
749749 status_reported = emcioStatus.status ; // just print this once
@@ -919,11 +919,11 @@ int main(int argc, char *argv[])
919919 rtapi_print_msg (RTAPI_MSG_DBG, " %s:lube_level changed to %d\n " ,progname,emcioStatus.lube .level );
920920
921921 // need for different serial number, because we are pushing a new message
922- update_status (RCS_DONE , emcioCommand->serial_number + 1 );
922+ update_status (RCS_STATUS::DONE , emcioCommand->serial_number + 1 );
923923 }
924924
925925 if (input_status & (TI_PREPARING)) {
926- update_status (RCS_EXEC , emcioCommand->serial_number );
926+ update_status (RCS_STATUS::EXEC , emcioCommand->serial_number );
927927 }
928928
929929 if (input_status & (TI_START_CHANGE|TI_CHANGING)) {
@@ -934,15 +934,15 @@ int main(int argc, char *argv[])
934934 strstate[*(iocontrol_data->state )],
935935 str_input (input_status)
936936 );
937- update_status (RCS_ERROR , emcioCommand->serial_number );
937+ update_status (RCS_STATUS::ERROR , emcioCommand->serial_number );
938938 } else {
939- update_status (RCS_EXEC , emcioCommand->serial_number );
939+ update_status (RCS_STATUS::EXEC , emcioCommand->serial_number );
940940 }
941941 }
942942
943943 // if (input_status & (TI_PREPARE_COMPLETE|TI_CHANGE_COMPLETE|TI_START_CHANGE_ACKED|TI_EMC_ABORT_ACKED))
944944 if (input_status & (TI_PREPARE_COMPLETE|TI_CHANGE_COMPLETE|TI_START_CHANGE_ACKED)) {
945- update_status (RCS_DONE , emcioCommand->serial_number );
945+ update_status (RCS_STATUS::DONE , emcioCommand->serial_number );
946946 }
947947
948948 /* read NML, run commands */
@@ -970,7 +970,7 @@ int main(int argc, char *argv[])
970970 * to cause an abort, set emcioStatus.reason and
971971 * emcioStatus.status to RCS_ERROR.
972972 */
973- emcioStatus.status = RCS_DONE ;
973+ emcioStatus.status = RCS_STATUS::DONE ;
974974 type = emcioCommand->type ;
975975
976976 switch (type) {
@@ -1061,7 +1061,7 @@ int main(int argc, char *argv[])
10611061
10621062 // delay fetching the next message until prepare done
10631063 if (!(input_status & TI_PREPARE_COMPLETE)) {
1064- emcioStatus.status = RCS_EXEC ;
1064+ emcioStatus.status = RCS_STATUS::EXEC ;
10651065 }
10661066 }
10671067 }
@@ -1093,7 +1093,7 @@ int main(int argc, char *argv[])
10931093
10941094 // delay fetching the next message until change done
10951095 if (! (input_status & TI_CHANGE_COMPLETE)) {
1096- emcioStatus.status = RCS_EXEC ;
1096+ emcioStatus.status = RCS_STATUS::EXEC ;
10971097 }
10981098 }
10991099 break ;
@@ -1106,7 +1106,7 @@ int main(int argc, char *argv[])
11061106 *(iocontrol_data->state ) = ST_START_CHANGE;
11071107 // delay fetching the next message until ack line seen
11081108 if (! (input_status & TI_START_CHANGE_ACKED)) {
1109- emcioStatus.status = RCS_EXEC ;
1109+ emcioStatus.status = RCS_STATUS::EXEC ;
11101110 }
11111111 }
11121112 break ;
@@ -1123,7 +1123,7 @@ int main(int argc, char *argv[])
11231123 if (!strlen (filename)) filename = io_tool_table_file;
11241124 rtapi_print_msg (RTAPI_MSG_DBG, " EMC_TOOL_LOAD_TOOL_TABLE\n " );
11251125 if (0 != tooldata_load (filename)) {
1126- emcioStatus.status = RCS_ERROR ;
1126+ emcioStatus.status = RCS_STATUS::ERROR ;
11271127 } else {
11281128 reload_tool_number (emcioStatus.tool .toolInSpindle );
11291129 }
@@ -1163,7 +1163,7 @@ int main(int argc, char *argv[])
11631163 UNEXPECTED_MSG;
11641164 }
11651165 if (0 != tooldata_save (io_tool_table_file)) {
1166- emcioStatus.status = RCS_ERROR ;
1166+ emcioStatus.status = RCS_STATUS::ERROR ;
11671167 }
11681168 if (io_db_mode == DB_ACTIVE) {
11691169 int pno = idx; // for random_toolchanger
0 commit comments