mirror of https://github.com/sqfmi/Watchy.git
Just one update on render for everything.
parent
9c0b7e6b45
commit
2b1679446c
|
@ -57,7 +57,7 @@ void Watchy::init(String datetime) {
|
|||
// Return to watchface if in menu for more than one tick
|
||||
if (alreadyInMenu) {
|
||||
guiState = WATCHFACE_STATE;
|
||||
showWatchFace(false);
|
||||
showWatchFace(true);
|
||||
} else {
|
||||
alreadyInMenu = true;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ void Watchy::handleButtonPress() {
|
|||
if (wakeupBit & MENU_BTN_MASK) {
|
||||
if (guiState ==
|
||||
WATCHFACE_STATE) { // enter menu state if coming from watch face
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
} else if (guiState ==
|
||||
MAIN_MENU_STATE) { // if already in menu, then select menu item
|
||||
switch (menuIndex) {
|
||||
|
@ -154,11 +154,11 @@ void Watchy::handleButtonPress() {
|
|||
else if (wakeupBit & BACK_BTN_MASK) {
|
||||
if (guiState == MAIN_MENU_STATE) { // exit to watch face if already in menu
|
||||
RTC.read(currentTime);
|
||||
showWatchFace(false);
|
||||
showWatchFace(true);
|
||||
} else if (guiState == APP_STATE) {
|
||||
showMenu(menuIndex, false); // exit to menu if already in app
|
||||
showMenu(menuIndex, true); // exit to menu if already in app
|
||||
} else if (guiState == FW_UPDATE_STATE) {
|
||||
showMenu(menuIndex, false); // exit to menu if already in app
|
||||
showMenu(menuIndex, true); // exit to menu if already in app
|
||||
} else if (guiState == WATCHFACE_STATE) {
|
||||
return;
|
||||
}
|
||||
|
@ -236,12 +236,12 @@ void Watchy::handleButtonPress() {
|
|||
if (guiState ==
|
||||
MAIN_MENU_STATE) { // exit to watch face if already in menu
|
||||
RTC.read(currentTime);
|
||||
showWatchFace(false);
|
||||
showWatchFace(true);
|
||||
break; // leave loop
|
||||
} else if (guiState == APP_STATE) {
|
||||
showMenu(menuIndex, false); // exit to menu if already in app
|
||||
showMenu(menuIndex, true); // exit to menu if already in app
|
||||
} else if (guiState == FW_UPDATE_STATE) {
|
||||
showMenu(menuIndex, false); // exit to menu if already in app
|
||||
showMenu(menuIndex, true); // exit to menu if already in app
|
||||
}
|
||||
} else if (digitalRead(UP_BTN_PIN) == ACTIVE_LOW) {
|
||||
lastTimeout = millis();
|
||||
|
@ -375,7 +375,7 @@ void Watchy::showAbout() {
|
|||
}else{
|
||||
display.println("WiFi Not Connected");
|
||||
}
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
|
||||
guiState = APP_STATE;
|
||||
}
|
||||
|
@ -387,9 +387,9 @@ void Watchy::showBuzz() {
|
|||
display.setTextColor(GxEPD_WHITE);
|
||||
display.setCursor(70, 80);
|
||||
display.println("Buzz!");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
vibMotor();
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
}
|
||||
|
||||
void Watchy::vibMotor(uint8_t intervalMs, uint8_t length) {
|
||||
|
@ -567,7 +567,7 @@ void Watchy::setTime() {
|
|||
|
||||
RTC.set(tm);
|
||||
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
}
|
||||
|
||||
void Watchy::showAccelerometer() {
|
||||
|
@ -639,7 +639,7 @@ void Watchy::showAccelerometer() {
|
|||
}
|
||||
}
|
||||
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
}
|
||||
|
||||
void Watchy::showWatchFace(bool partialRefresh) {
|
||||
|
@ -910,7 +910,7 @@ void Watchy::setupWifi() {
|
|||
lastIPAddress = WiFi.localIP();
|
||||
WiFi.SSID().toCharArray(lastSSID, 30);
|
||||
}
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
// turn off radios
|
||||
WiFi.mode(WIFI_OFF);
|
||||
btStop();
|
||||
|
@ -932,7 +932,7 @@ void Watchy::_configModeCallback(WiFiManager *myWiFiManager) {
|
|||
display.println(WiFi.softAPIP());
|
||||
display.println("MAC address:");
|
||||
display.println(WiFi.softAPmacAddress().c_str());
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
}
|
||||
|
||||
bool Watchy::connectWiFi() {
|
||||
|
@ -971,7 +971,7 @@ void Watchy::showUpdateFW() {
|
|||
display.println("again when ready");
|
||||
display.println(" ");
|
||||
display.println("Keep USB powered");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
|
||||
guiState = FW_UPDATE_STATE;
|
||||
}
|
||||
|
@ -988,7 +988,7 @@ void Watchy::updateFWBegin() {
|
|||
display.println(" ");
|
||||
display.println("Waiting for");
|
||||
display.println("connection...");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
|
||||
BLE BT;
|
||||
BT.begin("Watchy BLE OTA");
|
||||
|
@ -1008,7 +1008,7 @@ void Watchy::updateFWBegin() {
|
|||
display.println(" ");
|
||||
display.println("Waiting for");
|
||||
display.println("upload...");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
}
|
||||
if (currentStatus == 1) {
|
||||
display.setFullWindow();
|
||||
|
@ -1033,7 +1033,7 @@ void Watchy::updateFWBegin() {
|
|||
display.println("completed!");
|
||||
display.println(" ");
|
||||
display.println("Rebooting...");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
|
||||
delay(2000);
|
||||
esp_restart();
|
||||
|
@ -1047,19 +1047,23 @@ void Watchy::updateFWBegin() {
|
|||
display.println("BLE Disconnected!");
|
||||
display.println(" ");
|
||||
display.println("exiting...");
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
delay(1000);
|
||||
break;
|
||||
}
|
||||
|
||||
prevStatus = currentStatus;
|
||||
}
|
||||
|
||||
if(digitalRead(BACK_BTN_PIN) == ACTIVE_LOW) break;
|
||||
|
||||
delay(100);
|
||||
}
|
||||
|
||||
// turn off radios
|
||||
WiFi.mode(WIFI_OFF);
|
||||
btStop();
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
}
|
||||
|
||||
void Watchy::showSyncNTP() {
|
||||
|
@ -1071,7 +1075,7 @@ void Watchy::showSyncNTP() {
|
|||
display.println("Syncing NTP... ");
|
||||
display.print("GMT offset: ");
|
||||
display.println(gmtOffset);
|
||||
display.display(false); // full refresh
|
||||
display.display(true); // full refresh
|
||||
if (connectWiFi()) {
|
||||
if (syncNTP()) {
|
||||
display.println("NTP Sync Success\n");
|
||||
|
@ -1103,7 +1107,7 @@ void Watchy::showSyncNTP() {
|
|||
}
|
||||
display.display(true); // full refresh
|
||||
delay(3000);
|
||||
showMenu(menuIndex, false);
|
||||
showMenu(menuIndex, true);
|
||||
}
|
||||
|
||||
bool Watchy::syncNTP() { // NTP sync - call after connecting to WiFi and
|
||||
|
|
Loading…
Reference in New Issue