Skip to content

Commit

Permalink
Do not start upload timer if button was never released
Browse files Browse the repository at this point in the history
  • Loading branch information
amandel committed Jan 8, 2021
1 parent 553e6c8 commit 6d83478
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/OpenBikeSensorFirmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ void setup() {
ESP_ERROR_CHECK_WITHOUT_ABORT(
esp_bt_mem_release(ESP_BT_MODE_BTDM)); // no bluetooth at all here.

delay(300);
buttonStateChanged = 0;
lastButtonState = buttonState;
delay(200);
startServer(&cfg);
OtaInit(esp_chipid);
while (true) {
Expand Down Expand Up @@ -411,7 +413,7 @@ void handleButtonInServerMode() {
buttonStateChanged = now;
}
if (!configServerWasConnectedViaHttp() &&
buttonState == HIGH) {
buttonState == HIGH && buttonStateChanged != 0) {
const uint32_t buttonPressedMs = now - buttonStateChanged;
displayTest->drawProgressBar(5, buttonPressedMs, BUTTON_PRESS_TIME_FOR_AUTO_UPLOAD_MS);
if (buttonPressedMs > BUTTON_PRESS_TIME_FOR_AUTO_UPLOAD_MS) {
Expand Down

0 comments on commit 6d83478

Please sign in to comment.