Implement _dispX as function local variable

This commit is contained in:
Thomas Basler 2023-01-18 21:34:20 +01:00
parent 1d07574f8a
commit 592dd73fca
2 changed files with 5 additions and 6 deletions

View File

@ -22,7 +22,6 @@ private:
uint8_t _mExtra; uint8_t _mExtra;
uint8_t _display_type = 0; uint8_t _display_type = 0;
uint16_t _dispX = 0;
uint16_t _dispY = 0; uint16_t _dispY = 0;
uint16_t _period = 1000; uint16_t _period = 1000;
uint16_t _interval = 60000; // interval at which to power save (milliseconds) uint16_t _interval = 60000; // interval at which to power save (milliseconds)

View File

@ -95,14 +95,15 @@ void DisplayGraphicClass::printText(const char* text, uint8_t line)
_dispY += (_display->getMaxCharHeight()) + 1; _dispY += (_display->getMaxCharHeight()) + 1;
// calculate the starting position of the text // calculate the starting position of the text
uint16_t dispX;
if (line == 1) { if (line == 1) {
_dispX = 20 + ex; dispX = 20 + ex;
} else { } else {
_dispX = 5 + ex; dispX = 5 + ex;
} }
// draw the Text, on the calculated pos // draw the Text, on the calculated pos
_display->drawStr(_dispX, _dispY, text); _display->drawStr(dispX, _dispY, text);
} }
void DisplayGraphicClass::loop() void DisplayGraphicClass::loop()
@ -191,7 +192,6 @@ void DisplayGraphicClass::loop()
} }
_display->sendBuffer(); _display->sendBuffer();
_dispX = 0;
_dispY = 0; _dispY = 0;
_mExtra++; _mExtra++;
_lastDisplayUpdate = millis(); _lastDisplayUpdate = millis();