31 #define TRACE_LEVEL SUPERVISOR_TASK_TRACE_LEVEL
32 #define LOCAL_TASK_ID SUPERVISOR_TASK_ID
36 using namespace cpp_freertos;
56 #if (ENABLE_STACK_USAGE)
58 void SupervisorTask::TaskMonitorStack()
60 uint16_t stackUsage = (uint16_t)uxTaskGetStackHighWaterMark( NULL );
117 #if (ENABLE_STACK_USAGE)
135 TRACE_ERROR_F(F(
"SUPERVISOR_STATE_INIT -> SUPERVISOR_STATE_CHECK_OPERATION\r\n"));
160 if(system_message.
param != 0) {
205 TRACE_ERROR_F(F(
"SUPERVISOR_STATE_CHECK_OPERATION -> ??? Condizione non gestita!!!\r\n"));
211 TRACE_VERBOSE_F(F(
"SUPERVISOR_STATE_END -> SUPERVISOR_STATE_CHECK_OPERATION\r\n"));
217 #if (ENABLE_STACK_USAGE)
237 bool register_config_valid =
true;
239 static uavcan_register_Value_1_0 val = {0};
244 register_config_valid =
false;
247 TRACE_INFO_F(F(
"SUPERVISOR: Load configuration...\r\n"));
253 if(register_config_valid) {
255 uavcan_register_Value_1_0_select_natural8_(&val);
256 val.natural8.value.count = 3;
264 if(uavcan_register_Value_1_0_is_natural8_(&val) && (val.natural8.value.count != 3)) {
265 register_config_valid =
false;
294 if(register_config_valid) {
296 uavcan_register_Value_1_0_select_natural16_(&val);
297 val.natural16.value.count = 1;
303 if(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count != 1)) {
304 register_config_valid =
false;
314 if(register_config_valid) {
316 uavcan_register_Value_1_0_select_natural16_(&val);
317 val.natural16.value.count = 1;
323 if(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count != 1)) {
324 register_config_valid =
false;
334 if(register_config_valid) {
336 uavcan_register_Value_1_0_select_natural16_(&val);
337 val.natural16.value.count = 1;
343 if(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count != 1)) {
344 register_config_valid =
false;
353 if(!register_config_valid) {
367 static uavcan_register_Value_1_0 val = {0};
373 TRACE_INFO_F(F(
"Required initial default configuration, restore user define value\r\n"));
394 uavcan_register_Value_1_0_select_natural8_(&val);
395 val.natural8.value.count = 3;
409 uavcan_register_Value_1_0_select_natural16_(&val);
410 val.natural16.value.count = 1;
422 uavcan_register_Value_1_0_select_natural16_(&val);
423 val.natural16.value.count = 1;
435 uavcan_register_Value_1_0_select_natural16_(&val);
436 val.natural16.value.count = 1;
446 TRACE_INFO_F(F(
"SUPERVISOR: Save configuration...\r\n"));
448 TRACE_INFO_F(F(
"SUPERVISOR: Init configuration and save parameter...\r\n"));
459 char stima_name[STIMA_MODULE_NAME_LENGTH];
void read(const char *const register_name, uavcan_register_Value_1_0 *const inout_value)
Legge un registro Cypal/Uavcan wrapper UAVCAN (Imposta Default su Set inout_value su value se non esi...
void write(const char *const register_name, const uavcan_register_Value_1_0 *const value)
Store the given register value into the persistent storage.
void TaskState(uint8_t state_position, uint8_t state_subposition, task_flag state_operation)
local suspend flag and positor running state Task (optional)
void saveConfiguration(bool is_default)
Save/Init configuration base Register Class.
void printConfiguration()
Print configuratione.
void loadConfiguration()
Load configuration from Register.
SupervisorTask(const char *taskName, uint16_t stackSize, uint8_t priority, SupervisorParam_t SupervisorParam)
Construct the Supervisor Task::SupervisorTask object.
@ SUPERVISOR_STATE_CREATE
@ SUPERVISOR_STATE_CHECK_OPERATION
virtual void Run()
RUN Task.
void TaskWatchDog(uint32_t millis_standby)
local watchDog and Sleep flag Task (optional)
#define CAN_TASK_ID
CAN task ID.
#define MODULE_MAIN_VERSION
Module main version.
#define WDT_CONTROLLER_MS
Task milliseconds minimal check.
#define MODULE_MINOR_VERSION
Module minor version.
#define SUPERVISOR_TASK_ID
Supervisor task ID.
#define ALL_TASK_ID
All task ID. Send message to ALL Task.
#define RAIN_TIPS_FOR_EVENT
How much mm (scaled RMAP) of rain for one tip of tipping bucket rain gauge.
#define MODULE_TYPE
Type of module. It is defined in registers.h.
#define RAIN_TIPPING_INIBITH_DELAY_MS
Default value for inibith tipping from 2 events.
#define RAIN_TIPPING_DELAY_MS
Default value for sensor acquire task delay tipping.
#define ELABORATE_TASK_ID
Elaborate data task ID.
#define WDT_STARTING_TASK_MS
Init WatchDog Task local milliseconds.
#define ACCELEROMETER_TASK_ID
Accelerometer task ID.
#define UNUSED_SUB_POSITION
Monitor Sub Position not used flag.
#define TRACE_ERROR_F(...)
#define TRACE_INFO_F(...)
#define TRACE_VERBOSE_F(...)
@ set
Set WDT (From Application TASK... All OK)
@ timer
Set Timered WDT (From Application long function WDT...)
task_flag
Task state Flag type.
@ suspended
Task is excluded from WDT Controller or Suspended complete.
@ sleepy
Task is in sleep mode or longer wait (Inform WDT controller)
@ normal
Normal operation Task controller.
struct local elaborate data parameter
system_status_t * system_status
system status pointer struct
EERegister * clRegister
Object Register C++ access.
cpp_freertos::BinarySemaphore * systemStatusLock
Semaphore to system status access.
cpp_freertos::BinarySemaphore * registerAccessLock
Semaphore to register Cyphal access.
configuration_t * configuration
system configuration pointer struct
cpp_freertos::BinarySemaphore * configurationLock
Semaphore to configuration access.
bool is_initialization_request
External require initilizaztion register E2.
cpp_freertos::Queue * systemMessageQueue
Queue for system message.
uint8_t module_type
module type
uint8_t module_main_version
module main version
sensor_configuration_t sensors
sensors configurations
uint8_t module_minor_version
module minor version
uint16_t event_end_time_ms
Time end for tipping event.
uint16_t tipping_bucket_time_ms
Tipping bucket time event.
uint8_t rain_for_tip
Numper of tip for rain measure.
System message for queue.
uint32_t param
32 Bit for generic data or casting to pointer
uint8_t do_maint
Request maintenance (system_status)
uint8_t task_dest
Command struct.
uint8_t do_sleep
Optional param for difference level Sleep.
struct system_message_t::@7 command
bool is_cfg_loaded
Is config loaded.
struct system_status_t::@4 flags
Module error or alert.
uint32_t time_start_maintenance
Starting time for maintenance mode.
task_t tasks[TOTAL_INFO_TASK]
Info Task && WDT.
struct system_status_t::@3 datetime
< DateTime Operation
bool is_maintenance
Module is in maintenance mode.
int32_t watch_dog_ms
WatchDog of Task Timer.
uint8_t running_pos
!=0 (CREATE) Task Started (Generic state of Task)
task_flag state
Long sleep Task.
wdt_flag watch_dog
WatchDog of Task.
uint16_t stack
Stack Max Usage Monitor.
uint8_t running_sub
Optional SubState of Task.
Supervisor module header file.
#define SUPERVISOR_TASK_SLEEP_DELAY_MS
#define SUPERVISOR_AUTO_END_MAINTENANCE_SEC
#define SUPERVISOR_TASK_WAIT_DELAY_MS