ITCactus 2023-04-30 00:07:00 -07:00 committed by GitHub
commit 6f4c4dbdc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -901,6 +901,7 @@ void Watchy::showUpdateFW() {
}
void Watchy::updateFWBegin() {
int connectionTimeOutSeconds = BLE_WAIT_FOR_CONNECTION_TIMEOUT;
display.setFullWindow();
display.fillScreen(GxEPD_BLACK);
display.setFont(&FreeMonoBold9pt7b);
@ -912,16 +913,33 @@ void Watchy::updateFWBegin() {
display.println(" ");
display.println("Waiting for");
display.println("connection...");
display.println(String(connectionTimeOutSeconds) + " seconds timeout");
display.display(false); // full refresh
BLE BT;
BT.begin("Watchy BLE OTA");
int prevStatus = -1;
int currentStatus;
bool checkTimeout = true;
bool proceed = true;
long startTime = millis();
int lastTimeSeconds = 0;
while (1) {
while (proceed) {
currentStatus = BT.updateStatus();
int seconds = (millis() - startTime)/1000;
if(seconds > lastTimeSeconds) {
lastTimeSeconds = seconds;
display.print(".");
display.display(true);
}
if (checkTimeout && lastTimeSeconds > connectionTimeOutSeconds) {
proceed = false;
}
if (prevStatus != currentStatus || prevStatus == 1) {
checkTimeout = false;
if (currentStatus == 0) {
display.setFullWindow();
display.fillScreen(GxEPD_BLACK);

View File

@ -72,6 +72,7 @@
#define HOUR_12_24 24
// BLE OTA
#define BLE_DEVICE_NAME "Watchy BLE OTA"
#define BLE_WAIT_FOR_CONNECTION_TIMEOUT 60
#define WATCHFACE_NAME "Watchy 7 Segment"
#define SOFTWARE_VERSION_MAJOR 1
#define SOFTWARE_VERSION_MINOR 0