Draw scrolling indicator

This commit is contained in:
Patrick Horlebein
2020-04-03 17:13:10 +02:00
parent 153772cb68
commit 07d35cadd9
2 changed files with 9 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ extern "C" {
#endif
#define DEVICEADDR_OLED (0x3c<<1)
#define OLED_WIDTH 96
#define OLED_HEIGHT 16
#define FRAMEBUFFER_START 17
class OLED {

View File

@@ -826,6 +826,11 @@ void gui_Menu(const menuitem *menu) {
int16_t lastOffset = -1;
bool lcdRefresh = true;
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) {
OLED::setFont(0);
@@ -836,6 +841,9 @@ void gui_Menu(const menuitem *menu) {
|| menu[currentScreen].description == NULL) {
OLED::clearScreen();
menu[currentScreen].draw.func();
uint8_t indicatorHeight = OLED_HEIGHT / scrollContentSize;
uint8_t position = currentScreen * indicatorHeight;
OLED::drawScrollIndicator(position, indicatorHeight);
lastOffset = -1;
lcdRefresh = true;
} else {