From 42021f83c19c214c9d284968b5e13515aaf06508 Mon Sep 17 00:00:00 2001 From: Leonid Meleshin Date: Tue, 2 Jul 2024 14:52:51 +0400 Subject: [PATCH 1/2] fix(bHaptics): add GlobalConfig char Fixes #119 --- lib/bhaptics_ble/connection_bhble.cpp | 47 ++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/lib/bhaptics_ble/connection_bhble.cpp b/lib/bhaptics_ble/connection_bhble.cpp index 6367b64d..53fcc3a7 100644 --- a/lib/bhaptics_ble/connection_bhble.cpp +++ b/lib/bhaptics_ble/connection_bhble.cpp @@ -140,7 +140,11 @@ void BH::ConnectionBHBLE::begin() this->bleServer->getAdvertising()->setScanResponseData(*scanResponseData); // Each characteristic needs 2 handles and descriptor 1 handle. +#if defined(BLUETOOTH_USE_NIMBLE) && BLUETOOTH_USE_NIMBLE == true this->motorService = this->bleServer->createService(BH_BLE_SERVICE_MOTOR_UUID); +#else + this->motorService = this->bleServer->createService(BH_BLE_SERVICE_MOTOR_UUID, 30, 0); +#endif { MotorCharCallbacks* motorCallbacks = new MotorCharCallbacks(this->motorHandler); @@ -160,6 +164,14 @@ void BH::ConnectionBHBLE::begin() PROPERTY_READ | PROPERTY_WRITE ); configChar->setCallbacks(new ConfigCharCallbacks()); + + uint8_t config[3] = { + 0, // byte 0 - ? + 0, // byte 1 - ? + 0, // byte 2 - color, + // but for tactosy it is switching left/right position + }; + configChar->setValue(config, 3); } { @@ -212,15 +224,34 @@ void BH::ConnectionBHBLE::begin() monitorChar->addDescriptor(new BLE2902()); #endif - uint16_t audioCableState = NO_AUDIO_CABLE; - monitorChar->setValue(audioCableState); + // bit 7 - audio jack (0: off, 1: on) + uint8_t status = 0b00000000; + + uint8_t value[1] = { status }; + monitorChar->setValue(value, 1); } - // auto* athGlobalChar = this->motorService->createCharacteristic( - // BH_BLE_SERVICE_MOTOR_CHAR_ATH_GLOBAL_CONF_UUID, - // PROPERTY_READ | PROPERTY_WRITE | PROPERTY_NOTIFY | PROPERTY_BROADCAST | PROPERTY_INDICATE | PROPERTY_WRITE_NR - // ); - // athGlobalChar->setCallbacks(new SerialOutputCharCallbacks()); + { + auto* athGlobalChar = this->motorService->createCharacteristic( + BH_BLE_SERVICE_MOTOR_CHAR_ATH_GLOBAL_CONF_UUID, + PROPERTY_READ | PROPERTY_WRITE + ); + athGlobalChar->setCallbacks(new SerialOutputCharCallbacks()); + + uint8_t athGlobalConfig[20] = { + 0, // byte 0 - ? + 0, // byte 1 - VSM + 0, // byte 2 - AthConfigIndex + 0, // byte 3 - AthConfigIndex + 0, // byte 4 - SignaturePatternOnOff (0: off, 1: on) + 0, // byte 5 - WaitMinutes + 0, // byte 6 - DisableEmbedAth (0: off, 1: on) + 0, // byte 7 - ButtonLock (0: off, 1: on) + 0, // byte 8 - LedInfo + }; + + athGlobalChar->setValue(athGlobalConfig, 20); + } // auto* athThemeChar = this->motorService->createCharacteristic( // BH_BLE_SERVICE_MOTOR_CHAR_ATH_THEME_UUID, @@ -246,7 +277,7 @@ void BH::ConnectionBHBLE::begin() auto dfuService = this->bleServer->createService(BH_BLE_SERVICE_DFU_UUID); auto* dfuControlChar = dfuService->createCharacteristic( - BH_BLE_SERVICE_MOTOR_CHAR_SIGNATURE_PATTERN_UUID, + BH_BLE_SERVICE_DFU_CHAR_CONTROL_UUID, PROPERTY_READ | PROPERTY_WRITE ); dfuService->start(); From 40044a273ed16cfdd5f008c88a83312aad23ce47 Mon Sep 17 00:00:00 2001 From: Leonid Meleshin Date: Tue, 2 Jul 2024 16:26:16 +0400 Subject: [PATCH 2/2] ci(GitHub): run CI on support branches --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa9c5153..56b6791d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,14 @@ on: branches: - master - develop + - support/* paths-ignore: - '**/*.md' push: branches: - master - develop + - support/* paths-ignore: - '**/*.md'