TB2026-YDS Firmware
Loading...
Searching...
No Matches
battery_test.c File Reference

Battery autonomy test screen: pick a workload, check readiness, review the last run. More...

#include "battery_test.h"
#include "storage_screen.h"
#include "bluetooth_settings.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "power.h"
#include "player.h"
#include "volume.h"
#include "bluetooth.h"
#include "storage.h"
#include "autonomy.h"
#include <stdio.h>
#include <string.h>

Macros

#define ACCENT   gfx_rgb(255, 120, 0) /* Stats identity colour (see stats_screen) */
#define DIM   gfx_rgb(110, 110, 110)
#define WARN   gfx_rgb(255, 180, 0)
#define OKC   gfx_rgb(0, 255, 0)
#define PAD_X   6
#define TITLE_Y   (STATUS_BAR_H + 4)
#define TYPE_Y   34 /* workload picker */
#define SONG_Y   47 /* "Select song" row (Jack/BT), above the speaker row */
#define SINK_Y   60 /* "Connect speaker" row (BT) */
#define READY_Y   75 /* Batt line — this block down (through "SD dump") is fixed on screen */
#define LAST_Y   89
#define L1_Y   100
#define L2_Y   111
#define L3_Y   122
#define L4_Y   133
#define BTN_Y   150 /* START and RE-DUMP SD share this row, side by side */
#define BTN_H   15
#define BTN_GAP   6 /* horizontal gap between the two buttons */
#define NAME_MAX   22 /* device/track names are truncated to fit a centred "< name >" row */
#define READY_SOC_PCT   99.0f /* a run is only meaningful starting from a full cell */
#define N_TYPES   (int)(sizeof k_types / sizeof k_types[0])

Enumerations

enum  {
  ZONE_TYPE = 0 , ZONE_TRACK , ZONE_SINK , ZONE_START ,
  ZONE_REDUMP , N_ZONES
}

Functions

screen_tbattery_test_screen (void)
 Get the singleton battery-autonomy-test screen, ready to push onto the navigator.

Detailed Description

Battery autonomy test screen: pick a workload, check readiness, review the last run.

Layout is fixed: the picker and the two setup rows sit above a fixed telemetry block (Batt + last run) and a shared button row. UP/DOWN cycles focus but skips rows that don't apply to the mode and buttons that are greyed out, so the cursor never lands on something it can't act on. The orange < > chevrons flank whichever row is focused.

  • Type : workload picker, the three modes on one line (LEFT/RIGHT cycles Idle/Jack/BT).
  • Track : "Select song" — Jack/BT open the library to pick the song; shows the playing track.
  • Sink : "Connect speaker" — BT opens the Bluetooth screen; shows the connected device. Both setup rows are always drawn (dim when the mode doesn't use them).
  • Start : arm the run (enabled from a full cell off external power, with a live Jack/BT stream).
  • Re-dump : re-export the last run's CSV to the SD card (enabled with a stored run + mounted card).
Note
Développé avec l'assistance de Claude Opus 4.8 (Anthropic), sous la direction de Y. Dos Santos : spécification, revue et validation sur cible par l'auteur.

Macro Definition Documentation

◆ ACCENT

#define ACCENT   gfx_rgb(255, 120, 0) /* Stats identity colour (see stats_screen) */

◆ BTN_GAP

#define BTN_GAP   6 /* horizontal gap between the two buttons */

◆ BTN_H

#define BTN_H   15

◆ BTN_Y

#define BTN_Y   150 /* START and RE-DUMP SD share this row, side by side */

◆ DIM

#define DIM   gfx_rgb(110, 110, 110)

◆ L1_Y

#define L1_Y   100

◆ L2_Y

#define L2_Y   111

◆ L3_Y

#define L3_Y   122

◆ L4_Y

#define L4_Y   133

◆ LAST_Y

#define LAST_Y   89

◆ N_TYPES

#define N_TYPES   (int)(sizeof k_types / sizeof k_types[0])

◆ NAME_MAX

#define NAME_MAX   22 /* device/track names are truncated to fit a centred "< name >" row */

◆ OKC

#define OKC   gfx_rgb(0, 255, 0)

◆ PAD_X

#define PAD_X   6

◆ READY_SOC_PCT

#define READY_SOC_PCT   99.0f /* a run is only meaningful starting from a full cell */

◆ READY_Y

#define READY_Y   75 /* Batt line — this block down (through "SD dump") is fixed on screen */

◆ SINK_Y

#define SINK_Y   60 /* "Connect speaker" row (BT) */

◆ SONG_Y

#define SONG_Y   47 /* "Select song" row (Jack/BT), above the speaker row */

◆ TITLE_Y

#define TITLE_Y   (STATUS_BAR_H + 4)

◆ TYPE_Y

#define TYPE_Y   34 /* workload picker */

◆ WARN

#define WARN   gfx_rgb(255, 180, 0)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ZONE_TYPE 
ZONE_TRACK 
ZONE_SINK 
ZONE_START 
ZONE_REDUMP 
N_ZONES 

Function Documentation

◆ battery_test_screen()

screen_t * battery_test_screen ( void )

Get the singleton battery-autonomy-test screen, ready to push onto the navigator.

Returns
Pointer to the battery test screen.