Browse Source

gestion message erroné dans askBattery et StartWithWatchdog fonctionnel

Romain Vitrat 4 years ago
parent
commit
6ca9bf556a
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      software/raspberry/superviseur-robot/tasks.cpp

+ 7
- 3
software/raspberry/superviseur-robot/tasks.cpp View File

@@ -404,7 +404,7 @@ void Tasks::ReceiveFromMonTask(void *arg) {
404 404
             
405 405
         } else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITH_WD)) {
406 406
             cout << "Command Start Robot with Watchdog Received" << endl << flush;
407
-            rt_sem_v(&sem_startRobotWithoutWatchdog);
407
+            rt_sem_v(&sem_startRobotWithWatchdog);
408 408
 
409 409
         } else if (msgRcv->CompareID(MESSAGE_CAM_ASK_ARENA)) {
410 410
             cout << "Command Search Arena Received" << endl << flush;
@@ -591,7 +591,9 @@ void Tasks::StartRobotTaskWithWatchdog(void *arg) {
591 591
         while (killBatteryOk==0) {
592 592
             cpt++;
593 593
             if(cpt==2){
594
+                rt_mutex_acquire(&mutex_robot, TM_INFINITE);
594 595
                 robot.Write(robot.ReloadWD());
596
+                rt_mutex_release(&mutex_robot);
595 597
                 cpt=0;
596 598
             }
597 599
             rt_task_wait_period(NULL);
@@ -656,8 +658,10 @@ void Tasks::AskBattery(void *arg){
656 658
         rt_mutex_acquire(&mutex_robot, TM_INFINITE);
657 659
         p_mess_answer_battery = robot.Write(robot.GetBattery());
658 660
         rt_mutex_release(&mutex_robot);
659
-        WriteInQueue(&q_messageToMon, p_mess_answer_battery);
660
-        cout << endl << flush;
661
+        if(p_mess_answer_battery->GetID()==MESSAGE_ROBOT_BATTERY_LEVEL){
662
+            WriteInQueue(&q_messageToMon, p_mess_answer_battery);
663
+            cout << endl << flush;
664
+        }
661 665
     }
662 666
 }
663 667
 

Loading…
Cancel
Save