testing Loading right
This commit is contained in:
parent
db9786fb60
commit
0d28a12458
|
|
@ -99,13 +99,29 @@
|
||||||
"stationBeep": false,
|
"stationBeep": false,
|
||||||
"lowBatteryBeep": false
|
"lowBatteryBeep": false
|
||||||
},
|
},
|
||||||
"lora": {
|
"lora": [
|
||||||
"frequency": 433775000,
|
{
|
||||||
"spreadingFactor": 12,
|
"frequency": 433775000,
|
||||||
"signalBandwidth": 125000,
|
"spreadingFactor": 12,
|
||||||
"codingRate4": 5,
|
"signalBandwidth": 125000,
|
||||||
"power": 20
|
"codingRate4": 5,
|
||||||
},
|
"power": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frequency": 434855000,
|
||||||
|
"spreadingFactor": 9,
|
||||||
|
"signalBandwidth": 125000,
|
||||||
|
"codingRate4": 7,
|
||||||
|
"power": 20
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"frequency": 439912500,
|
||||||
|
"spreadingFactor": 12,
|
||||||
|
"signalBandwidth": 125000,
|
||||||
|
"codingRate4": 5,
|
||||||
|
"power": 20
|
||||||
|
}
|
||||||
|
],
|
||||||
"pttTrigger": {
|
"pttTrigger": {
|
||||||
"active": false,
|
"active": false,
|
||||||
"io_pin": 4,
|
"io_pin": 4,
|
||||||
|
|
|
||||||
|
|
@ -39,95 +39,98 @@ ________________________________________________________________________________
|
||||||
#include "SPIFFS.h"
|
#include "SPIFFS.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
Configuration Config;
|
Configuration Config;
|
||||||
HardwareSerial neo6m_gps(1);
|
HardwareSerial neo6m_gps(1);
|
||||||
TinyGPSPlus gps;
|
TinyGPSPlus gps;
|
||||||
#if !defined(TTGO_T_Beam_S3_SUPREME_V3) && !defined(HELTEC_V3_GPS)
|
#if !defined(TTGO_T_Beam_S3_SUPREME_V3) && !defined(HELTEC_V3_GPS)
|
||||||
BluetoothSerial SerialBT;
|
BluetoothSerial SerialBT;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_BUTTON
|
#ifdef HAS_BUTTON
|
||||||
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
OneButton userButton = OneButton(BUTTON_PIN, true, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String versionDate = "2024.02.24";
|
String versionDate = "2024.02.24";
|
||||||
|
|
||||||
int myBeaconsIndex = 0;
|
int myBeaconsIndex = 0;
|
||||||
int myBeaconsSize = Config.beacons.size();
|
int myBeaconsSize = Config.beacons.size();
|
||||||
Beacon *currentBeacon = &Config.beacons[myBeaconsIndex];
|
Beacon *currentBeacon = &Config.beacons[myBeaconsIndex];
|
||||||
|
int loraIndex = 0;
|
||||||
|
int loraIndexSize = Config.loraTypes.size();
|
||||||
|
LoraType *currentLoRaType = &Config.loraTypes[loraIndex];
|
||||||
|
|
||||||
int menuDisplay = 100;
|
int menuDisplay = 100;
|
||||||
|
|
||||||
int messagesIterator = 0;
|
int messagesIterator = 0;
|
||||||
std::vector<String> loadedAPRSMessages;
|
std::vector<String> loadedAPRSMessages;
|
||||||
std::vector<String> loadedWLNKMails;
|
std::vector<String> loadedWLNKMails;
|
||||||
std::deque<String> outputBufferPackets;
|
std::deque<String> outputBufferPackets;
|
||||||
|
|
||||||
bool displayEcoMode = Config.display.ecoMode;
|
bool displayEcoMode = Config.display.ecoMode;
|
||||||
bool displayState = true;
|
bool displayState = true;
|
||||||
uint32_t displayTime = millis();
|
uint32_t displayTime = millis();
|
||||||
uint32_t refreshDisplayTime = millis();
|
uint32_t refreshDisplayTime = millis();
|
||||||
|
|
||||||
bool sendUpdate = true;
|
bool sendUpdate = true;
|
||||||
int updateCounter = Config.sendCommentAfterXBeacons;
|
int updateCounter = Config.sendCommentAfterXBeacons;
|
||||||
bool sendStandingUpdate = false;
|
bool sendStandingUpdate = false;
|
||||||
bool statusState = true;
|
bool statusState = true;
|
||||||
uint32_t statusTime = millis();
|
uint32_t statusTime = millis();
|
||||||
bool bluetoothConnected = false;
|
bool bluetoothConnected = false;
|
||||||
bool bluetoothActive = Config.bluetoothActive;
|
bool bluetoothActive = Config.bluetoothActive;
|
||||||
bool sendBleToLoRa = false;
|
bool sendBleToLoRa = false;
|
||||||
String BLEToLoRaPacket = "";
|
String BLEToLoRaPacket = "";
|
||||||
|
|
||||||
bool messageLed = false;
|
bool messageLed = false;
|
||||||
uint32_t messageLedTime = millis();
|
uint32_t messageLedTime = millis();
|
||||||
int lowBatteryPercent = 21;
|
int lowBatteryPercent = 21;
|
||||||
|
|
||||||
uint32_t lastTelemetryTx = millis();
|
uint32_t lastTelemetryTx = millis();
|
||||||
uint32_t telemetryTx = millis();
|
uint32_t telemetryTx = millis();
|
||||||
|
|
||||||
uint32_t lastTx = 0.0;
|
uint32_t lastTx = 0.0;
|
||||||
uint32_t txInterval = 60000L;
|
uint32_t txInterval = 60000L;
|
||||||
uint32_t lastTxTime = millis();
|
uint32_t lastTxTime = millis();
|
||||||
double lastTxLat = 0.0;
|
double lastTxLat = 0.0;
|
||||||
double lastTxLng = 0.0;
|
double lastTxLng = 0.0;
|
||||||
double lastTxDistance = 0.0;
|
double lastTxDistance = 0.0;
|
||||||
double currentHeading = 0;
|
double currentHeading = 0;
|
||||||
double previousHeading = 0;
|
double previousHeading = 0;
|
||||||
|
|
||||||
uint32_t menuTime = millis();
|
uint32_t menuTime = millis();
|
||||||
bool symbolAvailable = true;
|
bool symbolAvailable = true;
|
||||||
|
|
||||||
uint32_t bmeLastReading = -60000;
|
uint32_t bmeLastReading = -60000;
|
||||||
|
|
||||||
int screenBrightness = 1;
|
int screenBrightness = 1;
|
||||||
bool keyboardConnected = false;
|
bool keyboardConnected = false;
|
||||||
bool keyDetected = false;
|
bool keyDetected = false;
|
||||||
uint32_t keyboardTime = millis();
|
uint32_t keyboardTime = millis();
|
||||||
String messageCallsign = "";
|
String messageCallsign = "";
|
||||||
String messageText = "";
|
String messageText = "";
|
||||||
|
|
||||||
bool flashlight = false;
|
bool flashlight = false;
|
||||||
bool digirepeaterActive = false;
|
bool digirepeaterActive = false;
|
||||||
bool sosActive = false;
|
bool sosActive = false;
|
||||||
bool disableGPS;
|
bool disableGPS;
|
||||||
|
|
||||||
bool miceActive = false;
|
bool miceActive = false;
|
||||||
|
|
||||||
bool smartBeaconValue = true;
|
bool smartBeaconValue = true;
|
||||||
|
|
||||||
int ackNumberSend;
|
int ackNumberSend;
|
||||||
uint32_t ackTime = millis();
|
uint32_t ackTime = millis();
|
||||||
|
|
||||||
int winlinkStatus = 0;
|
int winlinkStatus = 0;
|
||||||
String winlinkMailNumber = "_?";
|
String winlinkMailNumber = "_?";
|
||||||
String winlinkAddressee = "";
|
String winlinkAddressee = "";
|
||||||
String winlinkSubject = "";
|
String winlinkSubject = "";
|
||||||
String winlinkBody = "";
|
String winlinkBody = "";
|
||||||
String winlinkAlias = "";
|
String winlinkAlias = "";
|
||||||
String winlinkAliasComplete = "";
|
String winlinkAliasComplete = "";
|
||||||
|
|
||||||
APRSPacket lastReceivedPacket;
|
APRSPacket lastReceivedPacket;
|
||||||
|
|
||||||
logging::Logger logger;
|
logging::Logger logger;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
@ -165,6 +168,7 @@ void setup() {
|
||||||
|
|
||||||
MSG_Utils::loadNumMessages();
|
MSG_Utils::loadNumMessages();
|
||||||
GPS_Utils::setup();
|
GPS_Utils::setup();
|
||||||
|
currentLoRaType = &Config.loraTypes[loraIndex];
|
||||||
LoRa_Utils::setup();
|
LoRa_Utils::setup();
|
||||||
BME_Utils::setup();
|
BME_Utils::setup();
|
||||||
STATION_Utils::loadCallsignIndex();
|
STATION_Utils::loadCallsignIndex();
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,17 @@ void Configuration::readFile(fs::FS &fs, const char *fileName) {
|
||||||
notification.stationBeep = data["notification"]["stationBeep"].as<bool>();
|
notification.stationBeep = data["notification"]["stationBeep"].as<bool>();
|
||||||
notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as<bool>();
|
notification.lowBatteryBeep = data["notification"]["lowBatteryBeep"].as<bool>();
|
||||||
|
|
||||||
loramodule.frequency = data["lora"]["frequency"].as<long>();
|
JsonArray LoraTypesArray = data["lora"];
|
||||||
loramodule.spreadingFactor = data["lora"]["spreadingFactor"].as<int>();
|
for (int j = 0; j < LoraTypesArray.size(); j++) {
|
||||||
loramodule.signalBandwidth = data["lora"]["signalBandwidth"].as<long>();
|
LoraType loraType;
|
||||||
loramodule.codingRate4 = data["lora"]["codingRate4"].as<int>();
|
|
||||||
loramodule.power = data["lora"]["power"].as<int>();
|
loraType.frequency = LoraTypesArray[j]["frequency"].as<long>();
|
||||||
|
loraType.spreadingFactor = LoraTypesArray[j]["spreadingFactor"].as<int>();
|
||||||
|
loraType.signalBandwidth = LoraTypesArray[j]["signalBandwidth"].as<long>();
|
||||||
|
loraType.codingRate4 = LoraTypesArray[j]["codingRate4"].as<int>();
|
||||||
|
loraType.power = LoraTypesArray[j]["power"].as<int>();
|
||||||
|
loraTypes.push_back(loraType);
|
||||||
|
}
|
||||||
|
|
||||||
ptt.active = data["pttTrigger"]["active"].as<bool>();
|
ptt.active = data["pttTrigger"]["active"].as<bool>();
|
||||||
ptt.io_pin = data["pttTrigger"]["io_pin"].as<int>();
|
ptt.io_pin = data["pttTrigger"]["io_pin"].as<int>();
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public:
|
||||||
bool lowBatteryBeep;
|
bool lowBatteryBeep;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LoraModule {
|
class LoraType {
|
||||||
public:
|
public:
|
||||||
long frequency;
|
long frequency;
|
||||||
int spreadingFactor;
|
int spreadingFactor;
|
||||||
|
|
@ -82,13 +82,13 @@ public:
|
||||||
class Configuration {
|
class Configuration {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::vector<Beacon> beacons;
|
std::vector<Beacon> beacons;
|
||||||
Display display;
|
Display display;
|
||||||
Winlink winlink;
|
Winlink winlink;
|
||||||
BME bme;
|
BME bme;
|
||||||
Notification notification;
|
Notification notification;
|
||||||
LoraModule loramodule;
|
std::vector<LoraType> loraTypes;
|
||||||
Ptt ptt;
|
Ptt ptt;
|
||||||
|
|
||||||
bool simplifiedTrackerMode;
|
bool simplifiedTrackerMode;
|
||||||
int sendCommentAfterXBeacons;
|
int sendCommentAfterXBeacons;
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ extern logging::Logger logger;
|
||||||
extern bool sendUpdate;
|
extern bool sendUpdate;
|
||||||
extern int menuDisplay;
|
extern int menuDisplay;
|
||||||
extern uint32_t menuTime;
|
extern uint32_t menuTime;
|
||||||
extern int myBeaconsSize;
|
|
||||||
extern int myBeaconsIndex;
|
extern int myBeaconsIndex;
|
||||||
|
extern int myBeaconsSize;
|
||||||
extern bool keyboardConnected;
|
extern bool keyboardConnected;
|
||||||
extern bool keyDetected;
|
extern bool keyDetected;
|
||||||
extern uint32_t keyboardTime;
|
extern uint32_t keyboardTime;
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@
|
||||||
#include "msg_utils.h"
|
#include "msg_utils.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
extern logging::Logger logger;
|
extern logging::Logger logger;
|
||||||
extern Configuration Config;
|
extern Configuration Config;
|
||||||
|
extern LoraType *currentLoRaType;
|
||||||
|
|
||||||
|
|
||||||
#if defined(TTGO_T_Beam_V1_0_SX1268) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(OE5HWN_MeshCom)
|
#if defined(TTGO_T_Beam_V1_0_SX1268) || defined(ESP32_DIY_1W_LoRa_GPS) || defined(OE5HWN_MeshCom)
|
||||||
SX1268 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
SX1268 radio = new Module(RADIO_CS_PIN, RADIO_DIO1_PIN, RADIO_RST_PIN, RADIO_BUSY_PIN);
|
||||||
|
|
@ -68,7 +70,8 @@ namespace LoRa_Utils {
|
||||||
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
|
||||||
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
|
LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
|
||||||
|
|
||||||
long freq = Config.loramodule.frequency;
|
//long freq = Config.loramodule.frequency;
|
||||||
|
long freq = currentLoRaType->frequency;
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Frequency: %d", freq);
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "Frequency: %d", freq);
|
||||||
if (!LoRa.begin(freq)) {
|
if (!LoRa.begin(freq)) {
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "LoRa", "Starting LoRa failed!");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_ERROR, "LoRa", "Starting LoRa failed!");
|
||||||
|
|
@ -77,11 +80,15 @@ namespace LoRa_Utils {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LoRa.setSpreadingFactor(Config.loramodule.spreadingFactor);
|
//LoRa.setSpreadingFactor(Config.loramodule.spreadingFactor);
|
||||||
LoRa.setSignalBandwidth(Config.loramodule.signalBandwidth);
|
LoRa.setSpreadingFactor(currentLoRaType->spreadingFactor);
|
||||||
LoRa.setCodingRate4(Config.loramodule.codingRate4);
|
//LoRa.setSignalBandwidth(Config.loramodule.signalBandwidth);
|
||||||
|
LoRa.setSignalBandwidth(currentLoRaType->signalBandwidth);
|
||||||
|
//LoRa.setCodingRate4(Config.loramodule.codingRate4);
|
||||||
|
LoRa.setCodingRate4(currentLoRaType->codingRate4);
|
||||||
LoRa.enableCrc();
|
LoRa.enableCrc();
|
||||||
LoRa.setTxPower(Config.loramodule.power);
|
//LoRa.setTxPower(Config.loramodule.power);
|
||||||
|
LoRa.setTxPower(currentLoRaType->power);
|
||||||
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "LoRa init done!");
|
logger.log(logging::LoggerLevel::LOGGER_LEVEL_INFO, "LoRa", "LoRa init done!");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue