Compare commits
3
Commits
f851e79c35
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b02ed4c8d5 | ||
|
|
a23322dddf | ||
|
|
6167432e1b |
+9
-7
@@ -4,11 +4,12 @@
|
||||
// Flag to signal that a new reading is ready to be processed
|
||||
volatile bool newReadingAvailable = false;
|
||||
volatile int lastReadFPS = 0;
|
||||
|
||||
static NimBLEScan* pScan;
|
||||
static NimBLEClient* _pClient = nullptr;
|
||||
static ChronoBLE::ConnectionState currentState;
|
||||
static const NimBLEAdvertisedDevice* advDevice = nullptr;
|
||||
static uint32_t scanTimeMs = 5000;
|
||||
static uint32_t scanTimeMs = 1000; //5000
|
||||
static uint32_t scanTimeoutMs = 1000;
|
||||
static NimBLEUUID deviceUUID("0000180a-0000-1000-8000-00805f9b34fb");
|
||||
static NimBLEUUID serviceUUID("00001623-88EC-688C-644B-3FA706C0BB75");
|
||||
static NimBLEUUID speedCharacteristicUUID("00001624-88EC-688C-644B-3FA706C0BB75");
|
||||
@@ -58,7 +59,8 @@ class ScanCallbacks : public NimBLEScanCallbacks {
|
||||
/** Callback to process the results of the completed scan or restart it */
|
||||
void onScanEnd(const NimBLEScanResults& results, int reason) override {
|
||||
//Serial.printf("Scan Ended, reason: %d, device count: %d; Restarting scan\n", reason, results.getCount());
|
||||
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
|
||||
delay(scanTimeoutMs);
|
||||
pScan->start(scanTimeMs, false, false);
|
||||
}
|
||||
} scanCallbacks;
|
||||
|
||||
@@ -94,11 +96,11 @@ ChronoBLE::ChronoBLE() {
|
||||
void ChronoBLE::init() {
|
||||
NimBLEDevice::init("FX-Chrono-Client");
|
||||
NimBLEDevice::setPower(3); /** 3dbm */
|
||||
NimBLEScan* pScan = NimBLEDevice::getScan();
|
||||
pScan = NimBLEDevice::getScan();
|
||||
pScan->setScanCallbacks(&scanCallbacks, false);
|
||||
pScan->setInterval(100);
|
||||
pScan->setWindow(100);
|
||||
pScan->setActiveScan(true);
|
||||
pScan->setWindow(99);
|
||||
pScan->setActiveScan(false);
|
||||
}
|
||||
void ChronoBLE::_setState(ConnectionState state){
|
||||
currentState=state;
|
||||
@@ -122,7 +124,7 @@ bool ChronoBLE::foundDevice(){if (advDevice!=nullptr){return true;}return false;
|
||||
void ChronoBLE::startScan(){
|
||||
Serial.println("starting scan!!!");
|
||||
_setState(SCANNING);
|
||||
NimBLEDevice::getScan()->start(scanTimeMs, false, true);
|
||||
pScan->start(scanTimeMs, false, false);
|
||||
}
|
||||
void ChronoBLE::_disconnectDevice(){
|
||||
_setState(IDLE);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+184
-207
File diff suppressed because one or more lines are too long
@@ -6,6 +6,7 @@
|
||||
#include <NetworkClient.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <Update.h>
|
||||
#include <Preferences.h>
|
||||
#include <ChronoBLE.h>
|
||||
#include <GunProfile.h>
|
||||
#include "ChronoVersion.h"
|
||||
@@ -36,6 +37,10 @@ class ChronoWebServer {
|
||||
static void _handleTestMode();
|
||||
static void _handleOta();
|
||||
static void _handleVersion();
|
||||
static void _handleWifi();
|
||||
static void _handleWifiSave();
|
||||
static void _handleClearWifi();
|
||||
static void _handleWifiMode();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user