Skip to content

Commit 004c14f

Browse files
boldtamandel
andauthored
Improve display in server mode (#314)
* Improve display in server mode * Do not clear the display, when the HTTPSServer ist created. Thus, the APL info stays in the display until the loading bar shows up * Refine display of ALP message Co-authored-by: amandel <andreas.mandel@gmail.com>
1 parent fb3fe4a commit 004c14f

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

src/OpenBikeSensorFirmware.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ void handleButtonInServerMode() {
368368
button.handle();
369369
if (!configServerWasConnectedViaHttp()) {
370370
if (button.gotPressed()) {
371-
displayTest->clearProgressBar(5);
372371
displayTest->showTextOnGrid(0, 3, "Press the button for");
373372
displayTest->showTextOnGrid(0, 4, "automatic track upload.");
373+
displayTest->clearProgressBar(5);
374374
} else if (button.getPreviousStateMillis() > 0 && button.getState() == HIGH) {
375375
const uint32_t buttonPressedMs = button.getCurrentStateMillis();
376376
displayTest->drawProgressBar(5, buttonPressedMs, LONG_BUTTON_PRESS_TIME_MS);

src/configServer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,6 @@ static void createHttpServer() {
585585
}
586586
serverSslCert = Https::getCertificate(progressTick);
587587
server = new HTTPSServer(serverSslCert, 443, 2);
588-
displayTest->clear();
589-
updateDisplay(displayTest);
590588
insecureServer = new HTTPServer(80, 2);
591589

592590
beginPages();

src/displays.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,15 @@ class SSD1306DisplayDevice : public DisplayDevice {
275275
}
276276

277277
void clearProgressBar(uint8_t y) {
278-
clearTextLine(y);
279-
uint16_t rowOffset = y * 10 + 3;
280-
m_display->setColor(BLACK);
281-
m_display->fillRect(12, rowOffset, 104, 8);
282-
m_display->setColor(WHITE);
283-
m_display->display();
284-
mLastProgress = UINT8_MAX;
278+
if (UINT8_MAX != mLastProgress) {
279+
clearTextLine(y);
280+
uint16_t rowOffset = y * 10 + 3;
281+
m_display->setColor(BLACK);
282+
m_display->fillRect(12, rowOffset, 104, 8);
283+
m_display->setColor(WHITE);
284+
m_display->display();
285+
mLastProgress = UINT8_MAX;
286+
}
285287
}
286288

287289
void clearTextLine(uint8_t y) {

src/utils/alpdata.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ void AlpData::update(SSD1306DisplayDevice *display) {
4646
log_d("Next Update: %s",
4747
TimeUtils::dateTimeToString(lastWrite + 4 * 24 * 60 * 60).c_str());
4848
f.close();
49+
display->showTextOnGrid(0, 5, "ALP not checked.");
4950
return;
5051
}
5152
f.close();
5253
log_d("Existing file last write %s", TimeUtils::dateTimeToString(f.getLastWrite()).c_str());
5354
log_d("Existing file is from %s", lastModified.c_str());
54-
display->showTextOnGrid(0, 5, "ALP data ...");
55+
display->showTextOnGrid(0, 5, "ALP data...");
5556

5657
HTTPClient httpClient;
5758
httpClient.begin(ALP_DOWNLOAD_URL);
@@ -81,7 +82,7 @@ void AlpData::update(SSD1306DisplayDevice *display) {
8182
display->showTextOnGrid(0, 5, "ALP data updated!");
8283
}
8384
} else if (httpCode == 304) { // Not-Modified
84-
display->showTextOnGrid(0,5, "ALP data up to date.");
85+
display->showTextOnGrid(0, 5, "ALP data was up to date.");
8586
log_i("All fine, not modified!");
8687
} else if (httpCode > 0) {
8788
display->showTextOnGrid(0,4, String("ALP data failed ") + String(httpCode).c_str());

0 commit comments

Comments
 (0)