Description
On the LilyGo T-Embed CC1101, it is possible to hide the Config menu item via:
Config → System Config → Hide/Show Apps
After disabling Config, the Config item disappears from the main menu. Since Hide/Show Apps itself is accessible only through Config, there is no way to enable it again from the UI.
The only way to restore access to Config is to reset/reflash the device configuration.
Steps to reproduce
Open Config.
Go to System Config → Hide/Show Apps.
Disable Config.
Return to the main menu.
The Config menu item is no longer available.
There is no way to access the settings and enable it again.
Expected behavior
The Config menu item should always remain accessible and should not be possible to disable through Hide/Show Apps.
Relevant code
The Hide/Show Apps list is generated in MainMenu::hideAppsMenu():
|
_currentIndex = loopOptions(options, MENU_TYPE_MAIN, "Main Menu", _currentIndex); |
|
}; |
|
|
|
/********************************************************************* |
|
** Function: hideAppsMenu |
|
** Menu to Hide or show menus |
|
**********************************************************************/ |
|
|
|
void MainMenu::hideAppsMenu() { |
|
auto items = this->getItems(); |
|
int index = 0; |
|
RESTART: // using gotos to avoid stackoverflow after many choices |
|
options.clear(); |
|
for (auto item : items) { |
|
String label = item->getName(); |
In this loop, all menu items are added to the list, including Config:
for (auto item : items) {
String label = item->getName();
std::vector<String> l = bruceConfig.disabledMenus;
bool enabled = find(l.begin(), l.end(), label) == l.end();
options.push_back(
{label,
[this, label, enabled]() {
if (enabled) bruceConfig.addDisabledMenu(label);
else bruceConfig.removeDisabledMenu(label);
},
enabled}
);
}
Suggested fix
Exclude Config from the Hide/Show Apps list:
for (auto item : items) {
String label = item->getName();
// Config must always remain accessible
if (label == "Config") continue;
std::vector<String> l = bruceConfig.disabledMenus;
bool enabled = find(l.begin(), l.end(), label) == l.end();
options.push_back(
{label,
[this, label, enabled]() {
if (enabled) bruceConfig.addDisabledMenu(label);
else bruceConfig.removeDisabledMenu(label);
},
enabled}
);
}
Additionally, it may be worth ensuring that Config is always displayed even if "Config" is already present in disabledMenus from an existing configuration.
The relevant check when building the main menu is here:
Current code:
if (find(l.begin(), l.end(), itemName) == l.end()) {
Possible change:
if (itemName == "Config" || find(l.begin(), l.end(), itemName) == l.end()) {
This provides two safeguards:
- Config cannot be disabled through Hide/Show Apps.
- Config remains accessible for users who already have "Config" stored in disabledMenus.
Description
On the LilyGo T-Embed CC1101, it is possible to hide the Config menu item via:
Config → System Config → Hide/Show Apps
After disabling Config, the Config item disappears from the main menu. Since Hide/Show Apps itself is accessible only through Config, there is no way to enable it again from the UI.
The only way to restore access to Config is to reset/reflash the device configuration.
Steps to reproduce
Open Config.
Go to System Config → Hide/Show Apps.
Disable Config.
Return to the main menu.
The Config menu item is no longer available.
There is no way to access the settings and enable it again.
Expected behavior
The Config menu item should always remain accessible and should not be possible to disable through Hide/Show Apps.
Relevant code
The Hide/Show Apps list is generated in
MainMenu::hideAppsMenu():firmware/src/core/main_menu.cpp
Lines 69 to 83 in ba519c9
In this loop, all menu items are added to the list, including Config:
Suggested fix
Exclude Config from the Hide/Show Apps list:
for (auto item : items) {
String label = item->getName();
}
Additionally, it may be worth ensuring that Config is always displayed even if "Config" is already present in disabledMenus from an existing configuration.
The relevant check when building the main menu is here:
firmware/src/core/main_menu.cpp
Line 39 in ba519c9
Current code:
if (find(l.begin(), l.end(), itemName) == l.end()) {Possible change:
if (itemName == "Config" || find(l.begin(), l.end(), itemName) == l.end()) {This provides two safeguards: