mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-31 09:18:12 +00:00
refactor(prefs): centralise home-page bit numbering in NodePrefs::HomePageBit
pageBit/bitToPage in HomeScreen and homePageBitIndex in SettingsScreen each spelled out the bit assignment with magic numbers 0..10. Lift the numbering into a NodePrefs::HomePageBit enum (HPB_CLOCK … HPB_QUICK_MSG, HPB_COUNT) and route every reference through it: mapping functions, the HP_* bitmasks, the homePageLabel table sizing, loop bounds over page_order, the bounds check on page_order[0], the "always-visible" discriminator for SETTINGS/QUICK_MSG. Per-class enums (HomeScreen::HomePage, SettingsScreen::SettingItem) stay — they index different concerns (navigation page vs. settings row). The mapping functions still exist, but now reference a single source of truth for the bit values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
900f2d59e9
commit
a4b4362b1b
@@ -300,7 +300,7 @@ void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& no
|
||||
// Migration: pre-magic firmware wrote page_order without a flag. If we see a plausible
|
||||
// first entry from such a save, accept it once — savePrefs will then persist the magic.
|
||||
if (_prefs.page_order_set != NodePrefs::PAGE_ORDER_MAGIC
|
||||
&& _prefs.page_order[0] >= 1 && _prefs.page_order[0] <= 11) {
|
||||
&& _prefs.page_order[0] >= 1 && _prefs.page_order[0] <= NodePrefs::HPB_COUNT) {
|
||||
_prefs.page_order_set = NodePrefs::PAGE_ORDER_MAGIC;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user