minor code cleaning
This commit is contained in:
parent
6074f1fe89
commit
7ccb4f4951
|
|
@ -59,10 +59,6 @@ bool bluetoothConnected = false;
|
||||||
bool bluetoothActive = Config.bluetooth;
|
bool bluetoothActive = Config.bluetooth;
|
||||||
bool sendBleToLoRa = false;
|
bool sendBleToLoRa = false;
|
||||||
bool bleConnected = false;
|
bool bleConnected = false;
|
||||||
String bleLoRaPacket = "";
|
|
||||||
int bleMsgCompose = 0;
|
|
||||||
String bleMsgAddresse = "";
|
|
||||||
String bleMsgTxt = "";
|
|
||||||
String BLEToLoRaPacket = "";
|
String BLEToLoRaPacket = "";
|
||||||
|
|
||||||
bool messageLed = false;
|
bool messageLed = false;
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,6 @@ BLECharacteristic *pCharacteristicRx;
|
||||||
|
|
||||||
extern logging::Logger logger;
|
extern logging::Logger logger;
|
||||||
extern bool sendBleToLoRa;
|
extern bool sendBleToLoRa;
|
||||||
extern String bleLoRaPacket;
|
|
||||||
extern int bleMsgCompose;
|
|
||||||
extern String bleMsgAddresse;
|
|
||||||
extern String bleMsgTxt;
|
|
||||||
extern bool bleConnected;
|
extern bool bleConnected;
|
||||||
extern String BLEToLoRaPacket;
|
extern String BLEToLoRaPacket;
|
||||||
|
|
||||||
|
|
@ -46,19 +42,11 @@ class MyCallbacks : public NimBLECharacteristicCallbacks {
|
||||||
void onWrite(NimBLECharacteristic *pCharacteristic) {
|
void onWrite(NimBLECharacteristic *pCharacteristic) {
|
||||||
std::string receivedData = pCharacteristic->getValue(); // Read the data from the characteristic
|
std::string receivedData = pCharacteristic->getValue(); // Read the data from the characteristic
|
||||||
String receivedString = "";
|
String receivedString = "";
|
||||||
for (int i=0; i<receivedData.length();i++) { // Remove the two first bytes and the last
|
for (int i=0; i<receivedData.length();i++) {
|
||||||
receivedString += receivedData[i];
|
receivedString += receivedData[i];
|
||||||
//Serial.print(receivedData[i],HEX); Serial.print(" "); // Small mod by LA1HSA to output HEX values
|
|
||||||
}
|
}
|
||||||
/*Serial.println();
|
|
||||||
Serial.print("receivedString: ");
|
|
||||||
Serial.println(receivedString);*/
|
|
||||||
|
|
||||||
BLEToLoRaPacket = AX25_Utils::processAX25(receivedString);
|
BLEToLoRaPacket = AX25_Utils::processAX25(receivedString);
|
||||||
//
|
|
||||||
///BLEToLoRaPacket = "CD2RXU-7>APLRT1:>test";
|
|
||||||
Serial.println(BLEToLoRaPacket); //just validation
|
Serial.println(BLEToLoRaPacket); //just validation
|
||||||
//
|
|
||||||
sendBleToLoRa = true;
|
sendBleToLoRa = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -73,7 +61,6 @@ namespace BLE_Utils {
|
||||||
|
|
||||||
BLEService *pService = pServer->createService(SERVICE_UUID);
|
BLEService *pService = pServer->createService(SERVICE_UUID);
|
||||||
|
|
||||||
|
|
||||||
pCharacteristicTx = pService->createCharacteristic(
|
pCharacteristicTx = pService->createCharacteristic(
|
||||||
CHARACTERISTIC_UUID_TX,
|
CHARACTERISTIC_UUID_TX,
|
||||||
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY
|
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY
|
||||||
|
|
@ -93,7 +80,7 @@ namespace BLE_Utils {
|
||||||
pServer->getAdvertising()->setMinPreferred(0x06);
|
pServer->getAdvertising()->setMinPreferred(0x06);
|
||||||
pServer->getAdvertising()->setMaxPreferred(0x0C);
|
pServer->getAdvertising()->setMaxPreferred(0x0C);
|
||||||
|
|
||||||
pAdvertising->start(); // pServer->getAdvertising()->start();
|
pAdvertising->start();
|
||||||
|
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE", "%s", "Waiting for BLE central to connect...");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BLE", "%s", "Waiting for BLE central to connect...");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue