disable BLE
This commit is contained in:
@@ -54,6 +54,24 @@ void IRAM_ATTR startSleep() {
|
||||
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() {
|
||||
Serial.begin(115200);
|
||||
display.setup();
|
||||
@@ -79,15 +97,7 @@ void setup() {
|
||||
nau.read();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
reset();
|
||||
|
||||
#if BLE
|
||||
// initialize the Bluetooth® Low Energy hardware
|
||||
@@ -123,6 +133,16 @@ void setup() {
|
||||
}
|
||||
|
||||
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()) {
|
||||
delay(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user