mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-31 19:05:44 +00:00
Show/Hide Favorites as an option
This commit is contained in:
parent
a60002a7f9
commit
a97e40dc8e
@ -1003,6 +1003,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
if (numMeshNodes > 0)
|
if (numMeshNodes > 0)
|
||||||
numMeshNodes--;
|
numMeshNodes--;
|
||||||
|
|
||||||
|
if (!hiddenFrames.show_favorites) {
|
||||||
// Temporary array to hold favorite node frames
|
// Temporary array to hold favorite node frames
|
||||||
std::vector<FrameCallback> favoriteFrames;
|
std::vector<FrameCallback> favoriteFrames;
|
||||||
|
|
||||||
@ -1025,6 +1026,7 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
fsi.positions.firstFavorite = 255;
|
fsi.positions.firstFavorite = 255;
|
||||||
fsi.positions.lastFavorite = 255;
|
fsi.positions.lastFavorite = 255;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
|
fsi.frameCount = numframes; // Total framecount is used to apply FOCUS_PRESERVE
|
||||||
this->frameCount = numframes; // ✅ Save frame count for use in custom overlay
|
this->frameCount = numframes; // ✅ Save frame count for use in custom overlay
|
||||||
@ -1122,6 +1124,9 @@ void Screen::toggleFrameVisibility(const std::string &frameName)
|
|||||||
if (frameName == "clock") {
|
if (frameName == "clock") {
|
||||||
hiddenFrames.clock = !hiddenFrames.clock;
|
hiddenFrames.clock = !hiddenFrames.clock;
|
||||||
}
|
}
|
||||||
|
if (frameName == "show_favorites") {
|
||||||
|
hiddenFrames.show_favorites = !hiddenFrames.show_favorites;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Screen::isFrameHidden(const std::string &frameName) const
|
bool Screen::isFrameHidden(const std::string &frameName) const
|
||||||
@ -1148,6 +1153,8 @@ bool Screen::isFrameHidden(const std::string &frameName) const
|
|||||||
return hiddenFrames.lora;
|
return hiddenFrames.lora;
|
||||||
if (frameName == "clock")
|
if (frameName == "clock")
|
||||||
return hiddenFrames.clock;
|
return hiddenFrames.clock;
|
||||||
|
if (frameName == "show_favorites")
|
||||||
|
return hiddenFrames.show_favorites;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -695,6 +695,7 @@ class Screen : public concurrency::OSThread
|
|||||||
bool gps = false;
|
bool gps = false;
|
||||||
#endif
|
#endif
|
||||||
bool lora = false;
|
bool lora = false;
|
||||||
|
bool show_favorites = false;
|
||||||
} hiddenFrames;
|
} hiddenFrames;
|
||||||
|
|
||||||
/// Try to start drawing ASAP
|
/// Try to start drawing ASAP
|
||||||
|
@ -1103,6 +1103,7 @@ void menuHandler::FrameToggles_menu()
|
|||||||
gps,
|
gps,
|
||||||
lora,
|
lora,
|
||||||
clock,
|
clock,
|
||||||
|
show_favorites,
|
||||||
enumEnd
|
enumEnd
|
||||||
};
|
};
|
||||||
static const char *optionsArray[enumEnd] = {"Finish"};
|
static const char *optionsArray[enumEnd] = {"Finish"};
|
||||||
@ -1133,6 +1134,9 @@ void menuHandler::FrameToggles_menu()
|
|||||||
|
|
||||||
optionsArray[options] = screen->isFrameHidden("clock") ? "Show Clock" : "Hide Clock";
|
optionsArray[options] = screen->isFrameHidden("clock") ? "Show Clock" : "Hide Clock";
|
||||||
optionsEnumArray[options++] = clock;
|
optionsEnumArray[options++] = clock;
|
||||||
|
|
||||||
|
optionsArray[options] = screen->isFrameHidden("show_favorites") ? "Show Favorites" : "Hide Favorites";
|
||||||
|
optionsEnumArray[options++] = show_favorites;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BannerOverlayOptions bannerOptions;
|
BannerOverlayOptions bannerOptions;
|
||||||
@ -1175,6 +1179,10 @@ void menuHandler::FrameToggles_menu()
|
|||||||
screen->toggleFrameVisibility("clock");
|
screen->toggleFrameVisibility("clock");
|
||||||
menuHandler::menuQueue = menuHandler::FrameToggles;
|
menuHandler::menuQueue = menuHandler::FrameToggles;
|
||||||
screen->runNow();
|
screen->runNow();
|
||||||
|
} else if (selected == show_favorites) {
|
||||||
|
screen->toggleFrameVisibility("show_favorites");
|
||||||
|
menuHandler::menuQueue = menuHandler::FrameToggles;
|
||||||
|
screen->runNow();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
screen->showOverlayBanner(bannerOptions);
|
screen->showOverlayBanner(bannerOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user