Add BLE host transport selectable via DIP8 alongside UART.
Master can speak the same framed protobuf protocol over NimBLE or UART; goTool gains -ble, ble-rtt, and ble-stream timing checks for ESP-NOW coexistence. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "cmd_ota.h"
|
||||
#include "app_config.h"
|
||||
#include "led_ring.h"
|
||||
#include "ota_espnow.h"
|
||||
#include "ota_uart.h"
|
||||
@@ -103,10 +104,24 @@ static void ota_prepare_task(void *param) {
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
static bool ota_host_is_uart(void) {
|
||||
const app_config_t *cfg = app_config_get();
|
||||
if (cfg != NULL && cfg->host_ble) {
|
||||
ESP_LOGW(TAG, "OTA requires UART host (DIP8=0); BLE host active");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void handle_ota_start(const uint8_t *data, size_t len) {
|
||||
alox_UartMessage uart_msg;
|
||||
alox_OtaStartPayload req = alox_OtaStartPayload_init_zero;
|
||||
|
||||
if (!ota_host_is_uart()) {
|
||||
send_ota_failed(20);
|
||||
return;
|
||||
}
|
||||
|
||||
if (uart_cmd_decode(data, len, &uart_msg) != ESP_OK) {
|
||||
send_ota_failed( 2);
|
||||
return;
|
||||
@@ -334,6 +349,10 @@ static void ota_start_espnow_task(void *param) {
|
||||
}
|
||||
|
||||
static void handle_ota_start_espnow(const uint8_t *data, size_t len) {
|
||||
if (!ota_host_is_uart()) {
|
||||
send_ota_failed(20);
|
||||
return;
|
||||
}
|
||||
(void)data;
|
||||
(void)len;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user