Moved sleep regulating update rate of rtx task from rtx thread to OpMode implementations, as each operating mode may require a custom update rate

This commit is contained in:
Silvano Seva 2021-08-29 16:57:54 +02:00
parent bad5a50d7d
commit e954f3fda2
4 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#ifndef OPMODE_H #ifndef OPMODE_H
#define OPMODE_H #define OPMODE_H
#include <interfaces/delays.h>
#include "rtx.h" #include "rtx.h"
/** /**
@ -75,6 +76,7 @@ public:
{ {
(void) status; (void) status;
(void) newCfg; (void) newCfg;
sleepFor(0u, 30u);
} }
/** /**

View File

@ -192,4 +192,7 @@ void OpMode_FM::update(rtxStatus_t *const status, const bool newCfg)
platform_ledOff(RED); platform_ledOff(RED);
break; break;
} }
// Sleep thread for 30ms for 33Hz update rate
sleepFor(0u, 30u);
} }

View File

@ -19,6 +19,7 @@
***************************************************************************/ ***************************************************************************/
#include <interfaces/platform.h> #include <interfaces/platform.h>
#include <interfaces/delays.h>
#include <interfaces/audio.h> #include <interfaces/audio.h>
#include <interfaces/radio.h> #include <interfaces/radio.h>
#include <OpMode_M17.h> #include <OpMode_M17.h>
@ -53,6 +54,7 @@ void OpMode_M17::update(rtxStatus_t *const status, const bool newCfg)
if(status->opStatus == RX) if(status->opStatus == RX)
{ {
// TODO: Implement M17 Rx // TODO: Implement M17 Rx
sleepFor(0u, 30u);
} }
else if((status->opStatus == OFF) && enterRx) else if((status->opStatus == OFF) && enterRx)
{ {

View File

@ -262,7 +262,6 @@ void *rtx_task(void *arg)
while(1) while(1)
{ {
rtx_taskFunc(); rtx_taskFunc();
sleepFor(0u, 30u);
} }
} }