We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42979ff commit 5c08ca6Copy full SHA for 5c08ca6
README.md
@@ -8,9 +8,8 @@ Bluetooth Visual Speaker based on ESP32 chip.
8
* A2DP Audio Streaming
9
* I2S & PDM Input / I2S Output
10
* VFX Output (GIF / Audio FFT / Rainbow / Star Sky / ...)
11
-* BLE Control Interface (for VFX Output)
+* BLE Control Interface (OTA Firmware Update / VFX Remote Control)
12
* Audio Prompt (Connected / Disconnected / WakeUp / Sleep)
13
-* OTA Firmware Update (via SPP Profile)
14
* Sleep & WakeUp Key
15
16
## Preparing
main/Kconfig.projbuild
@@ -7,24 +7,11 @@ config BT_NAME
7
help
Bluetooth name exposed by the device.
-menuconfig ENABLE_OTA_OVER_SPP
- bool "Enable OTA over SPP"
- default n
- help
- Enable OTA feature, you can use the SPP profile to upload the new firmware.
-
-config BT_SPP_SERVER_NAME
17
- string "SPP Server Name"
18
- default "OTA"
19
- depends on ENABLE_OTA_OVER_SPP
20
21
- Bluetooth SPP server name.
22
23
config ENABLE_BLE_CONTROL_IF
24
bool "Enable BLE Control Interface"
25
default n
26
27
- Select this to enable BLE Control Interface.
+ Select this to enable BLE OTA and RC features.
28
endmenu
29
30
menu "Audio Configuration"
main/inc/core/os.h
@@ -15,26 +15,24 @@ typedef enum user_event_group_bits {
OS_PWR_SLEEP_BIT = BIT0,
OS_PWR_RESTART_BIT = BIT1,
- BT_SPP_IDLE_BIT = BIT2,
- BT_OTA_LOCK_BIT = BIT3,
+ BT_A2DP_IDLE_BIT = BIT2,
+ BT_A2DP_DATA_BIT = BIT3,
- BT_A2DP_IDLE_BIT = BIT4,
- BT_A2DP_DATA_BIT = BIT5,
+ BLE_GATTS_IDLE_BIT = BIT4,
+ BLE_GATTS_LOCK_BIT = BIT5,
- BLE_GATTS_IDLE_BIT = BIT6,
+ VFX_RELOAD_BIT = BIT6,
+ VFX_FFT_NULL_BIT = BIT7,
- VFX_RELOAD_BIT = BIT7,
- VFX_FFT_NULL_BIT = BIT8,
+ KEY_SCAN_RUN_BIT = BIT8,
- KEY_SCAN_RUN_BIT = BIT9,
+ AUDIO_RENDER_CLR_BIT = BIT9,
31
AUDIO_INPUT_RUN_BIT = BIT10,
32
AUDIO_INPUT_FFT_BIT = BIT11,
33
34
- AUDIO_RENDER_CLR_BIT = BIT12,
35
36
- AUDIO_PLAYER_RUN_BIT = BIT13,
37
- AUDIO_PLAYER_IDLE_BIT = BIT14,
+ AUDIO_PLAYER_RUN_BIT = BIT12,
+ AUDIO_PLAYER_IDLE_BIT = BIT13,
38
} user_event_group_bits_t;
39
40
extern EventGroupHandle_t user_event_group;
main/inc/user/ble_gatts.h
@@ -11,8 +11,8 @@
#include "esp_gatts_api.h"
enum gatts_profile_idx {
+ PROFILE_IDX_OTA,
PROFILE_IDX_VFX,
- PROFILE_IDX_VER,
PROFILE_IDX_MAX,
};
@@ -34,6 +34,8 @@ typedef struct gatts_profile_inst {
extern gatts_profile_inst_t gatts_profile_tbl[];
+extern void gatts_ota_send_notification(const char *data, uint32_t len);
+
extern void ble_gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
41
#endif /* INC_USER_BLE_GATTS_H_ */
main/inc/user/bt_spp.h
main/inc/user/ota.h
@@ -8,9 +8,9 @@
#ifndef INC_USER_OTA_H_
#define INC_USER_OTA_H_
-#include "esp_spp_api.h"
+#include <stdint.h>
-extern void ota_exec(esp_spp_cb_param_t *param);
+extern void ota_exec(const char *data, uint32_t len);
extern void ota_end(void);
#endif /* INC_USER_OTA_H_ */
main/src/core/os.c
@@ -20,7 +20,7 @@
EventGroupHandle_t user_event_group;
-#if defined(CONFIG_ENABLE_WAKEUP_KEY) || defined(CONFIG_ENABLE_SLEEP_KEY) || defined(CONFIG_ENABLE_OTA_OVER_SPP)
+#if defined(CONFIG_ENABLE_WAKEUP_KEY) || defined(CONFIG_ENABLE_SLEEP_KEY) || defined(CONFIG_ENABLE_BLE_CONTROL_IF)
static EventBits_t sleep_wait_bits = 0;
static EventBits_t restart_wait_bits = 0;
@@ -153,7 +153,7 @@ void os_init(void)
153
#endif
154
#endif // CONFIG_ENABLE_WAKEUP_KEY
155
156
157
xTaskCreatePinnedToCore(os_power_task_handle, "osPowerT", 2048, NULL, 5, NULL, 0);
158
159
}
main/src/user/ble_app.c
@@ -102,8 +102,10 @@ void ble_app_init(void)
102
ESP_ERROR_CHECK(esp_ble_gatts_register_callback(ble_gatts_event_handler));
103
ESP_ERROR_CHECK(esp_ble_gap_register_callback(ble_gap_event_handler));
104
105
+ ESP_ERROR_CHECK(esp_ble_gatts_app_register(PROFILE_IDX_OTA));
106
ESP_ERROR_CHECK(esp_ble_gatts_app_register(PROFILE_IDX_VFX));
- ESP_ERROR_CHECK(esp_ble_gatts_app_register(PROFILE_IDX_VER));
107
108
+ ESP_ERROR_CHECK(esp_ble_gatt_set_local_mtu(ESP_GATT_MAX_MTU_SIZE));
109
110
ESP_LOGI(BLE_APP_TAG, "started.");
111
0 commit comments