Compare commits

...

2 Commits

Author SHA1 Message Date
sqfmi c1c95f9587 use chip icon 2024-04-02 22:59:02 -04:00
sqfmi bd1657e9c7 Save last used IP and SSID 2024-04-02 22:55:19 -04:00
3 changed files with 14 additions and 9 deletions

View File

@ -146,7 +146,7 @@ void Watchy7SEG::drawWeather(){
}else
return;
}else{
weatherIcon = cputemp;
weatherIcon = chip;
}
display.drawBitmap(145, 158, weatherIcon, WEATHER_ICON_WIDTH, WEATHER_ICON_HEIGHT, DARKMODE ? GxEPD_WHITE : GxEPD_BLACK);

View File

@ -189,7 +189,7 @@ const unsigned char wifioff [] PROGMEM = {
0x01, 0xff, 0xc0, 0x00, 0x07, 0xe1, 0xc0, 0x00, 0x0f, 0xc0, 0x80, 0x00, 0x1f, 0x0c, 0x00, 0x00,
0x3c, 0x1e, 0x00, 0x00, 0xf8, 0x0c, 0x00, 0x00
};
// 'chip', 32x32px
// 'chip', 48x32px
const unsigned char chip [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x48, 0x00, 0x00, 0x00, 0x00,

View File

@ -14,6 +14,8 @@ RTC_DATA_ATTR int weatherIntervalCounter = -1;
RTC_DATA_ATTR long gmtOffset = 0;
RTC_DATA_ATTR bool alreadyInMenu = true;
RTC_DATA_ATTR tmElements_t bootTime;
RTC_DATA_ATTR uint32_t lastIPAddress;
RTC_DATA_ATTR char lastSSID[30];
void Watchy::init(String datetime) {
esp_sleep_wakeup_cause_t wakeup_reason;
@ -337,14 +339,13 @@ void Watchy::showAbout() {
display.print("h");
display.print(minutes);
display.println("m");
if(connectWiFi()){
if(WIFI_CONFIGURED){
display.print("SSID: ");
display.println(WiFi.SSID());
display.println("IP: ");
display.println(WiFi.localIP());
WiFi.mode(WIFI_OFF);
display.println(lastSSID);
display.print("IP: ");
display.println(IPAddress(lastIPAddress).toString());
}else{
display.println("WiFi Not Setup");
display.println("WiFi Not Connected");
}
display.display(false); // full refresh
@ -832,11 +833,13 @@ void Watchy::setupWifi() {
display.println("Setup failed &");
display.println("timed out!");
} else {
display.println("Connected to");
display.println("Connected to:");
display.println(WiFi.SSID());
display.println("Local IP:");
display.println(WiFi.localIP());
weatherIntervalCounter = -1; // Reset to force weather to be read again
lastIPAddress = WiFi.localIP();
WiFi.SSID().toCharArray(lastSSID, 30);
}
display.display(false); // full refresh
// turn off radios
@ -871,6 +874,8 @@ bool Watchy::connectWiFi() {
} else {
if (WL_CONNECTED ==
WiFi.waitForConnectResult()) { // attempt to connect for 10s
lastIPAddress = WiFi.localIP();
WiFi.SSID().toCharArray(lastSSID, 30);
WIFI_CONFIGURED = true;
} else { // connection failed, time out
WIFI_CONFIGURED = false;