Enhance Bluetooth functionality and GUI integration

- Add Bluetooth device list management with discovery and pairing support
- Implement volume control with AVRC integration
- Add system event handling for GUI-to-Bluetooth communication
- Enhance menu system with device selection and volume control pages
- Improve memory management by making menu creation lazy
- Add proper event subscription between GUI and Bluetooth modules
- Update filter coefficient for improved audio clicking behavior

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Brent Perteet
2025-08-25 16:46:16 +00:00
parent 25f875b3b2
commit 439c6ef22d
7 changed files with 826 additions and 5831 deletions

View File

@@ -32,10 +32,13 @@ typedef struct SystemState_s
float zeroAngle;
int primaryAxis;
// BT event data
int btDeviceIndex;
} SystemState_t;
#define MAX_INDICATION_ANGLE 5.0f
#define MAX_INDICATION_ANGLE 7.5f
#define FILTER_COEFF 0.4f // 0 to 1 Smaller number is heavier filter
#define PRIMARY_AXIS ANGLE_YZ
#define RIFLE_AXIS Y
@@ -43,6 +46,10 @@ typedef struct SystemState_s
#define EM_MAX_SUBSCRIBERS 8 // tweak as needed
#define EM_EVENT_NEW_DATA (1UL<<0)
#define EM_EVENT_ERROR (1UL<<1)
#define EM_EVENT_BT_REFRESH (1UL<<2)
#define EM_EVENT_BT_CONNECT (1UL<<3)
#define EM_EVENT_VOLUME_UP (1UL<<4)
#define EM_EVENT_VOLUME_DOWN (1UL<<5)
// …add more event bit-masks here…
typedef struct {
@@ -72,5 +79,14 @@ BaseType_t system_unsubscribe(TaskHandle_t task);
// Notify all subscribers of one or more event bits
void system_notifyAll(uint32_t eventBits);
// BT-specific event functions
void system_requestBtRefresh(void);
void system_requestBtConnect(int device_index);
int system_getBtDeviceIndex(void);
// Volume control functions
void system_requestVolumeUp(void);
void system_requestVolumeDown(void);
#endif