Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When unable to show e paper screen due to various errors #122

Open
PaekHyun opened this issue Aug 19, 2024 · 1 comment
Open

When unable to show e paper screen due to various errors #122

PaekHyun opened this issue Aug 19, 2024 · 1 comment

Comments

@PaekHyun
Copy link

Current your code wakes up from sleep mode every hour.
Even if information is not displayed due to various errors, it wakes up from sleep mode every hour.
So what about code that goes into sleep mode for only 2-3 minutes when an error occurs?
I think it's better to wait 2-3 minutes and try to reboot than to see a Wi-Fi connection error message for an hour

// START WIFI
int wifiRSSI = 0;
wl_status_t wifiStatus = startWiFi(wifiRSSI);
if (wifiStatus != WL_CONNECTED)
{
killWiFi();
initDisplay();
if (wifiStatus == WL_NO_SSID_AVAIL)
{
Serial.println("SSID Not Available");
do
{
drawError(wifi_x_196x196, "SSID Not Available", "");
} while (display.nextPage());
}
else
{
Serial.println("WiFi Connection Failed");
do
{
drawError(wifi_x_196x196, "WiFi Connection", "Failed");
} while (display.nextPage());
}
display.powerOff();
esp_sleep_enable_timer_wakeup(180 * 1000000ULL);
esp_deep_sleep_start();

}

// FETCH TIME
bool timeConfigured = false;
timeConfigured = setupTime(&timeInfo);
if (!timeConfigured)
{ // Failed To Fetch The Time
Serial.println("Failed To Fetch The Time");
killWiFi();
initDisplay();
do
{
drawError(wi_time_4_196x196, "Failed To Fetch", "The Time");
} while (display.nextPage());
display.powerOff();

**esp_sleep_enable_timer_wakeup(180 * 1000000ULL);
esp_deep_sleep_start();**

}
String refreshTimeStr;
getRefreshTimeStr(refreshTimeStr, timeConfigured, &timeInfo);

// MAKE API REQUESTS
int rxOWM[2] = {};
WiFiClient client;
rxOWM[0] = getOWMonecall(client, owm_onecall);
if (rxOWM[0] != HTTP_CODE_OK)
{
statusStr = "One Call " + OWM_ONECALL_VERSION + " API";
tmpStr = String(rxOWM[0], DEC) + ": " + getHttpResponsePhrase(rxOWM[0]);
killWiFi();
initDisplay();
do
{
drawError(wi_cloud_down_196x196, statusStr, tmpStr);
} while (display.nextPage());
display.powerOff();

**esp_sleep_enable_timer_wakeup(180 * 1000000ULL);
esp_deep_sleep_start();**

}
rxOWM[1] = getOWMairpollution(client, owm_air_pollution);
killWiFi(); // wifi no longer needed
if (rxOWM[1] != HTTP_CODE_OK)
{
statusStr = "Air Pollution API";
tmpStr = String(rxOWM[1], DEC) + ": " + getHttpResponsePhrase(rxOWM[1]);
initDisplay();
do
{
drawError(wi_cloud_down_196x196, statusStr, tmpStr);
} while (display.nextPage());
display.powerOff();

**esp_sleep_enable_timer_wakeup(180 * 1000000ULL);
esp_deep_sleep_start();**

}

@PaekHyun PaekHyun changed the title When unable to start due to various errors When unable to show e paper screen due to various errors Aug 19, 2024
@Asdf1qaz
Copy link

This could kill the battery pretty fast though if your not with it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants