Skip to content

Commit

Permalink
Implement _dispX as function local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Jan 20, 2023
1 parent 1d07574 commit 592dd73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion include/Display_Graphic.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class DisplayGraphicClass {

uint8_t _mExtra;
uint8_t _display_type = 0;
uint16_t _dispX = 0;
uint16_t _dispY = 0;
uint16_t _period = 1000;
uint16_t _interval = 60000; // interval at which to power save (milliseconds)
Expand Down
10 changes: 5 additions & 5 deletions src/Display_Graphic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,19 @@ void DisplayGraphicClass::printText(const char* text, uint8_t line)
break;
}

// get the font height, to calculate the textheight
// get the font height, to calculate the textheight
_dispY += (_display->getMaxCharHeight()) + 1;

// calculate the starting position of the text
uint16_t dispX;
if (line == 1) {
_dispX = 20 + ex;
dispX = 20 + ex;
} else {
_dispX = 5 + ex;
dispX = 5 + ex;
}

// draw the Text, on the calculated pos
_display->drawStr(_dispX, _dispY, text);
_display->drawStr(dispX, _dispY, text);
}

void DisplayGraphicClass::loop()
Expand Down Expand Up @@ -191,7 +192,6 @@ void DisplayGraphicClass::loop()
}
_display->sendBuffer();

_dispX = 0;
_dispY = 0;
_mExtra++;
_lastDisplayUpdate = millis();
Expand Down

0 comments on commit 592dd73

Please sign in to comment.