gestion message erroné dans askBattery et StartWithWatchdog fonctionnel

This commit is contained in:
Romain Vitrat 2020-03-30 17:59:49 +02:00
parent be868ed6f4
commit 6ca9bf556a

View file

@ -404,7 +404,7 @@ void Tasks::ReceiveFromMonTask(void *arg) {
} else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITH_WD)) { } else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITH_WD)) {
cout << "Command Start Robot with Watchdog Received" << endl << flush; cout << "Command Start Robot with Watchdog Received" << endl << flush;
rt_sem_v(&sem_startRobotWithoutWatchdog); rt_sem_v(&sem_startRobotWithWatchdog);
} else if (msgRcv->CompareID(MESSAGE_CAM_ASK_ARENA)) { } else if (msgRcv->CompareID(MESSAGE_CAM_ASK_ARENA)) {
cout << "Command Search Arena Received" << endl << flush; cout << "Command Search Arena Received" << endl << flush;
@ -591,7 +591,9 @@ void Tasks::StartRobotTaskWithWatchdog(void *arg) {
while (killBatteryOk==0) { while (killBatteryOk==0) {
cpt++; cpt++;
if(cpt==2){ if(cpt==2){
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
robot.Write(robot.ReloadWD()); robot.Write(robot.ReloadWD());
rt_mutex_release(&mutex_robot);
cpt=0; cpt=0;
} }
rt_task_wait_period(NULL); rt_task_wait_period(NULL);
@ -656,8 +658,10 @@ void Tasks::AskBattery(void *arg){
rt_mutex_acquire(&mutex_robot, TM_INFINITE); rt_mutex_acquire(&mutex_robot, TM_INFINITE);
p_mess_answer_battery = robot.Write(robot.GetBattery()); p_mess_answer_battery = robot.Write(robot.GetBattery());
rt_mutex_release(&mutex_robot); rt_mutex_release(&mutex_robot);
WriteInQueue(&q_messageToMon, p_mess_answer_battery); if(p_mess_answer_battery->GetID()==MESSAGE_ROBOT_BATTERY_LEVEL){
cout << endl << flush; WriteInQueue(&q_messageToMon, p_mess_answer_battery);
cout << endl << flush;
}
} }
} }