From 019f922f19b0f4cca1337bf8117f053c4b9d07b9 Mon Sep 17 00:00:00 2001 From: mikee47 Date: Sun, 30 Jun 2024 13:55:41 +0100 Subject: [PATCH] Update esp-nimble-cpp, ESP32-BLE-Gamepad, ESP32-BLE-Keyboard to master Patch fixes for warnings Hide unused parameter warnings --- Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad | 2 +- .../BLEGamepad/ESP32-BLE-Gamepad.patch | 114 +++++++++++++++++- Sming/Libraries/BLEGamepad/component.mk | 2 + .../Libraries/BLEKeyboard/ESP32-BLE-Keyboard | 2 +- .../BLEKeyboard/ESP32-BLE-Keyboard.patch | 25 ++-- Sming/Libraries/BLEKeyboard/component.mk | 2 + Sming/Libraries/NimBLE/component.mk | 2 + Sming/Libraries/NimBLE/esp-nimble-cpp | 2 +- Sming/Libraries/NimBLE/esp-nimble-cpp.patch | 28 +++++ 9 files changed, 162 insertions(+), 17 deletions(-) create mode 100644 Sming/Libraries/NimBLE/esp-nimble-cpp.patch diff --git a/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad b/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad index f74c1a521e..11ee6e927d 160000 --- a/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad +++ b/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad @@ -1 +1 @@ -Subproject commit f74c1a521e3d27c39099579db603ae477b26a400 +Subproject commit 11ee6e927df7c8bef37b2cdc36eb798e5173c15f diff --git a/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad.patch b/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad.patch index 07a2e489eb..230cf7ca4c 100644 --- a/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad.patch +++ b/Sming/Libraries/BLEGamepad/ESP32-BLE-Gamepad.patch @@ -1,8 +1,8 @@ diff --git a/BleGamepad.cpp b/BleGamepad.cpp -index 212e6d7..f7fc502 100644 +index 4df4796..e0cbf0c 100644 --- a/BleGamepad.cpp +++ b/BleGamepad.cpp -@@ -834,8 +834,7 @@ void BleGamepad::release(uint8_t b) +@@ -843,8 +843,7 @@ void BleGamepad::release(uint8_t b) uint8_t BleGamepad::specialButtonBitPosition(uint8_t b) { @@ -12,3 +12,113 @@ index 212e6d7..f7fc502 100644 uint8_t bit = 0; for (int i = 0; i < b; i++) { +diff --git a/BleGamepad.h b/BleGamepad.h +index ab17740..28752e5 100644 +--- a/BleGamepad.h ++++ b/BleGamepad.h +@@ -107,7 +107,7 @@ public: + std::string deviceName; + + protected: +- virtual void onStarted(NimBLEServer *pServer){}; ++ virtual void onStarted(NimBLEServer *){}; + }; + + #endif // CONFIG_BT_NIMBLE_ROLE_PERIPHERAL +diff --git a/BleConnectionStatus.cpp b/BleConnectionStatus.cpp +index 5d11694..f2fa751 100644 +--- a/BleConnectionStatus.cpp ++++ b/BleConnectionStatus.cpp +@@ -4,13 +4,13 @@ BleConnectionStatus::BleConnectionStatus(void) + { + } + +-void BleConnectionStatus::onConnect(NimBLEServer *pServer, ble_gap_conn_desc* desc) ++void BleConnectionStatus::onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) + { +- pServer->updateConnParams(desc->conn_handle, 6, 7, 0, 600); +- this->connected = true; ++ pServer->updateConnParams(connInfo.getConnHandle(), 6, 7, 0, 600); ++ this->connected = true; + } + +-void BleConnectionStatus::onDisconnect(NimBLEServer *pServer) ++void BleConnectionStatus::onDisconnect(NimBLEServer*, NimBLEConnInfo&, int) + { +- this->connected = false; ++ this->connected = false; + } +diff --git a/BleConnectionStatus.h b/BleConnectionStatus.h +index 15997f4..b99fd6f 100644 +--- a/BleConnectionStatus.h ++++ b/BleConnectionStatus.h +@@ -14,8 +14,8 @@ class BleConnectionStatus : public NimBLEServerCallbacks + public: + BleConnectionStatus(void); + bool connected = false; +- void onConnect(NimBLEServer *pServer, ble_gap_conn_desc* desc); +- void onDisconnect(NimBLEServer *pServer); ++ void onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo) override; ++ void onDisconnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo, int reason) override; + NimBLECharacteristic *inputGamepad; + }; + +diff --git a/BleGamepadConfiguration.cpp b/BleGamepadConfiguration.cpp +index 87f50ee..5004ee6 100644 +--- a/BleGamepadConfiguration.cpp ++++ b/BleGamepadConfiguration.cpp +@@ -114,11 +114,11 @@ bool BleGamepadConfiguration::getIncludeAccelerator() { return _whichSimulationC + bool BleGamepadConfiguration::getIncludeBrake() { return _whichSimulationControls[BRAKE]; } + bool BleGamepadConfiguration::getIncludeSteering() { return _whichSimulationControls[STEERING]; } + const bool *BleGamepadConfiguration::getWhichSimulationControls() const { return _whichSimulationControls; } +-char *BleGamepadConfiguration::getModelNumber(){ return _modelNumber; } +-char *BleGamepadConfiguration::getSoftwareRevision(){ return _softwareRevision; } +-char *BleGamepadConfiguration::getSerialNumber(){ return _serialNumber; } +-char *BleGamepadConfiguration::getFirmwareRevision(){ return _firmwareRevision; } +-char *BleGamepadConfiguration::getHardwareRevision(){ return _hardwareRevision; } ++const char *BleGamepadConfiguration::getModelNumber(){ return _modelNumber; } ++const char *BleGamepadConfiguration::getSoftwareRevision(){ return _softwareRevision; } ++const char *BleGamepadConfiguration::getSerialNumber(){ return _serialNumber; } ++const char *BleGamepadConfiguration::getFirmwareRevision(){ return _firmwareRevision; } ++const char *BleGamepadConfiguration::getHardwareRevision(){ return _hardwareRevision; } + + void BleGamepadConfiguration::setWhichSpecialButtons(bool start, bool select, bool menu, bool home, bool back, bool volumeInc, bool volumeDec, bool volumeMute) + { +diff --git a/BleGamepadConfiguration.h b/BleGamepadConfiguration.h +index 598543f..daf4d03 100644 +--- a/BleGamepadConfiguration.h ++++ b/BleGamepadConfiguration.h +@@ -217,11 +217,11 @@ private: + int16_t _axesMax; + int16_t _simulationMin; + int16_t _simulationMax; +- char *_modelNumber; +- char *_softwareRevision; +- char *_serialNumber; +- char *_firmwareRevision; +- char *_hardwareRevision; ++ const char *_modelNumber; ++ const char *_softwareRevision; ++ const char *_serialNumber; ++ const char *_firmwareRevision; ++ const char *_hardwareRevision; + + public: + BleGamepadConfiguration(); +@@ -267,11 +267,11 @@ public: + int16_t getAxesMax(); + int16_t getSimulationMin(); + int16_t getSimulationMax(); +- char *getModelNumber(); +- char *getSoftwareRevision(); +- char *getSerialNumber(); +- char *getFirmwareRevision(); +- char *getHardwareRevision(); ++ const char *getModelNumber(); ++ const char *getSoftwareRevision(); ++ const char *getSerialNumber(); ++ const char *getFirmwareRevision(); ++ const char *getHardwareRevision(); + + void setControllerType(uint8_t controllerType); + void setAutoReport(bool value); diff --git a/Sming/Libraries/BLEGamepad/component.mk b/Sming/Libraries/BLEGamepad/component.mk index 1bec8c0d31..d18f812e32 100644 --- a/Sming/Libraries/BLEGamepad/component.mk +++ b/Sming/Libraries/BLEGamepad/component.mk @@ -6,3 +6,5 @@ COMPONENT_INCDIRS := $(COMPONENT_SRCDIRS) COMPONENT_CPPFLAGS:= -DUSE_NIMBLE=1 APP_CFLAGS += -DUSE_NIMBLE=1 + +COMPONENT_CXXFLAGS := -Wno-unused-parameter diff --git a/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard b/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard index f8dd485211..b7aaf9bb71 160000 --- a/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard +++ b/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard @@ -1 +1 @@ -Subproject commit f8dd4852113a722a6b8dc8af987e94cf84d73ad5 +Subproject commit b7aaf9bb711a04216e4417f1e2a6b0ee0eaeaf66 diff --git a/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard.patch b/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard.patch index 78efa2e1f8..740ccbc938 100644 --- a/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard.patch +++ b/Sming/Libraries/BLEKeyboard/ESP32-BLE-Keyboard.patch @@ -1,35 +1,35 @@ diff --git a/BleKeyboard.cpp b/BleKeyboard.cpp -index 0d043f4..d317e83 100644 +index 48a8930..72b0253 100644 --- a/BleKeyboard.cpp +++ b/BleKeyboard.cpp -@@ -499,7 +499,7 @@ size_t BleKeyboard::write(const uint8_t *buffer, size_t size) { +@@ -500,7 +500,7 @@ size_t BleKeyboard::write(const uint8_t *buffer, size_t size) { return n; } -void BleKeyboard::onConnect(BLEServer* pServer) { -+void BleKeyboard::onConnect(BLEServer* pServer, BLEConnInfo& connInfo) { ++void BleKeyboard::onConnect(BLEServer*, BLEConnInfo&) { this->connected = true; #if !defined(USE_NIMBLE) -@@ -513,7 +513,7 @@ void BleKeyboard::onConnect(BLEServer* pServer) { +@@ -514,7 +514,7 @@ void BleKeyboard::onConnect(BLEServer* pServer) { } -void BleKeyboard::onDisconnect(BLEServer* pServer) { -+void BleKeyboard::onDisconnect(BLEServer* pServer, BLEConnInfo& connInfo, int reason) { ++void BleKeyboard::onDisconnect(BLEServer*, BLEConnInfo&, int) { this->connected = false; #if !defined(USE_NIMBLE) -@@ -528,7 +528,7 @@ void BleKeyboard::onDisconnect(BLEServer* pServer) { +@@ -529,7 +529,7 @@ void BleKeyboard::onDisconnect(BLEServer* pServer) { #endif // !USE_NIMBLE } -void BleKeyboard::onWrite(BLECharacteristic* me) { -+void BleKeyboard::onWrite(BLECharacteristic* me, BLEConnInfo& connInfo) { ++void BleKeyboard::onWrite(BLECharacteristic* me, BLEConnInfo&) { uint8_t* value = (uint8_t*)(me->getValue().c_str()); (void)value; ESP_LOGI(LOG_TAG, "special keys: %d", *value); -@@ -539,8 +539,8 @@ void BleKeyboard::delay_ms(uint64_t ms) { +@@ -540,8 +540,8 @@ void BleKeyboard::delay_ms(uint64_t ms) { if(ms){ uint64_t e = (m + (ms * 1000)); if(m > e){ //overflow @@ -40,9 +40,8 @@ index 0d043f4..d317e83 100644 + while(uint64_t(esp_timer_get_time()) < e) {} } } -\ No newline at end of file diff --git a/BleKeyboard.h b/BleKeyboard.h -index 0736a02..e72216d 100644 +index 0736a02..9299394 100644 --- a/BleKeyboard.h +++ b/BleKeyboard.h @@ -11,6 +11,7 @@ @@ -53,13 +52,15 @@ index 0736a02..e72216d 100644 #define BLEDevice NimBLEDevice #define BLEServerCallbacks NimBLEServerCallbacks #define BLECharacteristicCallbacks NimBLECharacteristicCallbacks -@@ -173,9 +174,9 @@ public: +@@ -172,10 +173,10 @@ public: + void set_product_id(uint16_t pid); void set_version(uint16_t version); protected: - virtual void onStarted(BLEServer *pServer) { }; +- virtual void onStarted(BLEServer *pServer) { }; - virtual void onConnect(BLEServer* pServer) override; - virtual void onDisconnect(BLEServer* pServer) override; - virtual void onWrite(BLECharacteristic* me) override; ++ virtual void onStarted(BLEServer*) { }; + virtual void onConnect(BLEServer* pServer, BLEConnInfo& connInfo) override; + virtual void onDisconnect(BLEServer* pServer, BLEConnInfo& connInfo, int reason) override; + virtual void onWrite(BLECharacteristic* me, BLEConnInfo& connInfo) override; diff --git a/Sming/Libraries/BLEKeyboard/component.mk b/Sming/Libraries/BLEKeyboard/component.mk index 6016b6b22a..b68ee851ae 100644 --- a/Sming/Libraries/BLEKeyboard/component.mk +++ b/Sming/Libraries/BLEKeyboard/component.mk @@ -7,3 +7,5 @@ COMPONENT_INCDIRS := $(COMPONENT_SRCDIRS) COMPONENT_CPPFLAGS:= -DUSE_NIMBLE=1 APP_CFLAGS += -DUSE_NIMBLE=1 + +COMPONENT_CXXFLAGS := -Wno-unused-parameter diff --git a/Sming/Libraries/NimBLE/component.mk b/Sming/Libraries/NimBLE/component.mk index dd9d540ce3..9bb8f54dfc 100644 --- a/Sming/Libraries/NimBLE/component.mk +++ b/Sming/Libraries/NimBLE/component.mk @@ -4,3 +4,5 @@ COMPONENT_SOC := esp32 esp32c3 esp32s3 COMPONENT_SRCDIRS := esp-nimble-cpp/src COMPONENT_INCDIRS := $(COMPONENT_SRCDIRS) + +COMPONENT_CXXFLAGS := -Wno-unused-parameter diff --git a/Sming/Libraries/NimBLE/esp-nimble-cpp b/Sming/Libraries/NimBLE/esp-nimble-cpp index 05ac9deaea..3c5a2fd4a9 160000 --- a/Sming/Libraries/NimBLE/esp-nimble-cpp +++ b/Sming/Libraries/NimBLE/esp-nimble-cpp @@ -1 +1 @@ -Subproject commit 05ac9deaead7e05865fd7aaca5f9f8747d00a99a +Subproject commit 3c5a2fd4a9c327e87f9b5cdcf9b7382f66bc11be diff --git a/Sming/Libraries/NimBLE/esp-nimble-cpp.patch b/Sming/Libraries/NimBLE/esp-nimble-cpp.patch new file mode 100644 index 0000000000..d747d496de --- /dev/null +++ b/Sming/Libraries/NimBLE/esp-nimble-cpp.patch @@ -0,0 +1,28 @@ +diff --git a/src/NimBLEAttValue.h b/src/NimBLEAttValue.h +index 786bc8b..08b7e16 100644 +--- a/src/NimBLEAttValue.h ++++ b/src/NimBLEAttValue.h +@@ -178,7 +178,7 @@ public: + #else + time_t getTimeStamp() const { return 0; } + void setTimeStamp() { } +- void setTimeStamp(time_t t) { } ++ void setTimeStamp(time_t) { } + #endif + + /** +diff --git a/src/NimBLEUtils.h b/src/NimBLEUtils.h +index 006d935..8c8926e 100644 +--- a/src/NimBLEUtils.h ++++ b/src/NimBLEUtils.h +@@ -13,7 +13,10 @@ + #if defined(CONFIG_BT_ENABLED) + + #if defined(CONFIG_NIMBLE_CPP_IDF) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wunused-parameter" + #include "host/ble_gap.h" ++#pragma GCC diagnostic pop + #else + #include "nimble/nimble/host/include/host/ble_gap.h" + #endif