Converted led code to support non rgb/strip. Some clean up of network comp. Clean up of provider and client. Base test for client
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"path": "../components"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
@@ -111,10 +111,30 @@ dependencies:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 1.3.0
|
||||
espressif/led_strip:
|
||||
component_hash: 28621486f77229aaf81c71f5e15d6fbf36c2949cf11094e07090593e659e7639
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.0'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 3.0.3
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.5.3
|
||||
led:
|
||||
dependencies:
|
||||
- name: idf
|
||||
version: '>=4.1.0'
|
||||
- name: espressif/led_strip
|
||||
version: ^3.0.3
|
||||
source:
|
||||
path: C:\Dev\Classified\Calendink\components\led
|
||||
type: local
|
||||
version: 1.0.0
|
||||
network:
|
||||
dependencies:
|
||||
- name: idf
|
||||
@@ -127,7 +147,8 @@ dependencies:
|
||||
version: 1.0.0
|
||||
direct_dependencies:
|
||||
- idf
|
||||
- led
|
||||
- network
|
||||
manifest_hash: 12f55da0a0684644c57ee6a400e8e98810d36140fad54f35a96e434eb9774b8c
|
||||
target: esp32
|
||||
manifest_hash: 82be8e1c72b7c09d777d347050aba296d424314ce0b7f7642b5bd08a5e276e54
|
||||
target: esp32c6
|
||||
version: 2.0.0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
idf_component_register(SRCS "main.cpp"
|
||||
PRIV_REQUIRES esp_eth esp_wifi esp_netif driver network nvs_flash
|
||||
PRIV_REQUIRES driver nvs_flash driver
|
||||
esp_event esp_timer led network
|
||||
INCLUDE_DIRS ".")
|
||||
|
||||
@@ -4,3 +4,5 @@ dependencies:
|
||||
version: '>=4.1.0'
|
||||
network:
|
||||
path: "../../components/network"
|
||||
led:
|
||||
path: "../../components/led"
|
||||
+44
-20
@@ -1,9 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "esp_log.h"
|
||||
#include "esp_pm.h"
|
||||
#include "esp_system.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/gpio_num.h"
|
||||
#include "esp_event.h"
|
||||
|
||||
#include "types.hpp"
|
||||
#include "led.hpp"
|
||||
#include "network.hpp"
|
||||
|
||||
static const char *TAG = "ClientMain";
|
||||
@@ -22,30 +31,45 @@ extern "C" void app_main()
|
||||
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
||||
setup_led();
|
||||
ESP_LOGI(TAG, "LED setup complete");
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
|
||||
ESP_LOGI(TAG, "LED blink 4");
|
||||
led_blink_number(4, 255,255,255);
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
|
||||
ESP_LOGI(TAG, "LED blink 2");
|
||||
led_blink_number(2, 255,255,255);
|
||||
|
||||
turn_off_led();
|
||||
ESP_LOGI(TAG, "LED blink complete");
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
|
||||
// Connect to WiFi
|
||||
ESP_LOGI(TAG, "Initializing WiFi connection");
|
||||
// ESP_LOGI(TAG, "Initializing WiFi connection");
|
||||
|
||||
// Attempting to connect, we don't necessarily need to block forever here
|
||||
// as network.cpp already handles some of the retries
|
||||
esp_err_t err = connect_wifi(CONFIG_CALENDINK_WIFI_SSID, CONFIG_CALENDINK_WIFI_PASSWORD, false);
|
||||
// // Attempting to connect, we don't necessarily need to block forever here
|
||||
// // as network.cpp already handles some of the retries
|
||||
// esp_err_t err = connect_wifi(CONFIG_CALENDINK_WIFI_SSID, CONFIG_CALENDINK_WIFI_PASSWORD, false);
|
||||
|
||||
if (err == ESP_OK) {
|
||||
uint8_t retries = 1;
|
||||
do {
|
||||
err = check_wifi_connection(retries);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "WiFi connection check timeout, retrying... (%d)", retries);
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
retries++;
|
||||
} while (err == ESP_ERR_TIMEOUT && retries <= CONFIG_CALENDINK_WIFI_RETRIES);
|
||||
}
|
||||
// if (err == ESP_OK) {
|
||||
// uint8_t retries = 1;
|
||||
// do {
|
||||
// err = check_wifi_connection(retries);
|
||||
// if (err != ESP_OK) {
|
||||
// ESP_LOGW(TAG, "WiFi connection check timeout, retrying... (%d)", retries);
|
||||
// vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
// }
|
||||
// retries++;
|
||||
// } while (err == ESP_ERR_TIMEOUT && retries <= CONFIG_CALENDINK_WIFI_RETRIES);
|
||||
// }
|
||||
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGI(TAG, "Successfully connected to WiFi!");
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Failed to connect to WiFi.");
|
||||
}
|
||||
// if (err == ESP_OK) {
|
||||
// ESP_LOGI(TAG, "Successfully connected to WiFi!");
|
||||
// } else {
|
||||
// ESP_LOGE(TAG, "Failed to connect to WiFi.");
|
||||
// }
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user