update BME info on-screen

This commit is contained in:
richonguzman 2023-06-19 00:52:40 -04:00
parent 257118c597
commit 06c74b636b
6 changed files with 41 additions and 20 deletions

View File

@ -29,8 +29,8 @@
},
"lora": {
"iGateFreq": 433775000,
"digirepeaterTxFreq": 433900000,
"digirepeaterRxFreq": 433775000,
"digirepeaterTxFreq": 433775000,
"digirepeaterRxFreq": 433900000,
"spreadingFactor": 12,
"signalBandwidth": 125000,
"codingRate4": 5,

View File

@ -72,7 +72,7 @@ void loop() {
} else if (stationMode==3 || stationMode==4) { // DigiRepeater (3 RxFreq=TxFreq / 4 RxFreq!=TxFreq)
Utils::checkDisplayInterval();
Utils::checkBeaconInterval();
show_display(firstLine, secondLine, thirdLine, fourthLine, 0);
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
DIGI_Utils::processPacket(LoRa_Utils::receivePacket());
}
}

View File

@ -3,7 +3,8 @@
#include "gps_utils.h"
#include "display.h"
extern Configuration Config;
extern Configuration Config;
extern String fifthLine;
namespace BME_Utils {
@ -94,17 +95,20 @@ String readDataSensor() {
float newTemp = bme.readTemperature();
float newHum = bme.readHumidity();
float newPress = (bme.readPressure() / 100.0F);
//float bat = analogRead(battery);
//bme.readAltitude(SEALEVELPRESSURE_HPA)
if (isnan(newTemp) || isnan(newHum) || isnan(newPress)) {
Serial.println("BME280 Module data failed");
wx = ".../...g...t...r...p...P...h..b.....";
fifthLine = "";
return wx;
} else {
tempStr = generateTempString((newTemp * 1.8) + 32);
humStr = generateHumString(newHum);
presStr = generatePresString(newPress);
fifthLine = "BME-> " + String(int(newTemp))+"C " + humStr + "% " + presStr.substring(0,4) + "hPa";
wx = ".../...g...t" + tempStr + "r...p...P...h" + humStr + "b" + presStr;
return wx;
}

View File

@ -1,4 +1,5 @@
#include "configuration.h"
#include "station_utils.h"
#include "lora_utils.h"
#include "digi_utils.h"
#include "display.h"
@ -16,8 +17,10 @@ void processPacket(String packet) {
Serial.print("Received Lora Packet : " + String(packet));
if ((packet.substring(0, 3) == "\x3c\xff\x01") && (packet.indexOf("NOGATE") == -1)) {
Serial.println(" ---> APRS LoRa Packet");
String sender = packet.substring(3,packet.indexOf(">"));
STATION_Utils::updateLastHeard(sender);
Utils::typeOfPacket(packet, "Digi");
if ((stationMode==3) && (packet.indexOf("WIDE1-1") > 10)) {
Utils::typeOfPacket(packet, "Digi");
loraPacket = packet.substring(3);
loraPacket.replace("WIDE1-1", Config.callsign + "*");
delay(500);
@ -25,7 +28,6 @@ void processPacket(String packet) {
display_toggle(true);
lastScreenOn = millis();
} else if (stationMode ==4){
Utils::typeOfPacket(packet, "Digi");
if (packet.indexOf("WIDE1-1") == -1) {
loraPacket = packet.substring(3,packet.indexOf(":")) + "," + Config.callsign + "*" + packet.substring(packet.indexOf(":"));
} else {

View File

@ -65,18 +65,23 @@ void setupDiplay() {
setup_display();
digitalWrite(greenLed,HIGH);
Serial.println("\nStarting iGate: " + Config.callsign + " Version: " + versionDate);
show_display(" LoRa APRS", " ( iGate )", "", " Richonguzman", " -- CD2RXU --", "", " " + versionDate, 4000);
show_display(" LoRa APRS", " ( iGate )", "", " Richonguzman", " -- CD2RXU --", "", " " + versionDate, 4000);
digitalWrite(greenLed,LOW);
firstLine = Config.callsign;
if (stationMode==3 || stationMode==4) {
secondLine = "<DigiRepeater Active>";
} else {
secondLine = "";
thirdLine = "<< DigiRepeater >>";
}
sixthLine = "";
seventhLine = " listening...";
}
void activeStations() {
fourthLine = "Stations (" + String(Config.rememberStationTime) + "min) = ";
if (lastHeardStation.size() < 10) {
fourthLine += " ";
}
fourthLine += String(lastHeardStation.size());
}
void checkBeaconInterval() {
uint32_t lastTx = millis() - lastBeaconTx;
if (lastTx >= Config.beaconInterval*60*1000) {
@ -85,15 +90,13 @@ void checkBeaconInterval() {
if (beacon_update) {
display_toggle(true);
Serial.println("---- Sending iGate Beacon ----");
STATION_Utils::deleteNotHeard();
activeStations();
if (stationMode==1 || stationMode==2) {
thirdLine = getLocalIP();
STATION_Utils::deleteNotHeard();
fourthLine = "Stations (" + String(Config.rememberStationTime) + "min) = ";
if (lastHeardStation.size() < 10) {
fourthLine += " ";
if (!Config.bme.active) {
fifthLine = "";
}
fourthLine += String(lastHeardStation.size());
fifthLine = "";
sixthLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 1000);
seventhLine = " listening...";
@ -104,7 +107,14 @@ void checkBeaconInterval() {
}
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, seventhLine, 0);
} else if (stationMode==3 || stationMode==4) {
fourthLine = "";
String Rx = String(Config.loramodule.digirepeaterRxFreq);
String Tx = String(Config.loramodule.digirepeaterTxFreq);
if (stationMode==3) {
secondLine = "Rx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
} else {
secondLine = "Rx:" + String(Rx.substring(0,3)) + "." + String(Rx.substring(3,6));
}
secondLine += " Tx:" + String(Tx.substring(0,3)) + "." + String(Tx.substring(3,6));
fifthLine = "";
sixthLine = "";
show_display(firstLine, secondLine, thirdLine, fourthLine, fifthLine, sixthLine, "SENDING iGate BEACON", 0);
@ -112,7 +122,11 @@ void checkBeaconInterval() {
if (stationMode == 4) {
LoRa_Utils::changeFreqTx();
}
LoRa_Utils::sendNewPacket("APRS",iGateBeaconPacket);
if (Config.bme.active) {
LoRa_Utils::sendNewPacket("APRS",iGateBeaconPacket.substring(0,iGateBeaconPacket.indexOf(":=")+20) + "_" + BME_Utils::readDataSensor() + iGateBeaconPacket.substring(iGateBeaconPacket.indexOf(":=")+21) + " + WX");
} else {
LoRa_Utils::sendNewPacket("APRS",iGateBeaconPacket);
}
if (stationMode == 4) {
LoRa_Utils::changeFreqRx();
}
@ -156,7 +170,7 @@ void typeOfPacket(String packet, String packetType) {
}
sender = packet.substring(0,packet.indexOf(">"));
} else {
sixthLine = "LoRa Rx ----> LoRa Tx";
fifthLine = "LoRa Rx ----> LoRa Tx";
sender = packet.substring(3,packet.indexOf(">"));
}
for (int i=sender.length();i<9;i++) {

View File

@ -8,6 +8,7 @@ namespace Utils {
void processStatus();
String getLocalIP();
void setupDiplay();
void activeStations();
void checkBeaconInterval();
void checkDisplayInterval();
void validateDigiFreqs();