BLE Text Test
This commit is contained in:
parent
f5920727ab
commit
a2ae412b1a
|
|
@ -45,7 +45,7 @@ TinyGPSPlus gps;
|
|||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||
#endif
|
||||
|
||||
String versionDate = "2024.05.17";
|
||||
String versionDate = "2024.05.21";
|
||||
|
||||
uint8_t myBeaconsIndex = 0;
|
||||
int myBeaconsSize = Config.beacons.size();
|
||||
|
|
@ -180,7 +180,7 @@ void loop() {
|
|||
MSG_Utils::ledNotification();
|
||||
Utils::checkFlashlight();
|
||||
STATION_Utils::checkListenedTrackersByTimeAndDelete();
|
||||
if (Config.bluetoothType == 0 || Config.bluetoothType == 3) {
|
||||
if (Config.bluetoothType == 0 || Config.bluetoothType == 2) {
|
||||
BLE_Utils::sendToLoRa();
|
||||
} else {
|
||||
#ifdef HAS_BT_CLASSIC
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class MyCallbacks : public NimBLECharacteristicCallbacks {
|
|||
}
|
||||
if (Config.bluetoothType == 0) {
|
||||
BLEToLoRaPacket = AX25_Utils::AX25FrameToLoRaPacket(receivedString);
|
||||
} else if (Config.bluetoothType == 3) {
|
||||
} else if (Config.bluetoothType == 2) {
|
||||
BLEToLoRaPacket = receivedString;
|
||||
}
|
||||
sendBleToLoRa = true;
|
||||
|
|
@ -112,21 +112,29 @@ namespace BLE_Utils {
|
|||
}
|
||||
|
||||
void txToPhoneOverBLE(const String& frame) {
|
||||
txBLE((byte)KissChar::Fend);
|
||||
txBLE((byte)KissCmd::Data);
|
||||
if (Config.bluetoothType == 0) {
|
||||
txBLE((byte)KissChar::Fend);
|
||||
txBLE((byte)KissCmd::Data);
|
||||
}
|
||||
for(int n = 0; n < frame.length(); n++) {
|
||||
uint8_t byteCharacter = frame[n];
|
||||
if (byteCharacter == KissChar::Fend) {
|
||||
txBLE((byte)KissChar::Fesc);
|
||||
txBLE((byte)KissChar::Tfend);
|
||||
} else if (byteCharacter == KissChar::Fesc) {
|
||||
txBLE((byte)KissChar::Fesc);
|
||||
txBLE((byte)KissChar::Tfesc);
|
||||
} else {
|
||||
if (Config.bluetoothType == 2) {
|
||||
txBLE(byteCharacter);
|
||||
}
|
||||
} else {
|
||||
if (byteCharacter == KissChar::Fend) {
|
||||
txBLE((byte)KissChar::Fesc);
|
||||
txBLE((byte)KissChar::Tfend);
|
||||
} else if (byteCharacter == KissChar::Fesc) {
|
||||
txBLE((byte)KissChar::Fesc);
|
||||
txBLE((byte)KissChar::Tfesc);
|
||||
} else {
|
||||
txBLE(byteCharacter);
|
||||
}
|
||||
}
|
||||
}
|
||||
txBLE((byte)KissChar::Fend);
|
||||
if (Config.bluetoothType == 0) {
|
||||
txBLE((byte)KissChar::Fend);
|
||||
}
|
||||
}
|
||||
|
||||
void sendToPhone(const String& packet) {
|
||||
|
|
@ -138,7 +146,7 @@ namespace BLE_Utils {
|
|||
}
|
||||
if (Config.bluetoothType == 0) {
|
||||
txToPhoneOverBLE(AX25_Utils::LoRaPacketToAX25Frame(receivedPacketString));
|
||||
} else if (Config.bluetoothType == 3) {
|
||||
} else if (Config.bluetoothType == 2) {
|
||||
txToPhoneOverBLE(receivedPacketString);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,19 @@ uint8_t lowBatteryPercent = 21;
|
|||
namespace MENU_Utils {
|
||||
|
||||
String checkBTType() {
|
||||
if (Config.bluetoothType == 0) {
|
||||
return "BLE iPhone";
|
||||
} else {
|
||||
return "BT Android";
|
||||
switch (Config.bluetoothType) {
|
||||
case 0:
|
||||
return "BLE iPhone";
|
||||
break;
|
||||
case 1:
|
||||
return "BT Android";
|
||||
break;
|
||||
case 2:
|
||||
return "BLE Text";
|
||||
break;
|
||||
default:
|
||||
return "no BT";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ namespace MSG_Utils {
|
|||
if (lastReceivedPacket.sender!=currentBeacon->callsign) {
|
||||
|
||||
if (check25SegBuffer(lastReceivedPacket.sender, lastReceivedPacket.message)) {
|
||||
if (Config.bluetoothType == 0 || Config.bluetoothType == 3) { // agregar validador si cliente BLE esta conectado?
|
||||
if (Config.bluetoothType == 0 || Config.bluetoothType == 2) { // agregar validador si cliente BLE esta conectado?
|
||||
BLE_Utils::sendToPhone(packet.text.substring(3));
|
||||
} else {
|
||||
#ifdef HAS_BT_CLASSIC
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ namespace POWER_Utils {
|
|||
PMU.shutdown();
|
||||
#else
|
||||
|
||||
if (Config.bluetoothType == 0) {
|
||||
if (Config.bluetoothType == 0 || Config.bluetoothType == 2) {
|
||||
BLE_Utils::stop();
|
||||
} else {
|
||||
// turn off BT classic ???
|
||||
|
|
|
|||
Loading…
Reference in New Issue