mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-06 12:16:11 +00:00
refactor(ui): tag SettingsScreen ifdefs with semantic FEAT_* macros
Extends Features.h with preprocessor flags (FEAT_BRIGHTNESS_SETTING, FEAT_CLOCK_SECONDS_SETTING, FEAT_DISPLAY_ROTATION_SETTING, FEAT_JOYSTICK_ROTATION_SETTING, FEAT_FULL_REFRESH_SETTING) since constexpr can't gate enum members or class fields. SettingsScreen.h now uses #if FEAT_X instead of #if defined(EINK_DISPLAY_MODEL) — grep on the feature name finds the toggle and every use site, and the condition names *what* the gate controls. Driver headers (DisplayDriver.h, GxEPDDisplay.h) keep raw EINK_DISPLAY_MODEL — they're below the companion_radio layer and the ifdef there gates on the build's panel type, not a UI feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7c81ea0f52
commit
900f2d59e9
@@ -1,11 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
// Build-time feature flags derived from board defines.
|
||||
// Use these instead of `#ifdef EINK_DISPLAY_MODEL` for runtime-shape decisions
|
||||
// (booleans, timings, defaults). Compiler dead-branch-eliminates on the
|
||||
// constexpr, so cost is identical to a preprocessor branch but the code
|
||||
// remains readable and reachable to tooling. Conditional struct members
|
||||
// (enum entries, NodePrefs fields) still need a real `#if defined(...)`.
|
||||
// Build-time feature flags derived from board defines. Two flavours:
|
||||
//
|
||||
// FEAT_* preprocessor macros — for conditional compilation of struct
|
||||
// members, enum entries, and class fields where the preprocessor must
|
||||
// run. Use `#if FEAT_X` instead of `#ifdef EINK_DISPLAY_MODEL`; the
|
||||
// name documents *what* the flag toggles rather than *why* it's bound
|
||||
// to e-ink.
|
||||
//
|
||||
// Features::* constexpr values — for runtime-shape decisions (booleans,
|
||||
// timings, defaults). Compiler dead-branch-eliminates on the constexpr,
|
||||
// so cost is identical to a preprocessor branch but the code stays
|
||||
// reachable to tooling.
|
||||
|
||||
#if defined(EINK_DISPLAY_MODEL)
|
||||
// E-ink build: slow refresh, rotatable panel, no per-second redraws
|
||||
#define FEAT_BRIGHTNESS_SETTING 0
|
||||
#define FEAT_CLOCK_SECONDS_SETTING 0
|
||||
#define FEAT_DISPLAY_ROTATION_SETTING 1
|
||||
#define FEAT_JOYSTICK_ROTATION_SETTING 1
|
||||
#define FEAT_FULL_REFRESH_SETTING 1
|
||||
#else
|
||||
// OLED build: fast refresh, fixed orientation
|
||||
#define FEAT_BRIGHTNESS_SETTING 1
|
||||
#define FEAT_CLOCK_SECONDS_SETTING 1
|
||||
#define FEAT_DISPLAY_ROTATION_SETTING 0
|
||||
#define FEAT_JOYSTICK_ROTATION_SETTING 0
|
||||
#define FEAT_FULL_REFRESH_SETTING 0
|
||||
#endif
|
||||
|
||||
namespace Features {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user