Skip to content

Commit 18d8523

Browse files
authored
fix(flex-stacker): Check PRIMARY_REVISION when compiling in INSTALL detect for rev b of flex stacker (#520)
1 parent 8e0ef5f commit 18d8523

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

stm32-modules/flex-stacker/firmware/system/system_hardware.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ bool system_hardware_read_door_closed(void) {
224224
}
225225

226226
bool system_hardware_read_install_detected(void) {
227-
#if flex-stacker_BOARD_REVISION != 'b'
227+
#if PRIMARY_REVISION == 'a'
228228
return false;
229-
#elif
229+
#else
230230
return HAL_GPIO_ReadPin(INSTALL_DETECTION_PORT, INSTALL_DETECTION_PIN) == GPIO_PIN_SET;
231231
#endif
232232
}

stm32-modules/flex-stacker/src/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ endif()
3838

3939
set(${TARGET_MODULE_NAME}_VERSION "${VERSION}" CACHE STRING "${TARGET_MODULE_NAME} fw version" FORCE)
4040
set(${TARGET_MODULE_NAME}_BOARD_REVISION "${TARGET_MODULE_NAME}-${STACKER_REVISION}" CACHE STRING "${TARGET_MODULE_NAME} board revision" FORCE)
41+
string(SUBSTRING ${STACKER_REVISION} 0 1 PRIMARY_REVISION)
42+
string(SUBSTRING ${STACKER_REVISION} 1 1 SECONDARY_REVISION)
4143
message(STATUS "Building ${TARGET_MODULE_NAME} version: ${${TARGET_MODULE_NAME}_VERSION} for board revision: ${${TARGET_MODULE_NAME}_BOARD_REVISION}")
4244

4345
configure_file(./version.cpp.in ./version.cpp)
@@ -73,6 +75,11 @@ set_target_properties(${TARGET_MODULE_NAME}-core
7375

7476
target_link_libraries(${TARGET_MODULE_NAME}-core PUBLIC common-core)
7577

78+
target_compile_definitions(${TARGET_MODULE_NAME}-core PUBLIC
79+
PRIMARY_REVISION='${PRIMARY_REVISION}'
80+
SECONDARY_REVISION='${SECONDARY_REVISION}'
81+
)
82+
7683
target_include_directories(${TARGET_MODULE_NAME}-core
7784
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include/${TARGET_MODULE_NAME}
7885
PUBLIC ${CMAKE_CURRENT_BINARY_DIR} # need to add this to get the generated conversion header

0 commit comments

Comments
 (0)