feat(nodes): using an explicit thread, as it may cause the huge battery usage
This commit is contained in:
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
#include "supervisor.h"
|
#include "supervisor.h"
|
||||||
|
|
||||||
int main(void){
|
// size of a stack used by the supervisor thread
|
||||||
supervisor_init();
|
#define STACKSIZE 1024
|
||||||
supervisor_run();
|
// scheduling priority used by the supervisor thread
|
||||||
// should never come here
|
#define PRIORITY 7
|
||||||
return 0;
|
|
||||||
}
|
K_THREAD_DEFINE(supervisor_id, STACKSIZE, thread_supervisor, NULL, NULL, NULL, PRIORITY, 0, 0);
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ const int SLEEP_GRANULARITY = 2; // [min]
|
|||||||
const int SLEEP_MIN_DURATION = SLEEP_GRANULARITY; // [min]
|
const int SLEEP_MIN_DURATION = SLEEP_GRANULARITY; // [min]
|
||||||
const int SLEEP_MAX_DURATION = 30; // [min]
|
const int SLEEP_MAX_DURATION = 30; // [min]
|
||||||
|
|
||||||
|
// Zephyr related stuff
|
||||||
|
|
||||||
|
void thread_supervisor(){
|
||||||
|
supervisor_init();
|
||||||
|
supervisor_run();
|
||||||
|
//should never return
|
||||||
|
}
|
||||||
|
|
||||||
|
// supervisor stuff
|
||||||
|
|
||||||
enum error_code supervisor_init(){
|
enum error_code supervisor_init(){
|
||||||
enum error_code ret = init_failed;
|
enum error_code ret = init_failed;
|
||||||
if(
|
if(
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ extern const int SLEEP_GRANULARITY; // [min]
|
|||||||
extern const int SLEEP_MIN_DURATION; // [min]
|
extern const int SLEEP_MIN_DURATION; // [min]
|
||||||
extern const int SLEEP_MAX_DURATION; // [min]
|
extern const int SLEEP_MAX_DURATION; // [min]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief thread function to run the supervisor in zephyr environment
|
||||||
|
*/
|
||||||
|
void thread_supervisor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief init the supervisor, and thus the complete plein_de_ee application
|
* @brief init the supervisor, and thus the complete plein_de_ee application
|
||||||
* @return init_failed upon any error occurring during the initialisation of any module
|
* @return init_failed upon any error occurring during the initialisation of any module
|
||||||
|
|||||||
Reference in New Issue
Block a user