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

Fuel-gauge debug screen: config-vs-expected check, learned state, EZ reload. More...

#include "fuel_gauge_debug.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "fuel_gauge.h"
#include "power.h"
#include "autonomy.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <stdio.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 BADC   gfx_rgb(255, 60, 60)
#define PAD_X   6
#define TITLE_Y   (STATUS_BAR_H + 4)
#define BODY_Y   (TITLE_Y + 16)
#define LINE_H   12
#define GROUP_GAP   4
#define VAL_X   (PAD_X + 10 * GFX_CHAR_W) /* value column, after the longest label */
#define STATUS_X   126 /* OK/BAD verdict column */
#define HINT_Y   162
#define LEARNED_WARN_FRACTION   1.10f

Functions

screen_tfuel_gauge_debug_screen (void)
 Get the singleton fuel-gauge debug screen, ready to push onto the navigator.

Detailed Description

Fuel-gauge debug screen: config-vs-expected check, learned state, EZ reload.

The config rows compare the gauge's shadow-RAM registers against the values fuel_gauge_init() writes, so a lost configuration (POR) or stale constants show up at a glance. The learned block exposes the capacity the ModelGauge has converged on; a value well above design is the corrupted-learning symptom this page exists to catch. A (behind a confirmation popup) re-runs the EZ model load to purge that state — the cycle counter is preserved, health restarts at 100% by design.

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) */

◆ BADC

#define BADC   gfx_rgb(255, 60, 60)

◆ BODY_Y

#define BODY_Y   (TITLE_Y + 16)

◆ DIM

#define DIM   gfx_rgb(110, 110, 110)

◆ GROUP_GAP

#define GROUP_GAP   4

◆ HINT_Y

#define HINT_Y   162

◆ LEARNED_WARN_FRACTION

#define LEARNED_WARN_FRACTION   1.10f

◆ LINE_H

#define LINE_H   12

◆ OKC

#define OKC   gfx_rgb(0, 255, 0)

◆ PAD_X

#define PAD_X   6

◆ STATUS_X

#define STATUS_X   126 /* OK/BAD verdict column */

◆ TITLE_Y

#define TITLE_Y   (STATUS_BAR_H + 4)

◆ VAL_X

#define VAL_X   (PAD_X + 10 * GFX_CHAR_W) /* value column, after the longest label */

◆ WARN

#define WARN   gfx_rgb(255, 180, 0)

Function Documentation

◆ fuel_gauge_debug_screen()

screen_t * fuel_gauge_debug_screen ( void )

Get the singleton fuel-gauge debug screen, ready to push onto the navigator.

Returns
Pointer to the fuel-gauge debug screen.