Sync work

This commit is contained in:
Jochen Friedrich 2025-11-08 19:26:58 +01:00
parent 43d1811d2e
commit d4e346c5a0
7 changed files with 241 additions and 28 deletions

View file

@ -61,6 +61,20 @@ _Bool send(MyMessage *message, uint8_t data_type)
return transportSend(message);
}
_Bool sendBattery(uint8_t percent)
{
_msgTmp.last = MY_NODE_ID;
_msgTmp.sender = MY_NODE_ID;
_msgTmp.destination = GATEWAY_ADDRESS;
_msgTmp.command_echo_payload = ((uint8_t) P_BYTE << 5) + (uint8_t) C_INTERNAL;
_msgTmp.type = I_BATTERY_LEVEL;
_msgTmp.sensor = NODE_SENSOR_ID;
_msgTmp.version_length = (1 << 3) + V2_MYS_HEADER_PROTOCOL_VERSION;
_msgTmp.bValue = percent;
return transportSend(&_msgTmp);
}
_Bool sendHeartbeat(void)
{
_msgTmp.last = MY_NODE_ID;
@ -95,7 +109,7 @@ void registerNode(void)
_msgTmp.destination = GATEWAY_ADDRESS;
_msgTmp.command_echo_payload = (P_BYTE << 5) + C_INTERNAL;
_msgTmp.type = I_REGISTRATION_REQUEST;
_msgTmp.sensor = 0;
_msgTmp.sensor = NODE_SENSOR_ID;
_msgTmp.version_length = (1 << 3) + V2_MYS_HEADER_PROTOCOL_VERSION;
_msgTmp.bValue = MY_CORE_VERSION;