diff --git a/site_ansto/motor_dmc2280.c b/site_ansto/motor_dmc2280.c index 4bf76474..aaa0957d 100644 --- a/site_ansto/motor_dmc2280.c +++ b/site_ansto/motor_dmc2280.c @@ -1677,7 +1677,12 @@ static void DMCState_Idle(pDMC2280Driv self, pEvtEvent event) { } break; case eTimeoutEvent: - /* TODO handle message timeout */ + /* TODO handle message timeout, I don't know what to do here, maybe this'll work. ferdi */ + strncpy(self->lastCmd, event->event.msg.cmd->out_buf, CMDLEN); + self->errorCode = MOTCMDTMO; + self->driver_status = HWFault; + change_state(self, DMCState_MotorHalt); + return; break; } unhandled_event(self, event); @@ -1775,7 +1780,7 @@ static void DMCState_MotorStart(pDMC2280Driv self, pEvtEvent event) { } } while (0); break; - /* TODO: handle halt command */ + /* TODO: handle halt command, can we get a HALT between this and MotorOn? ferdi */ case eTimeoutEvent: /* TODO handle message timeout */ break; @@ -1882,7 +1887,15 @@ static void DMCState_MotorOn(pDMC2280Driv self, pEvtEvent event) { } } while (0); break; - /* TODO: handle halt command */ + /* TODO: handle halt command, Hey Doug is this right? ferdi */ + case eCommandEvent: + switch (event->event.cmd.cmd_type) { + case CMD_HALT: + /* handle halt command, send message */ + change_state(self, DMCState_MotorHalt); + return; + } + break; case eTimeoutEvent: /* TODO handle message timeout */ break; @@ -2250,7 +2263,7 @@ static void DMCState_MotorStop(pDMC2280Driv self, pEvtEvent event) { /* TODO: handle run command */ return; case CMD_HALT: - /* TODO: handle halt command */ + /* TODO: handle halt command, can we get a HALT between this and MotorOff? ferdi */ return; } break; @@ -2284,7 +2297,7 @@ static void DMCState_MotorOff(pDMC2280Driv self, pEvtEvent event) { /* TODO: handle run command */ return; case CMD_HALT: - /* TODO: handle halt command */ + /* TODO: handle halt command, can we get a HALT between this and Idle? ferdi */ return; } break;