BLE Names and no WX module no Wx Tx fix
This commit is contained in:
parent
a0b9eb14d7
commit
98557c3883
|
|
@ -530,8 +530,8 @@
|
||||||
<div class="col-6 mt-1">
|
<div class="col-6 mt-1">
|
||||||
<label for="bluetooth.type" class="form-label">Bluetooth Type</label>
|
<label for="bluetooth.type" class="form-label">Bluetooth Type</label>
|
||||||
<select name="bluetooth.type" id="bluetooth.type" class="form-control">
|
<select name="bluetooth.type" id="bluetooth.type" class="form-control">
|
||||||
<option value="0">BT Classic</option>
|
<option value="0">BLE for iPhone</option>
|
||||||
<option value="1">BLE for iPhone</option>
|
<option value="1">BT Classic</option>
|
||||||
<option value="2">BLE for Android</option>
|
<option value="2">BLE for Android</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ BLECharacteristic *pCharacteristicTx;
|
||||||
BLECharacteristic *pCharacteristicRx;
|
BLECharacteristic *pCharacteristicRx;
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
|
extern Beacon *currentBeacon;
|
||||||
extern logging::Logger logger;
|
extern logging::Logger logger;
|
||||||
extern bool sendBleToLoRa;
|
extern bool sendBleToLoRa;
|
||||||
extern bool bluetoothConnected;
|
extern bool bluetoothConnected;
|
||||||
|
|
@ -69,10 +70,9 @@ namespace BLE_Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
uint8_t dmac[6];
|
String id = currentBeacon->callsign;
|
||||||
esp_efuse_mac_get_default(dmac);
|
String BLEid = id.substring(0, id.indexOf("-")) + "-BLE";
|
||||||
std::string BLEid = "LoRa Tracker " + std::to_string(dmac[4]) + std::to_string(dmac[5]);
|
BLEDevice::init(BLEid.c_str());
|
||||||
BLEDevice::init(BLEid);
|
|
||||||
pServer = BLEDevice::createServer();
|
pServer = BLEDevice::createServer();
|
||||||
pServer->setCallbacks(new MyServerCallbacks());
|
pServer->setCallbacks(new MyServerCallbacks());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
|
extern Beacon *currentBeacon;
|
||||||
extern BluetoothSerial SerialBT;
|
extern BluetoothSerial SerialBT;
|
||||||
extern logging::Logger logger;
|
extern logging::Logger logger;
|
||||||
extern TinyGPSPlus gps;
|
extern TinyGPSPlus gps;
|
||||||
|
|
@ -35,12 +36,10 @@ namespace BLUETOOTH_Utils {
|
||||||
SerialBT.register_callback(BLUETOOTH_Utils::bluetoothCallback);
|
SerialBT.register_callback(BLUETOOTH_Utils::bluetoothCallback);
|
||||||
SerialBT.onData(BLUETOOTH_Utils::getData); // callback instead of while to avoid RX buffer limit when NMEA data received
|
SerialBT.onData(BLUETOOTH_Utils::getData); // callback instead of while to avoid RX buffer limit when NMEA data received
|
||||||
|
|
||||||
uint8_t dmac[6];
|
String id = currentBeacon->callsign;
|
||||||
esp_efuse_mac_get_default(dmac);
|
String BTid = id.substring(0, id.indexOf("-")) + "-BT";
|
||||||
char ourId[5];
|
|
||||||
snprintf(ourId, sizeof(ourId), "%02x%02x", dmac[4], dmac[5]);
|
|
||||||
|
|
||||||
if (!SerialBT.begin(String("LoRa Tracker " + String(ourId)))) {
|
if (!SerialBT.begin(String(BTid))) {
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Bluetooth", "Starting Bluetooth failed!");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "Bluetooth", "Starting Bluetooth failed!");
|
||||||
displayShow("ERROR", "Starting Bluetooth failed!", "");
|
displayShow("ERROR", "Starting Bluetooth failed!", "");
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ float newHum, newTemp, newPress, newGas;
|
||||||
uint32_t bmeLastReading = -60000;
|
uint32_t bmeLastReading = -60000;
|
||||||
int wxModuleType = 0;
|
int wxModuleType = 0;
|
||||||
uint8_t wxModuleAddress = 0x00;
|
uint8_t wxModuleAddress = 0x00;
|
||||||
|
bool wxModuleFound = false;
|
||||||
|
|
||||||
|
|
||||||
Adafruit_BME280 bme280;
|
Adafruit_BME280 bme280;
|
||||||
|
|
@ -54,7 +55,6 @@ namespace BME_Utils {
|
||||||
if (Config.bme.active) {
|
if (Config.bme.active) {
|
||||||
getWxModuleAddres();
|
getWxModuleAddres();
|
||||||
if (wxModuleAddress != 0x00) {
|
if (wxModuleAddress != 0x00) {
|
||||||
bool wxModuleFound = false;
|
|
||||||
#ifdef HELTEC_V3_GPS
|
#ifdef HELTEC_V3_GPS
|
||||||
if (bme280.begin(wxModuleAddress, &Wire1)) {
|
if (bme280.begin(wxModuleAddress, &Wire1)) {
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BME", " BME280 sensor found");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "BME", " BME280 sensor found");
|
||||||
|
|
@ -245,7 +245,7 @@ namespace BME_Utils {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
wx = " - C - % - hPa";
|
wx = " - C - % - hPa";
|
||||||
} else {
|
} else {
|
||||||
wx = ".../...g...t...r...p...P...h..b.....";
|
wx = ".../...g...t...";
|
||||||
}
|
}
|
||||||
return wx;
|
return wx;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -275,7 +275,7 @@ namespace BME_Utils {
|
||||||
} else {
|
} else {
|
||||||
wx = ".../...g...t";
|
wx = ".../...g...t";
|
||||||
wx += tempStr;
|
wx += tempStr;
|
||||||
wx += "r...p...P...h";
|
wx += "h";
|
||||||
wx += humStr;
|
wx += humStr;
|
||||||
wx += "b";
|
wx += "b";
|
||||||
wx += presStr;
|
wx += presStr;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ extern bool smartBeaconActive;
|
||||||
extern bool winlinkCommentState;
|
extern bool winlinkCommentState;
|
||||||
|
|
||||||
extern int wxModuleType;
|
extern int wxModuleType;
|
||||||
|
extern bool wxModuleFound;
|
||||||
extern bool gpsIsActive;
|
extern bool gpsIsActive;
|
||||||
extern bool gpsShouldSleep;
|
extern bool gpsShouldSleep;
|
||||||
|
|
||||||
|
|
@ -210,12 +211,12 @@ namespace STATION_Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
String packet;
|
String packet;
|
||||||
if (Config.bme.sendTelemetry && type == 1) { // WX
|
if (Config.bme.sendTelemetry && wxModuleFound && type == 1) { // WX
|
||||||
packet = APRSPacketLib::generateGPSBeaconPacket(currentBeacon->callsign, "APLRT1", Config.path, "/", APRSPacketLib::encodeGPS(gps.location.lat(),gps.location.lng(), gps.course.deg(), 0.0, currentBeacon->symbol, Config.sendAltitude, gps.altitude.feet(), sendStandingUpdate, "Wx"));
|
packet = APRSPacketLib::generateGPSBeaconPacket(currentBeacon->callsign, "APLRT1", Config.path, "/", APRSPacketLib::encodeGPS(gps.location.lat(),gps.location.lng(), gps.course.deg(), 0.0, currentBeacon->symbol, Config.sendAltitude, gps.altitude.feet(), sendStandingUpdate, "Wx"));
|
||||||
if (wxModuleType != 0) {
|
if (wxModuleType != 0) {
|
||||||
packet += BME_Utils::readDataSensor(0);
|
packet += BME_Utils::readDataSensor(0);
|
||||||
} else {
|
} else {
|
||||||
packet += ".../...g...t...r...p...P...h..b.....";
|
packet += ".../...g...t...";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String path = Config.path;
|
String path = Config.path;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue