1
0
forked from me/IronOS

Use tabs instead of spaces.

This commit is contained in:
Patrick Horlebein
2020-04-16 11:16:17 +02:00
parent 07d35cadd9
commit add8993da5
3 changed files with 24 additions and 24 deletions

View File

@@ -100,7 +100,7 @@ public:
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
bool clear); bool clear);
static void drawHeatSymbol(uint8_t state); static void drawHeatSymbol(uint8_t state);
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
private: private:
static void drawChar(char c); // Draw a character to a specific location static void drawChar(char c); // Draw a character to a specific location
static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer

View File

@@ -111,18 +111,18 @@ void OLED::drawChar(char c) {
* of the indicator in pixels (0..<16). * of the indicator in pixels (0..<16).
*/ */
void OLED::drawScrollIndicator(uint8_t y, uint8_t height) { void OLED::drawScrollIndicator(uint8_t y, uint8_t height) {
union u_type { union u_type {
uint16_t whole; uint16_t whole;
uint8_t strips[2]; uint8_t strips[2];
} column; } column;
column.whole = (1 << height) - 1; column.whole = (1 << height) - 1;
column.whole <<= y; column.whole <<= y;
// Draw a one pixel wide bar to the left with a single pixel as // Draw a one pixel wide bar to the left with a single pixel as
// the scroll indicator. // the scroll indicator.
fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]); fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]);
fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]); fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]);
} }
void OLED::setRotation(bool leftHanded) { void OLED::setRotation(bool leftHanded) {

View File

@@ -264,8 +264,8 @@ static void printShortDescription(uint32_t shortDescIndex,
// prepare cursor for value // prepare cursor for value
OLED::setFont(0); OLED::setFont(0);
OLED::setCharCursor(cursorCharPosition, 0); OLED::setCharCursor(cursorCharPosition, 0);
// make room for scroll indicator // make room for scroll indicator
OLED::setCursor(OLED::getCursorX() - 2, 0); OLED::setCursor(OLED::getCursorX() - 2, 0);
} }
static int userConfirmation(const char *message) { static int userConfirmation(const char *message) {
@@ -784,7 +784,7 @@ static void displayMenu(size_t index) {
OLED::print(SettingsMenuEntries[index]); OLED::print(SettingsMenuEntries[index]);
// Draw symbol // Draw symbol
// 16 pixel wide image // 16 pixel wide image
// 2 pixel wide scrolling indicator // 2 pixel wide scrolling indicator
OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index])); OLED::drawArea(96 - 16 - 2, 0, 16, 16, (&SettingsMenuIcons[(16 * 2) * index]));
} }
@@ -826,11 +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; uint8_t scrollContentSize = 0;
for (uint8_t i = 0; menu[i].draw.func != NULL; i++) { for (uint8_t i = 0; menu[i].draw.func != NULL; i++) {
scrollContentSize += 1; scrollContentSize += 1;
} }
while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) { while ((menu[currentScreen].draw.func != NULL) && earlyExit == false) {
OLED::setFont(0); OLED::setFont(0);
@@ -841,9 +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 indicatorHeight = OLED_HEIGHT / scrollContentSize;
uint8_t position = currentScreen * indicatorHeight; uint8_t position = currentScreen * indicatorHeight;
OLED::drawScrollIndicator(position, indicatorHeight); OLED::drawScrollIndicator(position, indicatorHeight);
lastOffset = -1; lastOffset = -1;
lcdRefresh = true; lcdRefresh = true;
} else { } else {