Draw scrolling indicator
This commit is contained in:
@@ -24,6 +24,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
#define DEVICEADDR_OLED (0x3c<<1)
|
#define DEVICEADDR_OLED (0x3c<<1)
|
||||||
#define OLED_WIDTH 96
|
#define OLED_WIDTH 96
|
||||||
|
#define OLED_HEIGHT 16
|
||||||
#define FRAMEBUFFER_START 17
|
#define FRAMEBUFFER_START 17
|
||||||
|
|
||||||
class OLED {
|
class OLED {
|
||||||
|
|||||||
@@ -826,6 +826,11 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
int16_t lastOffset = -1;
|
int16_t lastOffset = -1;
|
||||||
bool lcdRefresh = true;
|
bool lcdRefresh = true;
|
||||||
ButtonState lastButtonState = BUTTON_NONE;
|
ButtonState lastButtonState = BUTTON_NONE;
|
||||||
|
uint8_t scrollContentSize = 0;
|
||||||
|
|
||||||
|
for (uint8_t i = 0; menu[i].draw.func != NULL; i++) {
|
||||||
|
scrollContentSize += 1;
|
||||||
|
}
|
||||||
|
|
||||||
while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
|
while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
|
||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
@@ -836,6 +841,9 @@ void gui_Menu(const menuitem *menu) {
|
|||||||
|| menu[currentScreen].description == NULL) {
|
|| menu[currentScreen].description == NULL) {
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
menu[currentScreen].draw.func();
|
menu[currentScreen].draw.func();
|
||||||
|
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
|
||||||
|
uint8_t position = currentScreen * indicatorHeight;
|
||||||
|
OLED::drawScrollIndicator(position, indicatorHeight);
|
||||||
lastOffset = -1;
|
lastOffset = -1;
|
||||||
lcdRefresh = true;
|
lcdRefresh = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user