scan ble advertise packages

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-08-30 01:13:45 +02:00
parent 5427570c14
commit 597bfeee28
17 changed files with 419 additions and 39 deletions

View File

@@ -6,9 +6,11 @@ idf_component_register(SRCS
INCLUDE_DIRS "."
PRIV_REQUIRES
insa
ble-manager
led-manager
persistence-manager
u8g2
nvs_flash
driver
esp_timer
esp_event

View File

@@ -1,14 +0,0 @@
menu "System Control"
config WLED_DIN_PIN
int "WLED Data In Pin"
default 14
help
The number of the WLED data in pin.
config STATUS_WLED_PIN
int "Status WLED Pin"
default 2
help
The number of the status WLED pin.
endmenu

View File

@@ -4,3 +4,4 @@ dependencies:
# u8g2_hal:
# git: https://github.com/mkfrey/u8g2-hal-esp-idf.git
espressif/button: ^4.1.3
espressif/esp_insights: ^1.2.7

View File

@@ -1,17 +1,48 @@
#include "app_task.h"
#include "ble_manager.h"
#include "esp_event.h"
#include "esp_insights.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "led_manager.h"
#include "led_status.h"
#include "nvs_flash.h"
#include "sdkconfig.h"
#define ESP_INSIGHTS_AUTH_KEY \
"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9." \
"eyJ1c2VyIjoiZTYzNTNmOTUtN2I2Ni00M2U0LTgyM2UtOTlkYzAxNTYyN2NmIiwiaXNzIjoiZTMyMmI1OWMtNjNjYy00ZTQwLThlYTItNGU3NzY2" \
"NTQ1Y2NhIiwic3ViIjoiMjE2YWJhNmYtZmI5Zi00ZTM3LWEzMDMtOTliZmNlODU1NWJiIiwiZXhwIjoyMDcxNDIzNjk0LCJpYXQiOjE3NTYwNjM2" \
"OTR9.eG2musOILUiWUzE3AwWWx-_vOLeIoUlmL9LMaDrHYC6h_" \
"YOYT4Fqtvytgv1qAI0jxXQmijoQdpoQrlNYQwJlH1gRpILcvlFdL1YkBjzfKXgo_" \
"jJaOlmHv2tkd54FAg49DmG4j0BY3xAnhz5y0XBHsXWiFKwpZHWy0q5IuKyVJ3syNzmTg2LwVBVu8gU2EoGikdVKNazRC1BwPLz_" \
"KNWdW03WVCniun_" \
"2nVyZI5Y253Nch6MaeBpvrfRXhUI6uWXZuSDa3nrS5MmtElZgQjEyAJSX5lfhRwEc2Qi2LlHc4LHPD0YvO1JhSF4N6Rwf1FrJZ1qU_" \
"IxNTdTxtzLC0BUcYA"
#ifdef __cplusplus
extern "C"
{
#endif
void app_main(void)
{
// Initialize NVS
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
ESP_ERROR_CHECK(nvs_flash_erase());
ESP_ERROR_CHECK(nvs_flash_init());
}
esp_insights_config_t config = {
.log_type = ESP_DIAG_LOG_TYPE_ERROR,
.node_id = nullptr,
.auth_key = ESP_INSIGHTS_AUTH_KEY,
.alloc_ext_ram = false,
};
esp_insights_init(&config);
led_status_init(CONFIG_STATUS_WLED_PIN);
// LED 0: solid red
@@ -28,10 +59,12 @@ extern "C"
.mode = LED_MODE_BLINK, .color = {.r = 0, .g = 0, .b = 50}, .on_time_ms = 1000, .off_time_ms = 500};
led_status_set_behavior(2, led2_blink_blue);
xTaskCreatePinnedToCore(app_task, "main_loop", 4096, NULL, tskIDLE_PRIORITY + 1, NULL, portNUM_PROCESSORS - 1);
wled_init();
register_handler();
xTaskCreatePinnedToCore(app_task, "main_loop", 4096, NULL, tskIDLE_PRIORITY + 1, NULL, portNUM_PROCESSORS - 1);
xTaskCreatePinnedToCore(ble_manager_task, "ble_manager", 4096, NULL, tskIDLE_PRIORITY + 1, NULL,
portNUM_PROCESSORS - 1);
}
#ifdef __cplusplus
}