I have discovered this code:
#elif defined(BOARD_LED_PIN) // Single color LED
void initLED()
{
ledcSetup(LEDC_CHANNEL_1, LEDC_BASE_FREQ, LEDC_TIMER_BITS);
ledcAttachPin(BOARD_LED_PIN, LEDC_CHANNEL_1);
}
in Indicator.h
-
My LED seems to flash, but it is barely noticeable.
I have also made some changes to the following code in the function call void enterConnectNet()
located in ConfigMode.h
:
WiFi.begin(configStore.wifiSSID, configStore.wifiPass);
unsigned long timeoutMs = millis() + WIFI_NET_CONNECT_TIMEOUT;
while ((timeoutMs > millis()) && (WiFi.status() != WL_CONNECTED))
{
delay(10);
app_loop();
if (!BlynkState::is(MODE_CONNECTING_NET))
{
WiFi.disconnect();
return;
}
}
I have changed the WIFI_NET_CONNECT_TIMEOUT
to 60000 in Settings.h
. This gives the ESP enough time to reconnect after I switched the wifi off and then back on again.
I will change this code, as this will set the following line of code BlynkState::set(MODE_ERROR)
; if the Wifi is not restored fast enough (or not at all).
This will cause the processor to restart and continuously restart if the Wifi connection is not restored, which leaves your application at the mercy of the internet - (not ideal when you are living in a country which has serious power delivery issues like South Africa).
Also note that this function, once again calls the app_loop()
function which I only have the Blynk Timer running, nothing else.
I have a theory as to why my OLED displays garbage the moment my Wifi connection drops: The Wifi.h library is continuously trying to reconnect to the Wifi router, that it interrupts the I2C process and my bit timings gets thrown off.
Itās either that or something else in the Blynk framework I am missing.
If someone from Blynk can please assist, it will be greatly appreciated.
In the meantime I will replicate the above with only using the Wifi.h
library and the relevant Adafruit libraries necessary to display output on the OLED.
Thanks,
Shawn