minor code cleaning

This commit is contained in:
richonguzman 2023-11-28 01:24:36 -03:00
parent 6074f1fe89
commit 7ccb4f4951
2 changed files with 2 additions and 19 deletions

View File

@ -59,10 +59,6 @@ bool bluetoothConnected = false;
bool bluetoothActive = Config.bluetooth;
bool sendBleToLoRa = false;
bool bleConnected = false;
String bleLoRaPacket = "";
int bleMsgCompose = 0;
String bleMsgAddresse = "";
String bleMsgTxt = "";
String BLEToLoRaPacket = "";
bool messageLed = false;

View File

@ -21,10 +21,6 @@ BLECharacteristic *pCharacteristicRx;
extern logging::Logger logger;
extern bool sendBleToLoRa;
extern String bleLoRaPacket;
extern int bleMsgCompose;
extern String bleMsgAddresse;
extern String bleMsgTxt;
extern bool bleConnected;
extern String BLEToLoRaPacket;
@ -46,19 +42,11 @@ class MyCallbacks : public NimBLECharacteristicCallbacks {
void onWrite(NimBLECharacteristic *pCharacteristic) {
std::string receivedData = pCharacteristic->getValue(); // Read the data from the characteristic
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];
//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 = "CD2RXU-7>APLRT1:>test";
Serial.println(BLEToLoRaPacket); //just validation
//
sendBleToLoRa = true;
}
};
@ -73,7 +61,6 @@ namespace BLE_Utils {
BLEService *pService = pServer->createService(SERVICE_UUID);
pCharacteristicTx = pService->createCharacteristic(
CHARACTERISTIC_UUID_TX,
NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY
@ -93,7 +80,7 @@ namespace BLE_Utils {
pServer->getAdvertising()->setMinPreferred(0x06);
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...");
}