Fix BLE scan + touch logic + UUID + version read
- Client: change passive BLE scan to active scan (setActiveScan(true)) Server puts name/UUID in scan response; passive scan never received them, so isAdvertisingService() and getName() failed. - Server: add INPUT_PULLUP on touch pins to prevent floating triggers when sensors disconnected - Server: update BLE UUID characteristic in SET_ID handler (pUuidChar->setValue) so reconnecting clients see correct UUID - Server: touch logic changed from t1Active/t2Active to !t1Active/!t2Active (door closed = relay ON) - Android: flushReadBuffer before VERSION? to discard stale boot log output; use Regex for BUILD_NR parsing - copy_firmware.sh: copy to firmware/server/ and firmware/client/ subdirectories to match EspFlasher.assetPath() - version.txt: server=20 client=5
This commit is contained in:
parent
6a07505d02
commit
cd2d949f87
7 changed files with 64 additions and 31 deletions
|
|
@ -66,6 +66,7 @@ class MyScanCallbacks : public NimBLEScanCallbacks {
|
|||
serverAddress = advertisedDevice->getAddress();
|
||||
serverFound = true;
|
||||
NimBLEDevice::getScan()->stop();
|
||||
ESP_LOGI(TAG, "Found server: %s", advertisedDevice->getAddress().toString().c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -220,8 +221,8 @@ void setup() {
|
|||
|
||||
allProvisioned = keyProvisioned && uuidProvisioned && serverProvisioned;
|
||||
|
||||
pinMode(TOUCH1_PIN, INPUT);
|
||||
pinMode(TOUCH2_PIN, INPUT);
|
||||
pinMode(TOUCH1_PIN, INPUT_PULLUP);
|
||||
pinMode(TOUCH2_PIN, INPUT_PULLUP);
|
||||
pinMode(BUTTON_PIN, INPUT);
|
||||
|
||||
if (allProvisioned) {
|
||||
|
|
@ -231,7 +232,7 @@ void setup() {
|
|||
pScan->setScanCallbacks(new MyScanCallbacks());
|
||||
pScan->setInterval(97);
|
||||
pScan->setWindow(37);
|
||||
pScan->setActiveScan(false);
|
||||
pScan->setActiveScan(true);
|
||||
pScan->setMaxResults(0);
|
||||
bleReady = true;
|
||||
ESP_LOGI(TAG, "BLE: initialized, scanning for service UUID");
|
||||
|
|
@ -286,7 +287,7 @@ void loop() {
|
|||
pScan->setScanCallbacks(new MyScanCallbacks());
|
||||
pScan->setInterval(97);
|
||||
pScan->setWindow(37);
|
||||
pScan->setActiveScan(false);
|
||||
pScan->setActiveScan(true);
|
||||
pScan->setMaxResults(0);
|
||||
bleReady = true;
|
||||
ESP_LOGI(TAG, "BLE: initialized after key provisioning");
|
||||
|
|
@ -329,7 +330,7 @@ void loop() {
|
|||
pScan->setScanCallbacks(new MyScanCallbacks());
|
||||
pScan->setInterval(97);
|
||||
pScan->setWindow(37);
|
||||
pScan->setActiveScan(false);
|
||||
pScan->setActiveScan(true);
|
||||
pScan->setMaxResults(0);
|
||||
bleReady = true;
|
||||
ESP_LOGI(TAG, "BLE: initialized after server provisioning");
|
||||
|
|
|
|||
Loading…
Reference in a new issue