diff --git a/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 index 8f61dbb..dbe5f72 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 +++ b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 @@ -1,4 +1,4 @@ -#Thu Apr 04 17:49:31 CEST 2024 +#Thu Apr 04 18:04:54 CEST 2024 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1712238648769 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1712238648773 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1712238648790 @@ -8,13 +8,13 @@ /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1712238648775 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1712238648721 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1712238648782 -/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1712244813410 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1712246527533 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1712238648637 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1712238648826 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1712238648778 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1712238648829 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1712238648730 -/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1712245729354 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1712246689680 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1712238648753 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1712238648629 /home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1712238648760 diff --git a/software/raspberry/superviseur-robot/tasks.cpp b/software/raspberry/superviseur-robot/tasks.cpp index 9fcfe77..5cd4afc 100644 --- a/software/raspberry/superviseur-robot/tasks.cpp +++ b/software/raspberry/superviseur-robot/tasks.cpp @@ -487,13 +487,6 @@ Message *Tasks::ReadInQueue(RT_QUEUE *queue) { /* OUR CODE */ -void Tasks::SendToRobot(MessageID message) -{ - rt_mutex_acquire(&mutex_monitor, TM_INFINITE); - WriteInQueue(&q_messageToMon, new Message(message)); - rt_mutex_release(&mutex_monitor); -} - void Tasks::BatteryStatusTask(void * arg) { // Variables int rs(0); @@ -519,7 +512,10 @@ void Tasks::BatteryStatusTask(void * arg) { getbatterytask = robotBatteryGet; if ((rs != 0) && getbatterytask) { - SendToRobot(MESSAGE_ROBOT_BATTERY_GET); + rt_mutex_acquire(&mutex_robot, TM_INFINITE); + Message* msg = robot.Write(new Message(MESSAGE_ROBOT_BATTERY_GET)); + rt_mutex_release(&mutex_robot); + WriteInQueue(&q_messageToMon, msg); robotBatteryGet = false; getbatterytask = false; } @@ -563,10 +559,10 @@ void Tasks::OpenCamera(void * arg) if(is_opened) { cameraStatus = CameraStatusEnum::OPENED; - SendToRobot(MESSAGE_ANSWER_ACK); + WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK)); } else { - SendToRobot(MESSAGE_ANSWER_NACK); + WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK)); } rt_mutex_release(&mutex_cameraStatus); } @@ -630,7 +626,7 @@ void Tasks::CloseCamera(void * arg) rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE); cameraStatus = CameraStatusEnum::CLOSED; rt_mutex_release(&mutex_cameraStatus); - SendToRobot(MESSAGE_ANSWER_ACK); + WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK)); } } } \ No newline at end of file diff --git a/software/raspberry/superviseur-robot/tasks.h b/software/raspberry/superviseur-robot/tasks.h index 8092d38..7bce596 100644 --- a/software/raspberry/superviseur-robot/tasks.h +++ b/software/raspberry/superviseur-robot/tasks.h @@ -158,7 +158,7 @@ private: void CloseCamera(void * arg); // Utility functions - void SendToRobot(MessageID message); + /**********************************************************************/