start of the epd. Problem right now 0xff display black. Will have to investigate
This commit is contained in:
@@ -2,4 +2,5 @@ idf_component_register(SRCS "main.cpp" "provider.cpp"
|
||||
PRIV_REQUIRES driver nvs_flash
|
||||
esp_event esp_timer
|
||||
led network http_client mdns
|
||||
epd
|
||||
INCLUDE_DIRS ".")
|
||||
|
||||
@@ -9,3 +9,5 @@ dependencies:
|
||||
path: "../../components/led"
|
||||
http_client:
|
||||
path: "../../components/http_client"
|
||||
epd:
|
||||
path: "../../components/epd"
|
||||
|
||||
+43
-32
@@ -1,3 +1,4 @@
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
|
||||
#include "esp_event.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "nvs_flash.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include "epd.hpp"
|
||||
#include "led.hpp"
|
||||
#include "network.hpp"
|
||||
#include "provider.hpp"
|
||||
@@ -33,45 +35,54 @@ extern "C" void app_main()
|
||||
setup_led();
|
||||
|
||||
// Connect to WiFi
|
||||
ESP_LOGI(TAG, "Initializing WiFi connection");
|
||||
initialize_network();
|
||||
|
||||
esp_err_t err = connect_wifi(CONFIG_CALENDINK_WIFI_SSID,
|
||||
CONFIG_CALENDINK_WIFI_PASSWORD, false);
|
||||
|
||||
if (err == ESP_OK)
|
||||
if (false)
|
||||
{
|
||||
uint8_t retries = 1;
|
||||
do
|
||||
ESP_LOGI(TAG, "Initializing WiFi connection");
|
||||
initialize_network();
|
||||
|
||||
esp_err_t err = connect_wifi(CONFIG_CALENDINK_WIFI_SSID,
|
||||
CONFIG_CALENDINK_WIFI_PASSWORD, false);
|
||||
|
||||
if (err == ESP_OK)
|
||||
{
|
||||
err = check_wifi_connection(retries);
|
||||
if (err != ESP_OK)
|
||||
uint8_t retries = 1;
|
||||
do
|
||||
{
|
||||
ESP_LOGW(TAG, "WiFi connection check timeout, retrying... (%d)",
|
||||
retries);
|
||||
led_blink_number(3, 255, 0, 0);
|
||||
}
|
||||
retries++;
|
||||
} while (err == ESP_ERR_TIMEOUT &&
|
||||
retries <= CONFIG_CALENDINK_WIFI_RETRIES);
|
||||
}
|
||||
err = check_wifi_connection(retries);
|
||||
if (err != ESP_OK)
|
||||
{
|
||||
ESP_LOGW(TAG, "WiFi connection check timeout, retrying... (%d)",
|
||||
retries);
|
||||
led_blink_number(3, 255, 0, 0);
|
||||
}
|
||||
retries++;
|
||||
} while (err == ESP_ERR_TIMEOUT &&
|
||||
retries <= CONFIG_CALENDINK_WIFI_RETRIES);
|
||||
}
|
||||
|
||||
if (err == ESP_OK)
|
||||
{
|
||||
ESP_LOGI(TAG, "Successfully connected to WiFi!");
|
||||
test_provider_communication();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to connect to WiFi.");
|
||||
if (err == ESP_OK)
|
||||
{
|
||||
ESP_LOGI(TAG, "Successfully connected to WiFi!");
|
||||
test_provider_communication();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to connect to WiFi.");
|
||||
}
|
||||
}
|
||||
|
||||
turn_off_led();
|
||||
|
||||
while (true)
|
||||
{
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
ESP_LOGI(TAG, "Initializing EPD");
|
||||
epd_init();
|
||||
epd_init_display();
|
||||
epd_clear(epd_color_t::WHITE);
|
||||
epd_refresh();
|
||||
epd_shutdown_display();
|
||||
|
||||
shutdown_network();
|
||||
if (false)
|
||||
{
|
||||
disconnect_wifi();
|
||||
shutdown_network();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user