repeat
This commit is contained in:
parent
9cffaa9025
commit
939df496f8
25
ESPBMS.ino
25
ESPBMS.ino
@ -18,6 +18,9 @@ void setup() {
|
||||
Serial.println("Scanning...");
|
||||
}
|
||||
|
||||
bool gotBasicInfo;
|
||||
bool gotCellInfo;
|
||||
|
||||
void loop() {
|
||||
BLEScan* pBLEScan = BLEDevice::getScan(); // Create new scan
|
||||
pBLEScan->setActiveScan(true); // Active scan uses more power, but get results faster
|
||||
@ -96,21 +99,29 @@ void loop() {
|
||||
}
|
||||
Serial.println(" - TX is writable");
|
||||
|
||||
while(1){
|
||||
bool gotBasicInfo=false;
|
||||
bool gotCellInfo=false;
|
||||
while(gotBasicInfo==false || gotCellInfo==false){
|
||||
// REQUEST BASIC INFO
|
||||
// header status command length data checksum footer
|
||||
// DD A5 03 00 FF FD 77
|
||||
delay(500);
|
||||
uint8_t a_data[7] = {0xdd, 0xa5, 3, 0x0, 0xff, 0xfd, 0x77};
|
||||
pRemoteCharacteristic_tx->writeValue(a_data, sizeof(a_data), false);
|
||||
if(gotBasicInfo==false){
|
||||
delay(500);
|
||||
uint8_t a_data[7] = {0xdd, 0xa5, 3, 0x0, 0xff, 0xfd, 0x77};
|
||||
pRemoteCharacteristic_tx->writeValue(a_data, sizeof(a_data), false);
|
||||
}
|
||||
|
||||
// REQUEST CELL INFO
|
||||
// header status command length data checksum footer
|
||||
// DD A5 03 00 FF FD 77
|
||||
delay(500);
|
||||
uint8_t b_data[7] = {0xdd, 0xa5, 4, 0x0, 0xff, 0xfc, 0x77};
|
||||
pRemoteCharacteristic_tx->writeValue(b_data, sizeof(b_data), false);
|
||||
if(gotCellInfo==false){
|
||||
delay(500);
|
||||
uint8_t b_data[7] = {0xdd, 0xa5, 4, 0x0, 0xff, 0xfc, 0x77};
|
||||
pRemoteCharacteristic_tx->writeValue(b_data, sizeof(b_data), false);
|
||||
}
|
||||
}
|
||||
|
||||
Serial.printf("\r\n\r\n===============================\r\n\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user