Skip to content

Commit

Permalink
Allow switching back into non-download app mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Jun 27, 2024
1 parent 4f957b6 commit 50542ba
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
8 changes: 8 additions & 0 deletions software/firmware/.cproject
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="full_exp" path="tests" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>${cross_make}</buildCommand>
<buildArguments>BUILT_BY=eclipse BOARD_REV=M</buildArguments>
<buildTarget>full_exp</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>
22 changes: 16 additions & 6 deletions software/firmware/src/tasks/app_task_ranging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion software/firmware/src/tasks/app_tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions software/firmware/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 50542ba

Please sign in to comment.