30 #define TRACE_LEVEL CAN_TASK_TRACE_LEVEL
31 #define LOCAL_TASK_ID CAN_TASK_ID
35 using namespace cpp_freertos;
50 delayMicroseconds(10);
55 if (canPower == ModeCan)
return;
59 delayMicroseconds(10);
63 delayMicroseconds(90);
68 delayMicroseconds(10);
74 delayMicroseconds(10);
87 void CanTask::getUniqueID(uint8_t out[uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_], uint64_t serNumb)
91 static uavcan_register_Value_1_0 val = {0};
92 uavcan_register_Value_1_0_select_unstructured_(&val);
95 uint8_t *ptrData = (uint8_t*)&serNumb;
96 for (uint8_t i = 0; i < 8; i++)
98 val.unstructured.value.elements[val.unstructured.value.count++] = ptrData[i];
101 for (uint8_t i = val.unstructured.value.count; i < uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_; i++)
103 val.unstructured.value.elements[val.unstructured.value.count++] = (uint8_t) rand();
105 localRegisterAccessLock->Take();
107 localRegisterAccessLock->Give();
108 LOCAL_ASSERT(uavcan_register_Value_1_0_is_unstructured_(&val) &&
109 val.unstructured.value.count == uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_);
110 memcpy(&out[0], &val.unstructured.value, uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_);
120 char register_name[uavcan_register_Name_1_0_name_ARRAY_CAPACITY_] = {0};
122 switch (modeAccessID) {
123 case canardClass::Introspection_Port::PublisherSubjectID:
124 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.pub.%s.id", port_name);
126 case canardClass::Introspection_Port::SubscriptionSubjectID:
127 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.sub.%s.id", port_name);
129 case canardClass::Introspection_Port::ClientPortID:
130 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.cln.%s.id", port_name);
132 case canardClass::Introspection_Port::ServicePortID:
133 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.srv.%s.id", port_name);
138 static uavcan_register_Value_1_0 val = {0};
139 uavcan_register_Value_1_0_select_natural16_(&val);
140 val.natural16.value.count = 1;
141 val.natural16.value.elements[0] = UINT16_MAX;
144 localRegisterAccessLock->Take();
145 localRegister->read(®ister_name[0], &val);
146 localRegisterAccessLock->Give();
147 LOCAL_ASSERT(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count == 1));
148 const uint16_t result = val.natural16.value.elements[0];
155 switch (modeAccessID) {
156 case canardClass::Introspection_Port::PublisherSubjectID:
157 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.pub.%s.type", port_name);
159 case canardClass::Introspection_Port::SubscriptionSubjectID:
160 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.sub.%s.type", port_name);
162 case canardClass::Introspection_Port::ClientPortID:
163 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.cln.%s.type", port_name);
165 case canardClass::Introspection_Port::ServicePortID:
166 snprintf(®ister_name[0],
sizeof(register_name),
"uavcan.srv.%s.type", port_name);
170 uavcan_register_Value_1_0_select_string_(&val);
171 val._string.value.count = nunavutChooseMin(strlen(type_name), uavcan_primitive_String_1_0_value_ARRAY_CAPACITY_);
172 memcpy(&val._string.value.elements[0], type_name, val._string.value.count);
173 localRegisterAccessLock->Take();
174 localRegister->read(®ister_name[0], &val);
175 localRegisterAccessLock->Give();
187 bool CanTask::putFlashFile(
const char*
const file_name,
const bool is_firmware,
const bool rewrite,
void* buf,
size_t count)
189 #ifdef CHECK_FLASH_WRITE
199 localQspiLock->Give();
205 localQspiLock->Give();
219 TRACE_INFO_F(F(
"FLASH: Erase block: %d\r\n"), canFlashBlock);
220 if (localFlash->BSP_QSPI_Erase_Block(canFlashBlock)) {
221 localQspiLock->Give();
226 memcpy(file_flash_name, file_name, strlen(file_name));
230 #ifdef CHECK_FLASH_WRITE
236 localQspiLock->Give();
242 localQspiLock->Give();
252 TRACE_INFO_F(F(
"FLASH: Write [ %d ] bytes at addr: %d\r\n"), count, canFlashPtr);
254 localFlash->BSP_QSPI_Write((uint8_t*)buf, canFlashPtr, count);
255 #ifdef CHECK_FLASH_WRITE
256 localFlash->BSP_QSPI_Read(check_data, canFlashPtr, count);
257 if(memcmp(buf, check_data, count)==0) {
261 localQspiLock->Give();
265 canFlashPtr += count;
270 TRACE_INFO_F(F(
"FLASH: Erase block: %d\r\n"), canFlashBlock);
271 if (localFlash->BSP_QSPI_Erase_Block(canFlashBlock)) {
272 localQspiLock->Give();
292 #ifdef CHECK_FLASH_WRITE
301 localQspiLock->Give();
315 bool fileReady =
false;
321 localQspiLock->Give();
325 if (localFlash->BSP_QSPI_GetStatus()) {
326 localQspiLock->Give();
332 char stima_name[STIMA_MODULE_NAME_LENGTH] = {0};
334 if(checkStimaFirmwareType((
char*)block, module_type, version, revision)) {
338 localQspiLock->Give();
360 case canardClass::Sensor_Type::tbr:
362 rmap_data->TBR.rain.val.value = report->
rain;
363 rmap_data->TBR.rain.confidence.value = report->
quality;
365 case canardClass::Sensor_Type::tpr:
368 rmap_data->TPR.shortRate.confidence.value = report->
quality;
370 rmap_data->TPR.longRate.confidence.value = report->
quality;
372 case canardClass::Sensor_Type::tbm:
374 rmap_data->TBR.rain.val.value = report->
rain_full;
375 rmap_data->TBR.rain.confidence.value = report->
quality;
382 case canardClass::Sensor_Type::tbr:
384 rmap_data->TBR.rain.val.value = report->
rain;
385 rmap_data->TBR.rain.confidence.value = report->
quality;
387 case canardClass::Sensor_Type::tpr:
390 rmap_data->TPR.shortRate.confidence.value = report->
quality;
392 rmap_data->TPR.longRate.confidence.value = report->
quality;
394 case canardClass::Sensor_Type::tbm:
396 rmap_data->TBR.rain.val.value = report->
rain_full;
397 rmap_data->TBR.rain.confidence.value = report->
quality;
411 rmap_module_Rain_1_0 module_rain_msg = {0};
413 request_data_t request_data = {0};
419 request_data.is_init =
false;
420 request_data.report_time_s = last_req_rpt_time;
421 request_data.observation_time_s = last_req_obs_time;
424 clCanard.
module_rain.TBR.metadata.timerange.P2 = request_data.report_time_s;
425 clCanard.
module_rain.TPR.metadata.timerange.P2 = request_data.report_time_s;
435 prepareSensorsDataValue(canardClass::Sensor_Type::tbr, &report_pub, &module_rain_msg);
436 prepareSensorsDataValue(canardClass::Sensor_Type::tpr, &report_pub, &module_rain_msg);
438 module_rain_msg.TBR.metadata = clCanard.
module_rain.TBR.metadata;
439 module_rain_msg.TPR.metadata = clCanard.
module_rain.TPR.metadata;
442 uint8_t serialized[rmap_module_Rain_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
443 size_t serialized_size =
sizeof(serialized);
444 const int8_t err = rmap_module_Rain_1_0_serialize_(&module_rain_msg, &serialized[0], &serialized_size);
447 const CanardTransferMetadata meta = {
448 .priority = CanardPrioritySlow,
449 .transfer_kind = CanardTransferKindMessage,
451 .remote_node_id = CANARD_NODE_ID_UNSET,
455 clCanard.
send(
MEGA / 4, &meta, serialized_size, &serialized[0]);
472 const uavcan_pnp_NodeIDAllocationData_1_0*
const msg) {
479 if (msg->unique_id_hash == local_hash) {
480 if (msg->allocated_node_id.elements[0].value <= CANARD_NODE_ID_MAX) {
481 printf(
"Got PnP node-ID allocation: %d\n", msg->allocated_node_id.elements[0].value);
486 static uavcan_register_Value_1_0 reg = {0};
487 uavcan_register_Value_1_0_select_natural16_(®);
488 reg.natural16.value.elements[0] = msg->allocated_node_id.elements[0].value;
489 reg.natural16.value.count = 1;
490 localRegisterAccessLock->Take();
492 localRegisterAccessLock->Give();
495 uavcan_pnp_NodeIDAllocationData_1_0_FIXED_PORT_ID_);
507 uint8_t remote_node) {
508 uavcan_node_ExecuteCommand_Response_1_1 resp = {0};
518 switch (req->command)
522 case uavcan_node_ExecuteCommand_Request_1_1_COMMAND_BEGIN_SOFTWARE_UPDATE:
526 req->parameter.count,
true);
531 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
534 case uavcan_node_ExecuteCommand_Request_1_1_COMMAND_FACTORY_RESET:
536 localRegisterAccessLock->Take();
537 localRegister->doFactoryReset();
538 localRegisterAccessLock->Give();
541 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
544 case uavcan_node_ExecuteCommand_Request_1_1_COMMAND_RESTART:
547 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
550 case uavcan_node_ExecuteCommand_Request_1_1_COMMAND_STORE_PERSISTENT_STATES:
555 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
560 case canardClass::Command_Private::download_file:
564 req->parameter.count,
false);
569 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
572 case canardClass::Command_Private::calibrate_accelerometer:
575 TRACE_INFO_F(F(
"AVVIA Calibrazione accelerometro e salvataggio parametri\r\n"));
580 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
582 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_FAILURE;
586 case canardClass::Command_Private::module_maintenance:
589 if(req->parameter.elements[0]) {
590 TRACE_INFO_F(F(
"AVVIA modalità di manutenzione modulo\r\n"));
592 TRACE_INFO_F(F(
"ARRESTA modalità di manutenzione modulo\r\n"));
597 system_message.
param = req->parameter.elements[0];
599 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
601 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_FAILURE;
605 case canardClass::Command_Private::reset_flags:
608 TRACE_INFO_F(F(
"RESET flags di sistema e salvataggio stati\r\n"));
610 boot_state->tot_reset = 0;
611 boot_state->wdt_reset = 0;
614 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
617 case canardClass::Command_Private::enable_publish_rmap:
621 TRACE_INFO_F(F(
"ATTIVO Trasmissione dati in publish\r\n"));
622 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
625 case canardClass::Command_Private::disable_publish_rmap:
629 TRACE_INFO_F(F(
"DISATTIVO Trasmissione dati in publish\r\n"));
630 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
633 case canardClass::Command_Private::enable_publish_port_list:
637 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
640 case canardClass::Command_Private::disable_publish_port_list:
644 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_SUCCESS;
647 case canardClass::Command_Private::remote_test:
650 resp.status = canardClass::Command_Private::remote_test_value;
655 resp.status = uavcan_node_ExecuteCommand_Response_1_1_STATUS_BAD_COMMAND;
668 rmap_service_module_Rain_Response_1_0 resp = {0};
674 request_data_t request_data = {0};
676 bool isRunIdleHookEnabled;
679 switch (req->parameter.command) {
683 case rmap_service_setmode_1_0_get_istant:
684 case rmap_service_setmode_1_0_get_current:
685 case rmap_service_setmode_1_0_get_last:
688 if(req->parameter.command == rmap_service_setmode_1_0_get_istant) {
690 request_data.is_init =
false;
691 request_data.report_time_s = 0;
692 request_data.observation_time_s = 0;
694 if((req->parameter.command == rmap_service_setmode_1_0_get_current)||
695 (req->parameter.command == rmap_service_setmode_1_0_get_last)) {
697 if(req->parameter.command == rmap_service_setmode_1_0_get_current)
698 request_data.is_init =
false;
700 request_data.is_init =
true;
701 request_data.report_time_s = req->parameter.run_sectime;
702 request_data.observation_time_s = req->parameter.obs_sectime;
703 last_req_rpt_time = req->parameter.run_sectime;
704 last_req_obs_time = req->parameter.obs_sectime;
706 clCanard.
module_rain.TBR.metadata.timerange.P2 = request_data.report_time_s;
707 clCanard.
module_rain.TPR.metadata.timerange.P2 = request_data.report_time_s;
711 resp.rbt_event = boot_state->tot_reset;
712 resp.wdt_event = boot_state->wdt_reset;
715 isRunIdleHookEnabled = LowPower.isIdleHookEnabled();
716 LowPower.idleHookDisable();
720 if(isRunIdleHookEnabled) LowPower.idleHookEnable();
733 resp.state = req->parameter.command;
739 if(req->parameter.command == rmap_service_setmode_1_0_get_istant) {
741 prepareSensorsDataValue(canardClass::Sensor_Type::tbm, &report_srv, &resp);
743 prepareSensorsDataValue(canardClass::Sensor_Type::tbr, &report_srv, &resp);
744 prepareSensorsDataValue(canardClass::Sensor_Type::tpr, &report_srv, &resp);
757 case rmap_service_setmode_1_0_test_acq:
758 resp.state = req->parameter.command;
768 resp.TBR.metadata = clCanard.
module_rain.TBR.metadata;
769 resp.TPR.metadata = clCanard.
module_rain.TPR.metadata;
778 char name[uavcan_register_Name_1_0_name_ARRAY_CAPACITY_ + 1] = {0};
780 memcpy(&name[0], req->name.name.elements, req->name.name.count);
781 name[req->name.name.count] =
'\0';
783 uavcan_register_Access_Response_1_0 resp = {0};
786 if (!uavcan_register_Value_1_0_is_empty_(&req->value)) {
787 uavcan_register_Value_1_0_select_empty_(&resp.value);
788 localRegisterAccessLock->Take();
789 localRegister->read(&name[0], &resp.value);
790 localRegisterAccessLock->Give();
792 if (!uavcan_register_Value_1_0_is_empty_(&resp.value) && localRegister->assign(&resp.value, &req->value)) {
793 localRegisterAccessLock->Take();
794 localRegister->write(&name[0], &resp.value);
795 localRegisterAccessLock->Give();
801 uavcan_register_Value_1_0_select_empty_(&resp.value);
802 localRegisterAccessLock->Take();
803 localRegister->read(&name[0], &resp.value);
804 localRegisterAccessLock->Give();
809 resp._mutable =
true;
810 resp.persistent =
true;
813 resp.timestamp.microsecond = uavcan_time_SynchronizedTimestamp_1_0_UNKNOWN;
821 uavcan_node_GetInfo_Response_1_0 resp = {0};
822 resp.protocol_version.major = CANARD_CYPHAL_SPECIFICATION_VERSION_MAJOR;
823 resp.protocol_version.minor = CANARD_CYPHAL_SPECIFICATION_VERSION_MINOR;
835 char stima_name[STIMA_MODULE_NAME_LENGTH] = {0};
837 resp.name.count = strlen(stima_name);
838 memcpy(&resp.name.elements, stima_name, resp.name.count);
863 if (transfer->metadata.transfer_kind == CanardTransferKindMessage)
865 if (transfer->metadata.port_id == uavcan_node_Heartbeat_1_0_FIXED_PORT_ID_)
869 size_t size = transfer->payload_size;
870 uavcan_node_Heartbeat_1_0 msg = {0};
871 if (uavcan_node_Heartbeat_1_0_deserialize_(&msg,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
885 remoteVSC.
uint8_val = msg.vendor_specific_status_code;
903 #ifndef _EXIT_SLEEP_FOR_DEBUGGING
920 else if (transfer->metadata.port_id == uavcan_time_Synchronization_1_0_FIXED_PORT_ID_)
924 size_t size = transfer->payload_size;
925 uavcan_time_Synchronization_1_0 msg = {0};
926 if (uavcan_time_Synchronization_1_0_deserialize_(&msg,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
930 bool isSyncronized =
false;
931 CanardMicrosecond timestamp_synchronized_us;
934 transfer->metadata.transfer_id,
935 msg.previous_transmission_timestamp_microsecond)) {
938 transfer->timestamp_usec,
939 msg.previous_transmission_timestamp_microsecond);
940 isSyncronized =
true;
942 TRACE_VERBOSE_F(F(
"RX TimeSyncro from master, reset or invalid Value at local_time_stamp (uSec): %u\r\n"), transfer->timestamp_usec);
946 transfer->timestamp_usec, msg.previous_transmission_timestamp_microsecond);
949 #if (TRACE_LEVEL >= TRACE_LEVEL_VERBOSE)
950 uint32_t low_ms = timestamp_synchronized_us % 1000u;
951 uint32_t high_ms = timestamp_synchronized_us / 1000u;
952 TRACE_VERBOSE_F(F(
"RX TimeSyncro from master, syncronized value is (uSec): "));
955 TRACE_VERBOSE_F(F(
" from 2 message difference is (uSec): %lu\r\n"), (uint32_t)last_message_diff_us);
958 uint32_t currentSubsecond;
959 volatile uint64_t canardEpoch_ms;
961 uint64_t timeStampEpoch_ms = timestamp_synchronized_us / 1000ul;
963 canardEpoch_ms = (uint64_t) rtc.getEpoch(¤tSubsecond);
964 canardEpoch_ms *= 1000ul;
965 canardEpoch_ms += currentSubsecond;
967 if(canardEpoch_ms > timeStampEpoch_ms) {
968 currentSubsecond = canardEpoch_ms - timeStampEpoch_ms;
970 currentSubsecond = timeStampEpoch_ms - canardEpoch_ms;
973 if(currentSubsecond > 250) {
975 TRACE_VERBOSE_F(F(
"RTC: Adjust time with TimeSyncro from master (difference %lu mS)\r\n"), currentSubsecond);
977 rtc.setEpoch(timeStampEpoch_ms / 1000, timeStampEpoch_ms % 1000);
983 else if (transfer->metadata.port_id == uavcan_pnp_NodeIDAllocationData_1_0_FIXED_PORT_ID_)
986 size_t size = transfer->payload_size;
987 uavcan_pnp_NodeIDAllocationData_1_0 msg = {0};
988 if (uavcan_pnp_NodeIDAllocationData_1_0_deserialize_(&msg,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
989 processMessagePlugAndPlayNodeIDAllocation(clCanard, &msg);
998 else if (transfer->metadata.transfer_kind == CanardTransferKindRequest)
1003 rmap_service_module_Rain_Request_1_0 req = {0};
1004 size_t size = transfer->payload_size;
1005 TRACE_INFO_F(F(
"<<-- Ricevuto richiesta dati da master\r\n"));
1007 if (rmap_service_module_Rain_Request_1_0_deserialize_(&req,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
1009 rmap_service_module_Rain_Response_1_0 module_rain_resp = processRequestGetModuleData(clCanard, &req, (
CanParam_t *) param);
1011 uint8_t serialized[rmap_service_module_Rain_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
1012 size_t serialized_size =
sizeof(serialized);
1013 const int8_t res = rmap_service_module_Rain_Response_1_0_serialize_(&module_rain_resp, &serialized[0], &serialized_size);
1020 else if (transfer->metadata.port_id == uavcan_node_GetInfo_1_0_FIXED_PORT_ID_)
1023 const uavcan_node_GetInfo_Response_1_0 resp = processRequestNodeGetInfo();
1024 uint8_t serialized[uavcan_node_GetInfo_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
1025 size_t serialized_size =
sizeof(serialized);
1026 const int8_t res = uavcan_node_GetInfo_Response_1_0_serialize_(&resp, &serialized[0], &serialized_size);
1029 clCanard.
sendResponse(
MEGA, &transfer->metadata, serialized_size, &serialized[0]);
1032 else if (transfer->metadata.port_id == uavcan_register_Access_1_0_FIXED_PORT_ID_)
1034 uavcan_register_Access_Request_1_0 req = {0};
1035 size_t size = transfer->payload_size;
1036 TRACE_INFO_F(F(
"<<-- Ricevuto richiesta accesso ai registri\r\n"));
1037 if (uavcan_register_Access_Request_1_0_deserialize_(&req,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
1038 const uavcan_register_Access_Response_1_0 resp = processRequestRegisterAccess(&req);
1039 uint8_t serialized[uavcan_register_Access_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
1040 size_t serialized_size =
sizeof(serialized);
1041 if (uavcan_register_Access_Response_1_0_serialize_(&resp, &serialized[0], &serialized_size) >= 0) {
1043 clCanard.
sendResponse(
MEGA, &transfer->metadata, serialized_size, &serialized[0]);
1047 else if (transfer->metadata.port_id == uavcan_register_List_1_0_FIXED_PORT_ID_)
1049 uavcan_register_List_Request_1_0 req = {0};
1050 size_t size = transfer->payload_size;
1051 TRACE_INFO_F(F(
"<<-- Ricevuto richiesta lettura elenco registri\r\n"));
1052 if (uavcan_register_List_Request_1_0_deserialize_(&req,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
1053 const uavcan_register_List_Response_1_0 resp = {.name = localRegister->getNameByIndex(req.index)};
1054 uint8_t serialized[uavcan_register_List_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
1055 size_t serialized_size =
sizeof(serialized);
1056 if (uavcan_register_List_Response_1_0_serialize_(&resp, &serialized[0], &serialized_size) >= 0) {
1062 else if (transfer->metadata.port_id == uavcan_node_ExecuteCommand_1_1_FIXED_PORT_ID_)
1064 uavcan_node_ExecuteCommand_Request_1_1 req = {0};
1065 size_t size = transfer->payload_size;
1067 if (uavcan_node_ExecuteCommand_Request_1_1_deserialize_(&req,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
1068 const uavcan_node_ExecuteCommand_Response_1_1 resp = processRequestExecuteCommand(clCanard, &req, transfer->metadata.remote_node_id);
1069 uint8_t serialized[uavcan_node_ExecuteCommand_Response_1_1_SERIALIZATION_BUFFER_SIZE_BYTES_] = {0};
1070 size_t serialized_size =
sizeof(serialized);
1071 if (uavcan_node_ExecuteCommand_Response_1_1_serialize_(&resp, &serialized[0], &serialized_size) >= 0) {
1073 clCanard.
sendResponse(
MEGA, &transfer->metadata, serialized_size, &serialized[0]);
1083 else if (transfer->metadata.transfer_kind == CanardTransferKindResponse)
1085 if (transfer->metadata.port_id == uavcan_file_Read_1_1_FIXED_PORT_ID_) {
1091 uavcan_file_Read_Response_1_1 resp = {0};
1092 size_t size = transfer->payload_size;
1093 if (uavcan_file_Read_Response_1_1_deserialize_(&resp,
static_cast<uint8_t const*
>(transfer->payload), &size) >= 0) {
1102 resp.data.value.elements, resp.data.value.count)) {
1115 TRACE_ERROR_F(F(
"RX FILE READ BLOCK REJECT: Node_Id not valid or not set\r\n"));
1131 CanTask::CanTask(
const char *taskName, uint16_t stackSize, uint8_t priority,
CanParam_t canParam) : Thread(taskName, stackSize, priority), param(canParam)
1161 static uavcan_register_Value_1_0 val = {0};
1162 uavcan_register_Value_1_0_select_natural16_(&val);
1163 val.natural16.value.count = 1;
1168 LOCAL_ASSERT(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count == 1));
1172 uavcan_register_Value_1_0_select_natural32_(&val);
1173 val.natural32.value.count = 2;
1175 val.natural32.value.elements[1] = 0ul;
1179 LOCAL_ASSERT(uavcan_register_Value_1_0_is_natural32_(&val) && (val.natural32.value.count == 2));
1182 BxCANTimings timings;
1183 bool result = bxCANComputeTimings(HAL_RCC_GetPCLK1Freq(), val.natural32.value.elements[0], &timings);
1185 TRACE_VERBOSE_F(F(
"Error redefinition bxCANComputeTimings, try loading default...\r\n"));
1186 val.natural32.value.count = 2;
1188 val.natural32.value.elements[1] = 0ul;
1192 result = bxCANComputeTimings(HAL_RCC_GetPCLK1Freq(), val.natural32.value.elements[0], &timings);
1194 TRACE_ERROR_F(F(
"Error initialization bxCANComputeTimings\r\n"));
1204 result = bxCANConfigure(0, timings,
false);
1206 TRACE_ERROR_F(F(
"Error initialization bxCANConfigure\r\n"));
1213 if (HAL_CAN_Start(&
hcan1) != HAL_OK) {
1220 if (HAL_CAN_ActivateNotification(&
hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK) {
1221 TRACE_ERROR_F(F(
"Error initialization interrupt CAN base\r\n"));
1227 HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn);
1239 #if (ENABLE_STACK_USAGE)
1241 void CanTask::TaskMonitorStack()
1243 uint16_t stackUsage = (uint16_t)uxTaskGetStackHighWaterMark( NULL );
1299 static uavcan_register_Value_1_0 val = {0};
1305 CanardMicrosecond last_pub_rmap_data;
1306 CanardMicrosecond last_pub_heartbeat;
1307 CanardMicrosecond last_pub_port_list;
1310 bool start_firmware_upgrade =
false;
1313 bool masterOnline =
false;
1316 #if (ENABLE_STACK_USAGE)
1368 #ifdef USE_NODE_SLAVE_ID_FIXED
1372 uavcan_register_Value_1_0_select_natural16_(&val);
1373 val.natural16.value.count = 1;
1374 val.natural16.value.elements[0] = UINT16_MAX;
1378 LOCAL_ASSERT(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count == 1));
1379 if (val.natural16.value.elements[0] <= CANARD_NODE_ID_MAX) {
1386 uavcan_register_Value_1_0_select_string_(&val);
1387 val._string.value.count = 0;
1394 #ifdef USE_NODE_MASTER_ID_FIXED
1398 uavcan_register_Value_1_0_select_natural16_(&val);
1399 val.natural16.value.count = 1;
1404 LOCAL_ASSERT(uavcan_register_Value_1_0_is_natural16_(&val) && (val.natural16.value.count == 1));
1405 if (val.natural16.value.elements[0] <= CANARD_NODE_ID_MAX) {
1411 #ifdef USE_PORT_PUBLISH_RMAP_FIXED
1418 #ifdef USE_PORT_SERVICE_RMAP_FIXED
1436 uavcan_register_Value_1_0_select_natural16_(&val);
1448 uavcan_register_Value_1_0_select_natural16_(&val);
1460 uavcan_register_Value_1_0_select_natural16_(&val);
1472 uavcan_register_Value_1_0_select_natural16_(&val);
1484 uavcan_register_Value_1_0_select_natural16_(&val);
1497 clCanard.
module_rain.TBR.metadata.timerange.P2 = 0;
1498 clCanard.
module_rain.TPR.metadata.timerange.P2 = 0;
1500 uavcan_register_Value_1_0_select_natural8_(&val);
1524 if (!clCanard.
rxSubscribe(CanardTransferKindMessage,
1525 uavcan_pnp_NodeIDAllocationData_1_0_FIXED_PORT_ID_,
1526 uavcan_pnp_NodeIDAllocationData_1_0_EXTENT_BYTES_,
1527 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1533 if (!clCanard.
rxSubscribe(CanardTransferKindMessage,
1534 uavcan_node_Heartbeat_1_0_FIXED_PORT_ID_,
1535 uavcan_node_Heartbeat_1_0_EXTENT_BYTES_,
1536 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1541 if (!clCanard.
rxSubscribe(CanardTransferKindMessage,
1542 uavcan_time_Synchronization_1_0_FIXED_PORT_ID_,
1543 uavcan_time_Synchronization_1_0_EXTENT_BYTES_,
1544 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1549 if (!clCanard.
rxSubscribe(CanardTransferKindRequest,
1550 uavcan_node_GetInfo_1_0_FIXED_PORT_ID_,
1551 uavcan_node_GetInfo_Request_1_0_EXTENT_BYTES_,
1552 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1557 if (!clCanard.
rxSubscribe(CanardTransferKindRequest,
1558 uavcan_node_ExecuteCommand_1_1_FIXED_PORT_ID_,
1559 uavcan_node_ExecuteCommand_Request_1_1_EXTENT_BYTES_,
1560 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1565 if (!clCanard.
rxSubscribe(CanardTransferKindRequest,
1566 uavcan_register_Access_1_0_FIXED_PORT_ID_,
1567 uavcan_register_Access_Request_1_0_EXTENT_BYTES_,
1568 CANARD_DEFAULT_TRANSFER_ID_TIMEOUT_USEC)) {
1575 if (!clCanard.
rxSubscribe(CanardTransferKindRequest,
1576 uavcan_register_List_1_0_FIXED_PORT_ID_,
1577 uavcan_register_List_Request_1_0_EXTENT_BYTES_,
1583 if (!clCanard.
rxSubscribe(CanardTransferKindRequest,
1585 rmap_service_module_Rain_Request_1_0_EXTENT_BYTES_,
1591 if (!clCanard.
rxSubscribe(CanardTransferKindResponse,
1592 uavcan_file_Read_1_1_FIXED_PORT_ID_,
1593 uavcan_file_Read_Response_1_1_EXTENT_BYTES_,
1603 randomSeed(analogRead(PA_4));
1609 last_pub_port_list = last_pub_heartbeat +
MEGA * (0.1);
1625 #if defined(LED_ON_SYNCRO_TIME) && defined(LED2_PIN)
1631 digitalWrite(LED2_PIN, HIGH);
1633 digitalWrite(LED2_PIN, LOW);
1646 if (masterOnline !=
true) {
1647 TRACE_INFO_F(F(
"Master controller ONLINE !!! -> OnLineFunction()\r\n"));
1650 masterOnline =
true;
1659 TRACE_INFO_F(F(
"Master controller OFFLINE !!! ALERT -> OffLineFunction()\r\n"));
1663 masterOnline =
false;
1687 TRACE_VERBOSE_F(F(
"MAX Retry File occurs, download file ABORT !!!\r\n"));
1705 uint8_t module_type;
1708 uint64_t fwFileLen = 0;
1710 TRACE_VERBOSE_F(F(
"Firmware V%d.%d, Size: %lu bytes is ready for flash updating\r\n"),version, revision, (uint32_t) fwFileLen);
1720 start_firmware_upgrade =
true;
1767 if((start_firmware_upgrade)||
1819 #ifdef LOG_RX_PACKET
1837 #if (ENABLE_STACK_USAGE)
#define AT25SF161_BLOCK_SIZE
Uavcan over CanBus cpp_Freertos header file.
#define CAN_TASK_WAIT_MAXSPEED_DELAY_MS
#define CAN_FLAG_IS_MAINTENANCE_MODE
CAN_ModePower
Mode Power HW CanBus Controller state.
@ CAN_NORMAL
CAN is in normal state (TX and RX Ready)
@ CAN_SLEEP
Power CAN is OFF.
@ CAN_INIT
CAN is in init or configuration mode.
@ CAN_LISTEN_ONLY
CAN in only listen mode (turn off TX board)
#define CAN_SEMAPHORE_MAX_WAITING_TIME_MS
#define CAN_TASK_WAIT_DELAY_MS
#define FLASH_SEMAPHORE_MAX_WAITING_TIME_MS
#define CAN_TASK_SLEEP_DELAY_MS
#define SENSOR_METADATA_LEVEL_P_IND_TBR
#define CANARD_READFILE_TRANSFER_ID_TIMEOUT_USEC
#define SENSOR_METADATA_LEVELTYPE_2
#define TIME_PUBLISH_PNP_REQUEST
#define SENSOR_METADATA_TPR
#define GENERIC_STATE_UNDEFINED
#define TIME_PUBLISH_HEARTBEAT
#define SUBJECTID_PUBLISH_RMAP
#define SENSOR_METADATA_LEVELTYPE_1
#define NODE_GETFILE_TIMEOUT_US
#define MASTER_OFFLINE_TIMEOUT_US
#define TIME_PUBLISH_MODULE_DATA
#define SENSOR_METADATA_COUNT
#define SENSOR_METADATA_TBR
#define HASH_SERNUMB_MASK
#define SENSOR_METADATA_LEVEL_P1
#define CANARD_RMAPDATA_TRANSFER_ID_TIMEOUT_USEC
#define SENSOR_METADATA_LEVEL_P_IND_TPR
#define SENSOR_METADATA_LEVEL_1
#define HASH_EXCLUDING_BIT
#define TIME_PUBLISH_PORT_LIST
#define SENSOR_METADATA_LEVEL_2
#define CANARD_REGISTERLIST_TRANSFER_ID_TIMEOUT_USEC
#define PORT_SERVICE_RMAP
static Flash * localFlash
void TaskWatchDog(uint32_t millis_standby)
local watchDog and Sleep flag Task (optional)
static EERegister * localRegister
void TaskState(uint8_t state_position, uint8_t state_subposition, task_flag state_operation)
local suspend flag and positor running state Task (optional)
static void prepareSensorsDataValue(uint8_t const sensore, const report_t *report, rmap_module_Rain_1_0 *rmap_data)
Prepara il blocco messaggio dati per il modulo corrente istantaneo NB: Aggiorno solo i dati fisici in...
static cpp_freertos::Queue * localSystemMessageQueue
static bool putFlashFile(const char *const file_name, const bool is_firmware, const bool rewrite, void *buf, size_t count)
Scrive dati in append su Flash per scrittura sequenziale file data remoto.
static uavcan_node_GetInfo_Response_1_0 processRequestNodeGetInfo()
Risposta a uavcan.node.GetInfo which Info Node (nome, versione, uniqueID di verifica ecc....
static void processMessagePlugAndPlayNodeIDAllocation(canardClass &clsCanard, const uavcan_pnp_NodeIDAllocationData_1_0 *const msg)
Plug and Play Slave, Versione 1.0 compatibile con CAN_CLASSIC MTU 8 Messaggi anonimi CAN non sono con...
static bootloader_t * boot_state
static void publish_rmap_data(canardClass &clsCanard, CanParam_t *param)
Pubblica i dati RMAP con il metodo publisher se abilitato e configurato.
virtual void Run()
RUN Task.
CanTask(const char *taskName, uint16_t stackSize, uint8_t priority, CanParam_t canParam)
Construct the Can Task::CanTask object Main TASK && INIT TASK — UAVCAN.
static CanardPortID getModeAccessID(uint8_t modeAccessID, const char *const port_name, const char *const type_name)
Legge il subjectID per il modulo corrente per la risposta al servizio di gestione dati.
static EEprom * localEeprom
static uavcan_node_ExecuteCommand_Response_1_1 processRequestExecuteCommand(canardClass &clsCanard, const uavcan_node_ExecuteCommand_Request_1_1 *req, uint8_t remote_node)
Chiamate gestioni RPC remote da master (yakut o altro servizio di controllo)
static void HW_CAN_Power(CAN_ModePower ModeCan)
Enable Power CAN_Circuit TJA1443.
static cpp_freertos::BinarySemaphore * localQspiLock
static cpp_freertos::BinarySemaphore * localRegisterAccessLock
static bool getFlashFwInfoFile(uint8_t *module_type, uint8_t *version, uint8_t *revision, uint64_t *len)
GetInfo for Firmware File on Flash.
static uavcan_register_Access_Response_1_0 processRequestRegisterAccess(const uavcan_register_Access_Request_1_0 *req)
Accesso ai registri UAVCAN risposta a richieste.
static void processReceivedTransfer(canardClass &clsCanard, const CanardRxTransfer *const transfer, void *param)
Canard CallBACK Receive message to Node (Solo con sottoscrizioni)
static rmap_service_module_Rain_Response_1_0 processRequestGetModuleData(canardClass &clsCanard, rmap_service_module_Rain_Request_1_0 *req, CanParam_t *param)
Chiamate gestioni dati remote da master (yakut o altro servizio di controllo)
static void getUniqueID(uint8_t out[uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_], uint64_t serNumb)
Ritorna unique-ID 128-bit del nodo locale. E' utilizzato in uavcan.node.GetInfo.Response e durante pl...
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.
bool Write(uint16_t address, uint8_t *buffer, uint16_t length)
Write a number of data byte into EEPROM.
void set_local_power_mode(Power_Mode powerMode)
Proprietà SET per il valore VendorStatusCode di Heartbeat e per gli utilizzi locali La proprietà è im...
void set_local_fw_uploading(bool fwUploading)
Proprietà SET per il valore VendorStatusCode di Heartbeat e per gli utilizzi locali.
Power_Mode get_local_power_mode(void)
Proprietà GET per il valore VendorStatusCode di Heartbeat e per gli utilizzi locali.
void set_local_node_mode(uint8_t heartLocalMODE)
Imposta la modalità nodo standard UAVCAN, gestita nelle funzioni heartbeat.
bool is_requested_system_restart(void)
Verifica una richiesta di riavvio del sistema standard UAVCAN.
void set_local_module_ready(bool moduleReady)
Proprietà SET per il valore VendorStatusCode di Heartbeat e per gli utilizzi locali.
void request_system_restart(void)
Avvia una richiesta standard UAVCAN per il riavvio del sistema.
CanardNodeID get_server_node(void)
Legge il nodo master file server che richiede il caricamento del file.
bool download_request(void)
Gestione file, verifica richiesta di download da un nodo remoto.
char * get_name(void)
Nome del file in download.
bool event_timeout(void)
Gestione timeout pending file. Controlla il raggiungimento del timeout.
bool is_pending(void)
Verifica se un comando per il relativo modulo è in attesa. Diventerà false o verrà attivato il timeou...
bool is_first_data_block(void)
Verifica se è il primo blocco di un file. Da utilizzare per rewrite file o init E2Prom Space.
void download_end(void)
Gestione file, abbandona o termina richiesta di download da un nodo remoto. Il nodo non risponde più ...
bool is_firmware(void)
Controlla se il file è di tipo firmware o altra tipologia.
void reset_pending(void)
Resetta lo stato dei flag pending per il metodo corrente.
bool next_retry(void)
Gestione automatica totale retry del comando file all'interno della classe MAX retry è gestito nel fi...
bool is_download_complete(void)
Gestione file, fine con successo del download file da un nodo remoto. Il nodo non risponde più alle r...
void start_request(uint8_t remote_node, uint8_t *param_request_name, uint8_t param_request_len, bool is_firmware)
Avvia una richiesta remota di download file ed inizializza le risorse nella classe.
void set_online(uint32_t dead_line_us)
Imposta il nodo OnLine, richiamato in heartbeat o altre comunicazioni client.
CanardMicrosecond last_online(void)
Imposta il nodo OnLine, richiamato in heartbeat o altre comunicazioni client.
bool is_online(bool is_heart_syncronized)
Controlla se il modulo master è online.
bool check_valid_syncronization(uint8_t current_transfer_id, CanardMicrosecond previous_tx_timestamp_us)
Controlla se messaggio valido (coerenza sequenza e validità di time_stamp)
CanardMicrosecond update_timestamp_message(CanardMicrosecond current_rx_timestamp_us, CanardMicrosecond previous_tx_timestamp_us)
Aggiorna i time stamp della classe sul messaggio standard UAVCAN per le successive sincronizzazioni.
CanardMicrosecond get_timestamp_syncronized(CanardMicrosecond current_rx_timestamp_us, CanardMicrosecond previous_tx_timestamp_us)
Legge il tempo sincronizzato dal master, utilizzabile dopo controllo di validità del messaggio.
class canardClass::master::file file
class canardClass::master::timestamp timestamp
class canardClass::master::heartbeat heartbeat
uint8_t module_rain(void)
Gestione transfer ID UAVCAN per la classe relativa.
CanardPortID publisher_module_rain
CanardPortID service_module_rain
class canardClass::port_id port_id
rmap_module_Rain_1_0 module_rain
void rxUnSubscribe(const CanardTransferKind transfer_kind, const CanardPortID port_id)
Rimozione di una sottoscrizione di una funzione Canard.
bool master_file_read_block_pending(uint32_t timeout_us)
Avvia la richiesta di un blocco file contiguo al file_server tramite classe e controllo Master.
static CanardMicrosecond getMicros()
Get MonotonicTime Interno realTime.
void send(CanardMicrosecond tx_deadline_usec, const CanardTransferMetadata *const metadata, const size_t payload_size, const void *const payload)
Send messaggio Canard con daeadline del tempo sincronizzato.
class canardClass::publisher_enabled publisher_enabled
bool slave_heartbeat_send_message(void)
Invia il messaggio di HeartBeat ai nodi remoti.
void set_canard_node_id(CanardNodeID local_id)
Imposta l'ID Nodo locale per l'istanza Canard privata della classe Canard.
class canardClass::master master
class canardClass::flag flag
void receiveQueue(void)
Gestione metodo ricezione coda messaggi dal buffer FIFO preparato di BxCAN Il buffer gestito nella IS...
void setReceiveMessage_CB(void(*ptrFunction)(canardClass &, const CanardRxTransfer *, void *), void *param)
Setta il CallBack Function per il processo esterno di interprete su messaggio ricevuto e conforme a C...
void transmitQueue(void)
Trasmette la coda con timeStamp sincronizzato. Per inviare con real_time va aggiornata la sincronizza...
class canardClass::next_transfer_id next_transfer_id
bool slave_servicelist_send_message(void)
Invia il messaggio dei servizi attivi ai nodi remoti.
bool is_canard_node_anonymous(void)
Controlla se il nodo è anonimo (senza ID Impostato)
void sendResponse(const CanardMicrosecond tx_deadline_usec, const CanardTransferMetadata *const request_metadata, const size_t payload_size, const void *const payload)
Send risposta al messaggio Canard con daeadline del tempo sincronizzato.
bool slave_pnp_send_request(uint64_t serial_number)
Invia il messaggio di PNP request (richiesta di node_id valido) al nodo server PNP (master)
CanardNodeID get_canard_master_id(void)
Get master node id for local set and flag operation automatic (sleep, power...)
void set_canard_master_id(CanardNodeID remote_id)
Set node master ID (slave respond to RMAP command and flag with master ID)
bool transmitQueueDataPresent(void)
Test coda presenza dati in trasmissione di Canard.
bool rxSubscribe(const CanardTransferKind transfer_kind, const CanardPortID port_id, const size_t extent, const CanardMicrosecond transfer_id_timeout_usec)
Sottoscrizione di una funzione Canard.
bool receiveQueueDataPresent(void)
Ritorna true se ci sono dati utili da gestire dal buffer di RX per BxCAN.
#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 RMAP_PROCOTOL_VERSION
rmap protocol version
#define ALL_TASK_ID
All task ID. Send message to ALL Task.
#define MODULE_TYPE
Type of module. It is defined in registers.h.
#define BOOT_LOADER_STRUCT_ADDR
Bootloader start address
#define WAIT_QUEUE_REQUEST_COMMAND_MS
Time to wait pushing command queue.
#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_DEBUG_F(...)
#define TRACE_ERROR_F(...)
#define TRACE_INFO_F(...)
#define TRACE_VERBOSE_F(...)
#define FLASH_INFO_SIZE_LEN
#define FLASH_FILE_POSITION
#define FLASH_INFO_SIZE_U64
#define FLASH_SIZE_ADDR(X)
#define FLASH_FILE_SIZE_LEN
#define FLASH_FW_POSITION
#define FLASH_BUFFER_SIZE
@ set
Set WDT (From Application TASK... All OK)
@ timer
Set Timered WDT (From Application long function WDT...)
@ pwr_nominal
Every Second (Nominale base)
@ pwr_on
Never (All ON, test o gestione locale)
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.
#define CAN_NVIC_INT_PREMPT_PRIORITY
uint64_t StimaV4GetSerialNumber(void)
Get StimaV4 Serial Number from UID Cpu and Module TYPE.
#define REGISTER_DATA_PUBLISH
#define REGISTER_METADATA_LEVEL_L1
#define REGISTER_RMAP_MASTER_ID
#define REGISTER_METADATA_TIME_PIND
#define REGISTER_UAVCAN_NODE_DESCR
#define REGISTER_UAVCAN_BITRATE
#define REGISTER_UAVCAN_NODE_ID
#define REGISTER_METADATA_LEVEL_TYPE1
#define REGISTER_UAVCAN_UNIQUE_ID
#define REGISTER_METADATA_LEVEL_TYPE2
#define REGISTER_METADATA_LEVEL_L2
#define REGISTER_METADATA_TIME_P1
#define REGISTER_UAVCAN_MTU
#define REGISTER_DATA_SERVICE
struct local elaborate data parameter
Flash * flash
Object Flash C++ access.
cpp_freertos::BinarySemaphore * registerAccessLock
Semaphore to register Cyphal access.
cpp_freertos::Queue * reportDataQueue
Queue to report data.
cpp_freertos::Queue * systemMessageQueue
Queue for system message.
cpp_freertos::Queue * requestDataQueue
Queue to request data.
configuration_t * configuration
system configuration pointer struct
EERegister * clRegister
Object Register C++ access.
system_status_t * system_status
system status pointer struct
cpp_freertos::BinarySemaphore * canLock
Semaphore to CAN Bus access.
bootloader_t * boot_request
Boot struct pointer.
cpp_freertos::BinarySemaphore * qspiLock
Semaphore to QSPI Memory flash access.
EEprom * eeprom
Object EEprom C++ access.
cpp_freertos::BinarySemaphore * systemStatusLock
Semaphore to system status access.
Backup && Upload Firmware TypeDef (BootLoader)
bool rollback_executed
An rollback of firmware was executed.
bool backup_executed
Firmware backup is executed.
bool app_forcing_start
Force starting APP from Flash RUN APP Memory Position.
bool app_executed_ok
Flag running APP (setted after new firmware, prevert a rollback operation)
bool request_upload
Request an upload of firmware.
uint64_t serial_number
module serial number
rmapdata_t rain
Rain official (without Maintenance value)
rmapdata_t rain_full
Rain unofficial (With Maintenance value, for Display LCD)
rmapdata_t rain_tpr_60s_avg
Rain official (TPR on 1')
rmapdata_t quality
Rain quality of measure.
rmapdata_t tips_count
Number of tips readed (without Maintenance value)
rmapdata_t rain_tpr_05m_avg
Rain official (TPR on 5')
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.
uint8_t do_calib
Calibrate accelerometr.
struct system_message_t::@7 command
struct system_status_t::@4 flags
Module error or alert.
bool is_clogged_up
Sensor is clogged up.
bool is_main_error
Main sensor in error.
struct system_status_t::@5 events
Module error or alert timings continuos verify.
task_t tasks[TOTAL_INFO_TASK]
Info Task && WDT.
bool is_bubble_level_error
Bubble software accelerometer error.
bool is_redundant_error
Redundant sensor in error.
bool is_maintenance
Module is in maintenance mode.
bool is_tipping_error
Tipping event error run.
bool is_accelerometer_error
Accelerometer error.
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.