rework of the device descripton in proto

This commit is contained in:
2024-04-30 02:38:56 +02:00
parent 6782048b51
commit fe432acef3
5 changed files with 24 additions and 21 deletions

View File

@@ -136,15 +136,17 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
CLS_Position_t position = CLS_BSP_GetPosition();
CLS_Type_t type = CLS_BSP_GetDeviceType();
uint32_t fw32 = (VERSION_INFO.major<<24) +(VERSION_INFO.minor<<16) + (VERSION_INFO.patch<<8) +VERSION_INFO.count ;
uint16_t pos16 = (position.p1<< 4) + position.p0;
uint16_t type16 = type;
list.devices[list.devices_count].available = true;
list.devices[list.devices_count].canid = GENERATE_CLS_ADDRESS(CLS_CODE_STATUS, gCLS_DEVICE_ADDRESS, CLS_CH_STA_HEATBEAT);
list.devices[list.devices_count].device = gCLS_DEVICE_ADDRESS;
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
list.devices[list.devices_count].fw_version = fw32;
list.devices[list.devices_count].type = (uint32_t) type; // enum to uint
list.devices[list.devices_count].position[0] = position.p0;
list.devices[list.devices_count].position[1] = position.p1;
list.devices[list.devices_count].fw_version[0] = VERSION_INFO.count;
list.devices[list.devices_count].fw_version[1] = VERSION_INFO.patch;
list.devices[list.devices_count].fw_version[2] = VERSION_INFO.minor;
list.devices[list.devices_count].fw_version[3] = VERSION_INFO.major;
list.devices_count++;
@@ -159,17 +161,16 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
CLS_HeatbeatData_t data = {0};
memcpy(&data, msg->data, msg->data_length);
CLS_Position_t position = data.position;
CLS_Type_t type = data.type;
uint32_t fw32 = (data.firmware_version.major<<24) +(data.firmware_version.minor<<16) + (data.firmware_version.patch<<8) +data.firmware_version.count ;
uint16_t pos16 = (position.p1<< 4) + position.p0;
uint16_t type16 = type;
list.devices[list.devices_count].available = true;
list.devices[list.devices_count].canid = canid;
list.devices[list.devices_count].device = i;
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
list.devices[list.devices_count].fw_version = fw32;
list.devices[list.devices_count].type = (uint32_t) data.type; // enum to uint
list.devices[list.devices_count].position[0] = data.position.p0;
list.devices[list.devices_count].position[1] = data.position.p1;
list.devices[list.devices_count].fw_version[0] = data.firmware_version.count;
list.devices[list.devices_count].fw_version[1] = data.firmware_version.patch;
list.devices[list.devices_count].fw_version[2] = data.firmware_version.minor;
list.devices[list.devices_count].fw_version[3] = data.firmware_version.major;
list.devices_count++;
}
}