From 50542ba80c924855c4bd145f58bf29af77cf1eb1 Mon Sep 17 00:00:00 2001 From: Will Hedgecock Date: Thu, 27 Jun 2024 16:33:38 -0500 Subject: [PATCH] Allow switching back into non-download app mode --- software/firmware/.cproject | 8 +++++++ .../firmware/src/tasks/app_task_ranging.c | 22 ++++++++++++++----- software/firmware/src/tasks/app_tasks.h | 2 +- .../bluetooth/live_stats_functionality.c | 2 +- software/firmware/tests/Makefile | 4 ++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/software/firmware/.cproject b/software/firmware/.cproject index 24374169..ae4bc7cb 100644 --- a/software/firmware/.cproject +++ b/software/firmware/.cproject @@ -377,6 +377,14 @@ true true + + ${cross_make} + BUILT_BY=eclipse BOARD_REV=M + full_exp + true + true + true + \ No newline at end of file diff --git a/software/firmware/src/tasks/app_task_ranging.c b/software/firmware/src/tasks/app_task_ranging.c index 68042912..e3457077 100644 --- a/software/firmware/src/tasks/app_task_ranging.c +++ b/software/firmware/src/tasks/app_task_ranging.c @@ -325,17 +325,27 @@ void app_download_log_file(uint32_t start_time, uint32_t end_time) } } -void app_switch_mode(uint8_t command) +void app_allow_downloads(bool allow) { - if (command==1) - { //enable data downloading from ranging mode - - //disable storage writing + // Enable data downloading from ranging mode + if (allow) + { + // Disable writing to storage storage_disable(true); storage_enter_maintenance_mode(); - //stop imu + + // Stop IMU imu_deinit(); } + else + { + // Start IMU + imu_init(); + + // Enable writing to storage + storage_exit_maintenance_mode(); + storage_disable(false); + } } void AppTaskRanging(void *uid) diff --git a/software/firmware/src/tasks/app_tasks.h b/software/firmware/src/tasks/app_tasks.h index b599c8e0..0ffe54ad 100644 --- a/software/firmware/src/tasks/app_tasks.h +++ b/software/firmware/src/tasks/app_tasks.h @@ -36,7 +36,7 @@ typedef struct __attribute__ ((__packed__)) void app_notify(app_notification_t notification, bool from_isr); void app_activate_find_my_tottag(uint32_t seconds_to_activate); void app_download_log_file(uint32_t start_time, uint32_t end_time); -void app_switch_mode(uint8_t command); +void app_allow_downloads(bool allow); uint32_t app_get_experiment_time(int32_t offset); uint32_t app_experiment_time_to_rtc_time(uint32_t experiment_time); diff --git a/software/firmware/src/tasks/bluetooth/live_stats_functionality.c b/software/firmware/src/tasks/bluetooth/live_stats_functionality.c index 10c6bbe4..7dac9581 100644 --- a/software/firmware/src/tasks/bluetooth/live_stats_functionality.c +++ b/software/firmware/src/tasks/bluetooth/live_stats_functionality.c @@ -31,7 +31,7 @@ uint8_t handleLiveStatsWrite(dmConnId_t connId, uint16_t handle, uint8_t operati rtc_set_time_from_timestamp(*(uint32_t*)pValue); #ifdef _REMOTE_MODE_SWITCH_ENABLED else if (handle == APP_MODE_SWITCH_HANDLE) - app_switch_mode(*(uint8_t*)pValue); + app_allow_downloads(*(uint8_t*)pValue); #endif return ATT_SUCCESS; } diff --git a/software/firmware/tests/Makefile b/software/firmware/tests/Makefile index 1326b800..ee6b39eb 100644 --- a/software/firmware/tests/Makefile +++ b/software/firmware/tests/Makefile @@ -251,12 +251,12 @@ SRC += storage_task.c SRC += subscription_phase.c SRC += time_aligned_task.c -.PHONY: all program clean battery ble_and_range ble_reset bluetooth button buzzer full full_segger imu led logging power_off ranging ranging_radio ranging_power rtc_set rtc storage system +.PHONY: all program clean battery ble_and_range ble_reset bluetooth button buzzer full full_segger full_exp imu led logging power_off ranging ranging_radio ranging_power rtc_set rtc storage system .PRECIOUS: $(CONFIG)/%.axf .SECONDEXPANSION: all: - $(error Make targets include: battery ble_and_range ble_reset bluetooth button buzzer full full_segger imu led logging power_off ranging ranging_radio ranging_power rtc_set rtc storage system) + $(error Make targets include: battery ble_and_range ble_reset bluetooth button buzzer full full_segger full_exp imu led logging power_off ranging ranging_radio ranging_power rtc_set rtc storage system) # TODO: Create separate targets for non-flashing versions program: