TB2026-YDS Firmware
Loading...
Searching...
No Matches
autonomy.h
Go to the documentation of this file.
1
21#pragma once
22
23#include "esp_err.h"
24#include <stdbool.h>
25#include <stdint.h>
26
33
40
49
51typedef struct {
52 bool running;
54 uint32_t elapsed_ms;
56
71esp_err_t autonomy_start(autonomy_test_t type);
72
76void autonomy_cancel(void);
77
79bool autonomy_is_running(void);
80
86
95void autonomy_tick(void);
96
107esp_err_t autonomy_boot_export(void);
108
119esp_err_t autonomy_redump(void);
120
123
126
128uint32_t autonomy_get_last_duration_s(void);
129
132
esp_err_t autonomy_start(autonomy_test_t type)
Start an autonomy run with the given workload.
Definition autonomy.c:319
esp_err_t autonomy_redump(void)
Re-export the last stored run to a fresh CSV on the SD card (without rebooting).
Definition autonomy.c:435
autonomy_test_t
Which workload the run exercises.
Definition autonomy.h:35
void autonomy_tick(void)
Periodic hook, called from the maintenance task (after power_tick()).
Definition autonomy.c:372
autonomy_test_t autonomy_get_last_type(void)
Workload of the most recent run (valid when the last result is not NONE).
Definition autonomy.c:443
void autonomy_get_status(autonomy_status_t *out)
Copy the running test's snapshot.
Definition autonomy.c:364
uint32_t autonomy_get_last_duration_s(void)
Duration of the most recent run in seconds (0 if none).
Definition autonomy.c:444
esp_err_t autonomy_boot_export(void)
Export a stored (not-yet-exported) run to a CSV on the SD card. Call once at boot.
Definition autonomy.c:406
bool autonomy_is_running(void)
Whether a run is currently in progress.
Definition autonomy.c:359
bool autonomy_get_last_dump_ok(void)
Whether the most recent run has been successfully written to the SD card.
Definition autonomy.c:445
void autonomy_cancel(void)
Cancel the running test, keeping it as the last (cancelled) result. No-op if idle.
Definition autonomy.c:352
autonomy_result_t
Outcome of the most recent run, for the UI's "Last run" block.
Definition autonomy.h:42
autonomy_result_t autonomy_get_last_result(void)
Outcome of the most recent run (AUTONOMY_RESULT_NONE until one happens).
Definition autonomy.c:442
@ AUTONOMY_TEST_BT
Looped playback to a connected Bluetooth sink.
Definition autonomy.h:38
@ AUTONOMY_TEST_IDLE
No playback, standard idle.
Definition autonomy.h:36
@ AUTONOMY_TEST_JACK
Looped playback to the wired jack (DAC).
Definition autonomy.h:37
@ AUTONOMY_RESULT_NONE
No run recorded yet.
Definition autonomy.h:43
@ AUTONOMY_RESULT_ABORTED
USB was plugged mid-run: the measurement is invalid.
Definition autonomy.h:46
@ AUTONOMY_RESULT_CANCELLED
The user cancelled the run (B).
Definition autonomy.h:44
@ AUTONOMY_RESULT_INTERRUPTED
The run never finished cleanly (crash/reset mid-test); partial data.
Definition autonomy.h:47
@ AUTONOMY_RESULT_COMPLETED
The run ran to battery shutdown.
Definition autonomy.h:45
Snapshot of the running test, for the in-progress screen.
Definition autonomy.h:51
uint32_t elapsed_ms
Time since the run started, ms (0 when not running).
Definition autonomy.h:54
bool running
true between autonomy_start() and cancel/shutdown.
Definition autonomy.h:52
autonomy_test_t type
Workload of the running test (valid when running).
Definition autonomy.h:53