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

Power sub-menu on a single screen: sleep delay, auto power-off, and power off. More...

#include "power_settings.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "power.h"
#include "player.h"
#include <stdio.h>
#include <string.h>

Macros

#define ACCENT   gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */
#define DIM   gfx_rgb(110, 110, 110)
#define WARN   gfx_rgb(255, 180, 0)
#define N_SLEEP   (int)(sizeof k_sleep_presets / sizeof k_sleep_presets[0])
#define N_OFF   (int)(sizeof k_off_presets / sizeof k_off_presets[0])
#define SLEEP_TITLE_Y   26
#define SLEEP_VAL_Y   44
#define OFF_TITLE_Y   84
#define OFF_VAL_Y   102
#define BTN_Y   140
#define BTN_H   26

Enumerations

enum  { ZONE_SLEEP = 0 , ZONE_OFF , ZONE_POWEROFF , N_ZONES }

Functions

screen_tpower_settings_screen (void)
 Get the singleton Power sub-menu, ready to push onto the navigator.

Detailed Description

Power sub-menu on a single screen: sleep delay, auto power-off, and power off.

One screen split into three vertical zones; UP/DOWN moves the focus between them:

  • Sleep : horizontal preset picker (LEFT/RIGHT cycles, wrapping) for the screen sleep delay.
  • Auto off : same, for the auto power-off delay.
  • Power off: a centred button. SELECT opens a confirmation popup with Confirm/Cancel.

The two idle timeouts are persisted through the power service on BACK, only if they actually moved (Rule 13: no NVS write per scroll step).

Power-off is gated on external power: SELECT on Confirm releases EnableReg and cuts the rail (power_shutdown() never returns). The rail is also latched on by USB, so shutting down while USB is connected would spin power_shutdown() forever – when USB is present the popup shows a warning and refuses instead of walking into that dead end.

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, 0, 0) /* Settings identity colour (see root_menu) */

◆ BTN_H

#define BTN_H   26

◆ BTN_Y

#define BTN_Y   140

◆ DIM

#define DIM   gfx_rgb(110, 110, 110)

◆ N_OFF

#define N_OFF   (int)(sizeof k_off_presets / sizeof k_off_presets[0])

◆ N_SLEEP

#define N_SLEEP   (int)(sizeof k_sleep_presets / sizeof k_sleep_presets[0])

◆ OFF_TITLE_Y

#define OFF_TITLE_Y   84

◆ OFF_VAL_Y

#define OFF_VAL_Y   102

◆ SLEEP_TITLE_Y

#define SLEEP_TITLE_Y   26

◆ SLEEP_VAL_Y

#define SLEEP_VAL_Y   44

◆ WARN

#define WARN   gfx_rgb(255, 180, 0)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ZONE_SLEEP 
ZONE_OFF 
ZONE_POWEROFF 
N_ZONES 

Function Documentation

◆ power_settings_screen()

screen_t * power_settings_screen ( void )

Get the singleton Power sub-menu, ready to push onto the navigator.

Returns
Pointer to the Power sub-menu screen.