From 6ca9bf556a3499318f5e3faa9c9bb7276ead369c Mon Sep 17 00:00:00 2001 From: vitrat Date: Mon, 30 Mar 2020 17:59:49 +0200 Subject: [PATCH] =?UTF-8?q?gestion=20message=20erron=C3=A9=20dans=20askBat?= =?UTF-8?q?tery=20et=20StartWithWatchdog=20fonctionnel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- software/raspberry/superviseur-robot/tasks.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/software/raspberry/superviseur-robot/tasks.cpp b/software/raspberry/superviseur-robot/tasks.cpp index 770ed3c..ae5b94d 100644 --- a/software/raspberry/superviseur-robot/tasks.cpp +++ b/software/raspberry/superviseur-robot/tasks.cpp @@ -404,7 +404,7 @@ void Tasks::ReceiveFromMonTask(void *arg) { } else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITH_WD)) { 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)) { cout << "Command Search Arena Received" << endl << flush; @@ -591,7 +591,9 @@ void Tasks::StartRobotTaskWithWatchdog(void *arg) { while (killBatteryOk==0) { cpt++; if(cpt==2){ + rt_mutex_acquire(&mutex_robot, TM_INFINITE); robot.Write(robot.ReloadWD()); + rt_mutex_release(&mutex_robot); cpt=0; } rt_task_wait_period(NULL); @@ -656,8 +658,10 @@ void Tasks::AskBattery(void *arg){ rt_mutex_acquire(&mutex_robot, TM_INFINITE); p_mess_answer_battery = robot.Write(robot.GetBattery()); rt_mutex_release(&mutex_robot); - WriteInQueue(&q_messageToMon, p_mess_answer_battery); - cout << endl << flush; + if(p_mess_answer_battery->GetID()==MESSAGE_ROBOT_BATTERY_LEVEL){ + WriteInQueue(&q_messageToMon, p_mess_answer_battery); + cout << endl << flush; + } } }