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

Bluetooth settings: one combined screen listing paired and nearby devices. More...

#include "bluetooth_settings.h"
#include "navigator.h"
#include "status_bar.h"
#include "gfx.h"
#include "bluetooth.h"
#include "player.h"
#include "volume.h"
#include <string.h>

Macros

#define CONTENT_Y0   (STATUS_BAR_H + 2)
#define LINE_H   14
#define CARET_X   3
#define TEXT_X   13
#define NAME_MAXCH   20 /* name chars drawn before the signal column */
#define SIGNAL_X   150 /* signal bars / connected dot, at the right margin */
#define REFRESH_MS   250 /* live re-render cadence while scanning/connecting */
#define ACCENT   gfx_rgb(255, 0, 0) /* Settings identity colour (see root_menu) */
#define DIM   gfx_rgb(110, 110, 110)
#define ROW_Y(v)
#define SHOWN(v)

Enumerations

enum  row_kind_t { ROW_KNOWN , ROW_SCAN , ROW_NEAR }

Functions

screen_tbluetooth_settings_screen (void)
 Get the singleton Bluetooth settings screen, ready to push onto the navigator.

Detailed Description

Bluetooth settings: one combined screen listing paired and nearby devices.

Layout (below the always-present status bar): a "KNOWN DEVICES" section from the persisted known list (most-recent first, so the last device sits on top), then a "NEARBY" section with a "Scan" action and the live scan results (signal shown as bars + dBm). A caret ">" marks the selection – no full white bar, which on this passive OLED lights OFF pixels across the line.

Power: the radio is off by default. Entering this screen shows the paired list straight from NVS with the radio down. It is powered up (bluetooth_init) only when the user scans or connects, and powered down again (bluetooth_shutdown) on exit unless a link is up – so it draws current only while scanning or connected, per the project's power rule. While the screen is open it also suppresses the service's auto power-down on link drop (see bluetooth_set_auto_shutdown), so a manual disconnect keeps the radio up for the next action; outside the screen the service powers itself down when the link drops.

Selecting a nearby device connects to it. Selecting a paired device opens a small popup with Connect/Disconnect and Forget.

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

◆ CARET_X

#define CARET_X   3

◆ CONTENT_Y0

#define CONTENT_Y0   (STATUS_BAR_H + 2)

◆ DIM

#define DIM   gfx_rgb(110, 110, 110)

◆ LINE_H

#define LINE_H   14

◆ NAME_MAXCH

#define NAME_MAXCH   20 /* name chars drawn before the signal column */

◆ REFRESH_MS

#define REFRESH_MS   250 /* live re-render cadence while scanning/connecting */

◆ ROW_Y

#define ROW_Y ( v)
Value:
(CONTENT_Y0 + ((v) - s_top) * LINE_H)
#define LINE_H
Definition bluetooth_settings.c:38
#define CONTENT_Y0
Definition bluetooth_settings.c:37

◆ SHOWN

#define SHOWN ( v)
Value:
((v) >= s_top && (v) < s_top + visible)

◆ SIGNAL_X

#define SIGNAL_X   150 /* signal bars / connected dot, at the right margin */

◆ TEXT_X

#define TEXT_X   13

Enumeration Type Documentation

◆ row_kind_t

enum row_kind_t
Enumerator
ROW_KNOWN 
ROW_SCAN 
ROW_NEAR 

Function Documentation

◆ bluetooth_settings_screen()

screen_t * bluetooth_settings_screen ( void )

Get the singleton Bluetooth settings screen, ready to push onto the navigator.

Returns
Pointer to the Bluetooth settings screen.