This commit is contained in:
Romain Vitrat 2020-03-31 17:07:54 +02:00
parent 19cefe3563
commit c5892bacc9

View file

@ -656,9 +656,8 @@ void Tasks::StartRobotTaskWithoutWatchdog(void *arg) {
void Tasks::StartRobotTaskWithWatchdog(void *arg) { void Tasks::StartRobotTaskWithWatchdog(void *arg) {
int killBatteryOk=0; int killBatteryOk=0;
int cpt=1; int cpt=0;
Message * msgSend; Message * msgSend;
int err;
while(1){ while(1){
@ -697,11 +696,13 @@ 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(MESSAGE_ROBOT_RELOAD_WD);
rt_mutex_release(&mutex_robot);
cpt=0; cpt=0;
} }
rt_task_wait_period(NULL); rt_task_wait_period(NULL);
rt_sem_v(&sem_askBattery); rt_sem_v(&sem_askBattery);
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE); rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
killBatteryOk=killBattery; killBatteryOk=killBattery;
rt_mutex_release(&mutex_killBattery); rt_mutex_release(&mutex_killBattery);