Added LED Ring
This commit is contained in:
+19
-8
@@ -6,6 +6,8 @@
|
||||
#include "esp_flash_partitions.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "led_ring.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
#include <stdint.h>
|
||||
@@ -107,14 +109,6 @@ void app_main(void) {
|
||||
1; // map network to 0-8, 0 is not a valid network
|
||||
}
|
||||
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES ||
|
||||
ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
ESP_ERROR_CHECK(ret);
|
||||
|
||||
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||
|
||||
App_Config.Master = (master == true);
|
||||
@@ -126,4 +120,21 @@ void app_main(void) {
|
||||
ESP_LOGI(TAG, "Master: %d", App_Config.Master);
|
||||
ESP_LOGI(TAG, "Network: %d", App_Config.Network);
|
||||
ESP_LOGI(TAG, "Running Partition: %s", App_Config.RunningPartition);
|
||||
|
||||
led_ring_init();
|
||||
|
||||
uint8_t current_digit = 10;
|
||||
while (1) {
|
||||
led_command_t cmd = {
|
||||
.mode = LED_CMD_SET_DIGIT,
|
||||
.value = current_digit,
|
||||
.r = 5,
|
||||
.g = 5,
|
||||
.b = 0
|
||||
};
|
||||
|
||||
led_ring_send_command(&cmd);
|
||||
current_digit = (current_digit + 1) % 11;
|
||||
vTaskDelay(pdMS_TO_TICKS(500));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user