Compare commits

..

No commits in common. "636f0092749d94027f8a17137084a358479afbdb" and "9f2301699b2c45c6c7d2bf6aefc6ea5668bcb0b0" have entirely different histories.

2 changed files with 4 additions and 9 deletions

View file

@ -97,10 +97,6 @@ void Tasks::Init() {
cerr << "Error semaphore create sem_serverOk: " << strerror(-err) << endl;
exit(EXIT_FAILURE);
}
if ((err = rt_sem_create(&sem_openComRobot, nullptr, 0, S_FIFO))) {
cerr << "Error semaphore create sem_openComRobot: " << strerror(-err) << endl;
exit(EXIT_FAILURE);
}
if ((err = rt_sem_create(&sem_startRobot, nullptr, 0, S_FIFO))) {
cerr << "Error semaphore create sem_startRobot: " << strerror(-err) << endl;
exit(EXIT_FAILURE);
@ -308,7 +304,7 @@ void Tasks::Join() {
rt_sem_v(&sem_stopServer);
lostConnection = true;
} else if (msgRcv->CompareID(MESSAGE_ROBOT_COM_OPEN)) {
rt_sem_v(&sem_openComRobot);
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK));
} else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITHOUT_WD)) {
rt_mutex_acquire(&mutex_watchdogMode, TM_INFINITE);
watchdogMode = WITHOUT_WATCHDOG;
@ -365,7 +361,7 @@ void Tasks::Join() {
* *************************************************************************************/
while (true) {
Message *msgSend;
rt_sem_p(&sem_openComRobot, TM_INFINITE);
rt_sem_p(&sem_startRobot, TM_INFINITE);
cout << "Open serial com (";
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
status = robot.Open();
@ -376,8 +372,6 @@ void Tasks::Join() {
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK)); // msgSend will be deleted by sendToMon
} else {
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK)); // msgSend will be deleted by sendToMon
rt_sem_p(&sem_startRobot, TM_INFINITE);
rt_mutex_acquire(&mutex_watchdogMode, TM_INFINITE);
const WatchdogMode mode = watchdogMode;
rt_mutex_release(&mutex_watchdogMode);
@ -436,6 +430,7 @@ void Tasks::Join() {
while (true) {
rt_task_wait_period(nullptr);
cout << "Periodic battery level update" << endl;
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
rs = robotStarted;
@ -473,6 +468,7 @@ void Tasks::Join() {
while (true) {
rt_task_wait_period(nullptr);
cout << "Periodic movement update" << endl;
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
rs = robotStarted;
rt_mutex_release(&mutex_robotStarted);

View file

@ -98,7 +98,6 @@ private:
* ********************************************************************/
RT_SEM sem_barrier;
RT_SEM sem_serverOk;
RT_SEM sem_openComRobot;
RT_SEM sem_startRobot;
RT_SEM sem_stopRobot;
RT_SEM sem_stopServer;