Skip to content

Commit

Permalink
Fix for OTA updates
Browse files Browse the repository at this point in the history
  • Loading branch information
doudar committed Dec 23, 2020
1 parent c3e75e8 commit 1bbcde4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define SETTINGS_H

//Current program version info. Used for auto updates
#define FIRMWARE_VERSION "0.0.12.22"
#define FIRMWARE_VERSION "0.0.12.23"

//Update firmware on boot?
#define AUTO_FIRMWARE_UPDATE true
Expand Down
24 changes: 13 additions & 11 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,32 @@ void setup()
&moveStepperTask, /* Task handle to keep track of created task */
0); /* pin task to core 0 */

setupBLE();

digitalWrite(LED_PIN, HIGH);

startWifi();

//Check for firmware update. It's important that this stays before BLE & HTTP setup
//because otherwise they use too much traffic and the device fails to update
//which really sucks when it corrupts your settings.
if (userConfig.getautoUpdate())
{
FirmwareUpdate();
}

setupBLE();
startBLEServer();
if ((String(userConfig.getconnectedPowerMeter()) != "none") && (String(userConfig.getconnectedHeartMonitor()) != "none"))
{
BLEServerScan(true);
}
startWifi();
startHttpServer();
if (userConfig.getautoUpdate())
{
FirmwareUpdate();
}
resetIfShiftersHeld();
debugDirector("Creating Shifter Interrupts");
//Setup Interrups so shifters work anytime
attachInterrupt(digitalPinToInterrupt(SHIFT_UP_PIN), shiftUp, CHANGE);
attachInterrupt(digitalPinToInterrupt(SHIFT_DOWN_PIN), shiftDown, CHANGE);
digitalWrite(LED_PIN, HIGH);
//theres a better way to handle this, but sometimes the first scan doesn't connect both devices even though it should.
//if (String(userConfig.getconnectedHeartMonitor()) != "none")
//{
// BLEServerScan(true);
//}
}

void loop()
Expand Down

0 comments on commit 1bbcde4

Please sign in to comment.