fix: ArduinoOTA init, reporter mutex, BLE lock scope, NVS type

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 10:33:23 -07:00
parent 883b72be77
commit 8a00665e4c
5 changed files with 83 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
// firmware/src/main.cpp
#include <Arduino.h>
#include <WiFi.h>
#include <ArduinoOTA.h>
#include "config.h"
#include "provisioning.h"
#include "camera.h"
@@ -139,8 +140,17 @@ void setup() {
while (true) delay(1000);
}
reporter_init();
ble_scanner_start();
// OTA update support
ArduinoOTA.setHostname(g_cfg.device_id.c_str());
ArduinoOTA.onStart([]() { ble_scanner_pause(); });
ArduinoOTA.onEnd([]() { ble_scanner_resume(); ESP.restart(); });
ArduinoOTA.onError([](ota_error_t e) { ble_scanner_resume(); });
ArduinoOTA.begin();
s_cv_mutex = xSemaphoreCreateMutex();
xTaskCreatePinnedToCore(task_camera, "cam", 4096, nullptr, 2, nullptr, 1);
@@ -148,6 +158,7 @@ void setup() {
}
void loop() {
ArduinoOTA.handle();
check_factory_reset();
if (WiFi.status() != WL_CONNECTED) {