rework of the device descripton in proto
This commit is contained in:
Submodule Application/CLS updated: 581ffc9ed9...a9cfa7bc5e
@@ -27,7 +27,7 @@ HAL_StatusTypeDef CLS_BSP_CAN_SetUniversalFilter(const CLS_BSP_CAN_UniversalFilt
|
|||||||
|
|
||||||
|
|
||||||
CLS_Type_t CLS_BSP_GetDeviceType(void) {
|
CLS_Type_t CLS_BSP_GetDeviceType(void) {
|
||||||
return CLS_TYPE_MASTER;
|
return cls_device_Type_MASTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ void CLS_BSP_SetDeviceType(CLS_Type_t type) {
|
|||||||
|
|
||||||
CLS_Position_t CLS_BSP_GetPosition(void) {
|
CLS_Position_t CLS_BSP_GetPosition(void) {
|
||||||
CLS_Position_t position;
|
CLS_Position_t position;
|
||||||
position.p0 = CLS_POSITION_FRONT;
|
position.p0 = cls_device_Position_FRONT;
|
||||||
position.p1 = CLS_POSITION_CENTER;
|
position.p1 = cls_device_Position_CENTER;
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,15 +136,17 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
|||||||
|
|
||||||
CLS_Position_t position = CLS_BSP_GetPosition();
|
CLS_Position_t position = CLS_BSP_GetPosition();
|
||||||
CLS_Type_t type = CLS_BSP_GetDeviceType();
|
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].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].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].device = gCLS_DEVICE_ADDRESS;
|
||||||
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
|
list.devices[list.devices_count].type = (uint32_t) type; // enum to uint
|
||||||
list.devices[list.devices_count].fw_version = fw32;
|
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++;
|
list.devices_count++;
|
||||||
|
|
||||||
@@ -159,17 +161,16 @@ void DataClbk_cls_device_RequestList(void* msg, uint32_t length) {
|
|||||||
CLS_HeatbeatData_t data = {0};
|
CLS_HeatbeatData_t data = {0};
|
||||||
memcpy(&data, msg->data, msg->data_length);
|
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].available = true;
|
||||||
list.devices[list.devices_count].canid = canid;
|
list.devices[list.devices_count].canid = canid;
|
||||||
list.devices[list.devices_count].device = i;
|
list.devices[list.devices_count].device = i;
|
||||||
list.devices[list.devices_count].type_position = (type16<<16) + pos16;
|
list.devices[list.devices_count].type = (uint32_t) data.type; // enum to uint
|
||||||
list.devices[list.devices_count].fw_version = fw32;
|
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++;
|
list.devices_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,9 +115,6 @@ include_directories(
|
|||||||
$<$<COMPILE_LANGUAGE:ASM>: ${include_asm_DIRS}>
|
$<$<COMPILE_LANGUAGE:ASM>: ${include_asm_DIRS}>
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory("Revision")
|
|
||||||
add_subdirectory("lib")
|
|
||||||
add_subdirectory("Application")
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/nanopb/extra)
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/nanopb/extra)
|
||||||
find_package(Nanopb REQUIRED)
|
find_package(Nanopb REQUIRED)
|
||||||
@@ -132,6 +129,11 @@ add_library(PROTOS ${PROTO_SRCS} ${PROTO_HDRS})
|
|||||||
target_include_directories(PROTOS PUBLIC ${NANOPB_INCLUDE_DIRS} ${PROJECT_BINARY_DIR})
|
target_include_directories(PROTOS PUBLIC ${NANOPB_INCLUDE_DIRS} ${PROJECT_BINARY_DIR})
|
||||||
include_directories(${PROJECT_BINARY_DIR})
|
include_directories(${PROJECT_BINARY_DIR})
|
||||||
|
|
||||||
|
add_subdirectory("Revision")
|
||||||
|
add_subdirectory("lib")
|
||||||
|
add_subdirectory("Application")
|
||||||
|
|
||||||
|
|
||||||
# Add linked libraries
|
# Add linked libraries
|
||||||
# target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC protobuf-nanopb-static)
|
# target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC protobuf-nanopb-static)
|
||||||
|
|
||||||
|
|||||||
2
proto
2
proto
Submodule proto updated: e4c5d99604...6814f75619
Reference in New Issue
Block a user