Skip to content

Commit

Permalink
add flag for no battery callback
Browse files Browse the repository at this point in the history
  • Loading branch information
corruptbear committed Jun 22, 2024
1 parent 470bbf9 commit dd5e452
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions software/firmware/src/tasks/app_task_ranging.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,21 @@ void AppTaskRanging(void *uid)

// Register handlers for motion detection, battery status changes, and BLE events
bluetooth_register_discovery_callback(ble_discovery_handler);
#if !defined(_TEST_NO_STORAGE) && !defined(_TEST_NO_EXP_DETAILS)
#ifndef _TEST_NO_BATTERY_CALLBACK
if (battery_monitor_is_plugged_in())
storage_flush_and_shutdown();
else
{
storage_write_motion_status(imu_read_in_motion());
battery_register_event_callback(battery_event_handler);
imu_set_fusion_mode(OPERATION_MODE_ACCONLY);
imu_register_motion_change_callback(motion_change_handler);
}
#endif

#if !defined(_TEST_NO_STORAGE) && !defined(_TEST_NO_EXP_DETAILS)
storage_write_motion_status(imu_read_in_motion());
imu_set_fusion_mode(OPERATION_MODE_ACCONLY);
imu_register_motion_change_callback(motion_change_handler);
#endif

#ifdef _TEST_IMU_DATA
//imu_register_motion_change_callback(motion_change_handler);
imu_register_data_ready_callback(imu_burst_data_handler);
Expand Down
6 changes: 3 additions & 3 deletions software/firmware/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ battery: $(CONFIG) $(CONFIG)/test_battery.o $(CONFIG)/$$(TARGET).bin program

ble_and_range: TARGET = TestBleAndRanging
ble_and_range: SRC += test_ble_and_ranging.c
ble_and_range: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D__USE_FREERTOS__
ble_and_range: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D_TEST_NO_BATTERY_CALLBACK -D__USE_FREERTOS__
ble_and_range: $(CONFIG) $(CONFIG)/test_ble_and_ranging.o $(CONFIG)/$$(TARGET).bin program

ble_reset: TARGET = TestBleReset
ble_reset: SRC += test_ble_reset.c
ble_reset: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D__USE_FREERTOS__
ble_reset: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D_TEST_NO_BATTERY_CALLBACK -D__USE_FREERTOS__
ble_reset: $(CONFIG) $(CONFIG)/test_ble_reset.o $(CONFIG)/$$(TARGET).bin program

ble_range_imu: TARGET = TestBleRangingIMU
ble_range_imu: SRC += test_ble_range_imu.c
ble_range_imu: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D_TEST_IMU_DATA -D__USE_FREERTOS__ -DNONBLOCKING=$(NONBLOCKING) -D_LIVE_IMU_DATA
ble_range_imu: CFLAGS += -D_TEST_NO_STORAGE -D_TEST_NO_EXP_DETAILS -D_TEST_NO_BATTERY_CALLBACK -D_TEST_IMU_DATA -D__USE_FREERTOS__ -DNONBLOCKING=$(NONBLOCKING) -D_LIVE_IMU_DATA
ble_range_imu: $(CONFIG) $(CONFIG)/test_ble_range_imu.o $(CONFIG)/$$(TARGET).bin program

bluetooth: TARGET = TestBluetooth
Expand Down

0 comments on commit dd5e452

Please sign in to comment.