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

Statistics / diagnostics menu: a top-level list over five live detail pages. More...

#include "stats_screen.h"
#include "battery_test.h"
#include "fuel_gauge_debug.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "icons.h"
#include "power.h"
#include "board_pins.h"
#include "gpio_expander.h"
#include "fuel_gauge.h"
#include "storage.h"
#include "sdcard.h"
#include "bluetooth.h"
#include "input.h"
#include "volume.h"
#include "audio_dac.h"
#include "i2c_bus.h"
#include "driver/i2c_master.h"
#include "esp_timer.h"
#include "esp_system.h"
#include "esp_heap_caps.h"
#include "esp_app_desc.h"
#include "esp_idf_version.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>

Macros

#define PAD_X   6
#define BODY_Y   (STATUS_BAR_H + 4) /* content starts just under the status bar (no page title) */
#define LINE_H   12
#define BATT_HINT_Y   162 /* footer hint on the Battery page */
#define GROUP_GAP   4
#define STATUS_X   120
#define DETAIL_REFRESH_MS   250 /* live re-render cadence for the detail pages */
#define ADDR_FUEL_GAUGE   0x36
#define ADDR_EXPANDER   0x38
#define ADDR_DAC   0x4C
#define DAC_CLK_BAD_MASK   0x23
#define DETAIL(render_fn)
#define N_ITEMS   5
#define MENU_ROW_H   32 /* 160px content / 5 items = 32px even slices */
#define MENU_Y0   (STATUS_BAR_H + 8) /* symmetric top/bottom margins */
#define MENU_ARROW_X   2
#define MENU_ICON_X   18
#define MENU_TEXT_X   40
#define MENU_SCALE   2

Functions

screen_tstats_screen (void)
 Get the singleton Statistics screen, ready to push onto the navigator.

Detailed Description

Statistics / diagnostics menu: a top-level list over five live detail pages.

The menu reuses no generic widget (it offsets content below the status bar, which the generic menu_screen does not). Each detail page sets screen_t::refresh_ms so the UI task re-renders it every DETAIL_REFRESH_MS for live values; the menu itself stays event-driven.

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

◆ ADDR_DAC

#define ADDR_DAC   0x4C

◆ ADDR_EXPANDER

#define ADDR_EXPANDER   0x38

◆ ADDR_FUEL_GAUGE

#define ADDR_FUEL_GAUGE   0x36

◆ BATT_HINT_Y

#define BATT_HINT_Y   162 /* footer hint on the Battery page */

◆ BODY_Y

#define BODY_Y   (STATUS_BAR_H + 4) /* content starts just under the status bar (no page title) */

◆ DAC_CLK_BAD_MASK

#define DAC_CLK_BAD_MASK   0x23

◆ DETAIL

#define DETAIL ( render_fn)
Value:
{ \
.on_enter = noop, \
.on_exit = noop, \
.handle_input = detail_input, \
.render = (render_fn), \
.refresh_ms = DETAIL_REFRESH_MS, \
}
#define DETAIL_REFRESH_MS
Definition stats_screen.c:57

◆ DETAIL_REFRESH_MS

#define DETAIL_REFRESH_MS   250 /* live re-render cadence for the detail pages */

◆ GROUP_GAP

#define GROUP_GAP   4

◆ LINE_H

#define LINE_H   12

◆ MENU_ARROW_X

#define MENU_ARROW_X   2

◆ MENU_ICON_X

#define MENU_ICON_X   18

◆ MENU_ROW_H

#define MENU_ROW_H   32 /* 160px content / 5 items = 32px even slices */

◆ MENU_SCALE

#define MENU_SCALE   2

◆ MENU_TEXT_X

#define MENU_TEXT_X   40

◆ MENU_Y0

#define MENU_Y0   (STATUS_BAR_H + 8) /* symmetric top/bottom margins */

◆ N_ITEMS

#define N_ITEMS   5

◆ PAD_X

#define PAD_X   6

◆ STATUS_X

#define STATUS_X   120

Function Documentation

◆ stats_screen()

screen_t * stats_screen ( void )

Get the singleton Statistics screen, ready to push onto the navigator.

Returns
Pointer to the Statistics screen.