disable BLE

This commit is contained in:
2025-10-14 11:50:02 +02:00
parent f82975fe71
commit 65e0a12771
2 changed files with 30 additions and 10 deletions

View File

@@ -40,7 +40,7 @@
/********************* BLE ********************************/ /********************* BLE ********************************/
#define BLE true #define BLE false
#if BLE #if BLE
#define SERVICE_UUID "9f0dfdb2-e978-494c-8f15-68dbe8d28672" #define SERVICE_UUID "9f0dfdb2-e978-494c-8f15-68dbe8d28672"
#define MILLIS_UUID "abb92561-a809-453c-8c7c-71d3fff5b86e" #define MILLIS_UUID "abb92561-a809-453c-8c7c-71d3fff5b86e"

View File

@@ -54,6 +54,24 @@ void IRAM_ATTR startSleep() {
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
void reset() {
while (! nau.calibrate(NAU7802_CALMOD_INTERNAL)) {
Serial.println("Failed to calibrate internal offset, retrying!");
delay(1000);
}
while (! nau.calibrate(NAU7802_CALMOD_OFFSET)) {
Serial.println("Failed to calibrate system offset, retrying!");
delay(1000);
}
// Take 10 readings to flush out readings
for (uint8_t i=0; i<10; i++) {
while (! nau.available()) delay(1);
nau.read();
}
}
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
display.setup(); display.setup();
@@ -79,15 +97,7 @@ void setup() {
nau.read(); nau.read();
} }
while (! nau.calibrate(NAU7802_CALMOD_INTERNAL)) { reset();
Serial.println("Failed to calibrate internal offset, retrying!");
delay(1000);
}
while (! nau.calibrate(NAU7802_CALMOD_OFFSET)) {
Serial.println("Failed to calibrate system offset, retrying!");
delay(1000);
}
#if BLE #if BLE
// initialize the Bluetooth® Low Energy hardware // initialize the Bluetooth® Low Energy hardware
@@ -123,6 +133,16 @@ void setup() {
} }
void loop() { void loop() {
if (Serial.available() != 0) {
String command = Serial.readString(); //read until timeout
command.trim();
Serial.println(command);
if (command == "reset") {
reset();
Serial.println("calibrated");
}
} //wait for data available
while (!nau.available()) { while (!nau.available()) {
delay(1); delay(1);
} }