mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-04-04 22:18:58 +00:00
big update:
- display update - timer changed to ms - allow connections just when connected
This commit is contained in:
parent
c96a0310ae
commit
2c78a002ab
19 changed files with 332 additions and 351 deletions
|
|
@ -34,9 +34,6 @@ void setup() {
|
|||
logPrintlnW("LoRa APRS iGate by OE5BPA (Peter Buchegger)");
|
||||
logPrintlnW("Version: " VERSION);
|
||||
|
||||
ProjectConfigurationManagement confmg;
|
||||
std::shared_ptr<Configuration> userConfig = confmg.readConfiguration();
|
||||
|
||||
std::list<std::shared_ptr<BoardConfig>> boardConfigs;
|
||||
// clang-format off
|
||||
boardConfigs.push_back(std::shared_ptr<BoardConfig>(new BoardConfig("TTGO_LORA32_V1", eTTGO_LORA32_V1, 4, 15, 0x3C, 0, 5, 19, 27, 18, 14, 26)));
|
||||
|
|
@ -49,8 +46,10 @@ void setup() {
|
|||
boardConfigs.push_back(std::shared_ptr<BoardConfig>(new BoardConfig("HELTEC_WIFI_LORA_32_V2", eHELTEC_WIFI_LORA_32_V2, 4, 15, 0x3C, 16, 5, 19, 27, 18, 14, 26)));
|
||||
// clang-format on
|
||||
|
||||
BoardFinder finder(boardConfigs);
|
||||
std::shared_ptr<BoardConfig> boardConfig = finder.getBoardConfig(userConfig->board);
|
||||
ProjectConfigurationManagement confmg;
|
||||
std::shared_ptr<Configuration> userConfig = confmg.readConfiguration();
|
||||
BoardFinder finder(boardConfigs);
|
||||
std::shared_ptr<BoardConfig> boardConfig = finder.getBoardConfig(userConfig->board);
|
||||
if (boardConfig == 0) {
|
||||
boardConfig = finder.searchBoardConfig();
|
||||
if (boardConfig == 0) {
|
||||
|
|
@ -80,9 +79,7 @@ void setup() {
|
|||
powerManagement->deactivateGPS();
|
||||
}
|
||||
|
||||
load_config(boardConfig);
|
||||
LoRaSystem = std::shared_ptr<System>(new System(boardConfig, userConfig));
|
||||
|
||||
LoRaSystem->getTaskManager().addTask(std::shared_ptr<Task>(new DisplayTask()));
|
||||
LoRaSystem->getTaskManager().addTask(std::shared_ptr<Task>(new LoraTask()));
|
||||
if (boardConfig->Type == eETH_BOARD) {
|
||||
|
|
@ -101,6 +98,13 @@ void setup() {
|
|||
|
||||
LoRaSystem->getDisplay().showSpashScreen("LoRa APRS iGate", VERSION);
|
||||
|
||||
if (userConfig->callsign == "NOCALL-10") {
|
||||
logPrintlnE("You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
LoRaSystem->getDisplay().showStatusScreen("ERROR", "You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
while (true)
|
||||
;
|
||||
}
|
||||
|
||||
if (userConfig->display.overwritePin != 0) {
|
||||
pinMode(userConfig->display.overwritePin, INPUT);
|
||||
pinMode(userConfig->display.overwritePin, INPUT_PULLUP);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ AprsIsTask::~AprsIsTask() {
|
|||
}
|
||||
|
||||
bool AprsIsTask::setup(std::shared_ptr<System> system) {
|
||||
_beacon_timer.setTimeout(minutesToTime_t(system->getUserConfig()->beacon.timeout));
|
||||
_beacon_timer.setTimeout(system->getUserConfig()->beacon.timeout * 60 * 1000);
|
||||
_aprs_is = std::shared_ptr<APRS_IS>(new APRS_IS(system->getUserConfig()->callsign, system->getUserConfig()->aprs_is.passcode, "ESP32-APRS-IS", "0.2"));
|
||||
|
||||
_beaconMsg = std::shared_ptr<APRSMessage>(new APRSMessage());
|
||||
|
|
@ -29,6 +29,9 @@ bool AprsIsTask::setup(std::shared_ptr<System> system) {
|
|||
}
|
||||
|
||||
bool AprsIsTask::loop(std::shared_ptr<System> system) {
|
||||
if (!system->isWifiEthConnected()) {
|
||||
return false;
|
||||
}
|
||||
if (!_aprs_is->connected()) {
|
||||
if (!connect(system)) {
|
||||
_stateInfo = "not connected";
|
||||
|
|
@ -54,8 +57,8 @@ bool AprsIsTask::loop(std::shared_ptr<System> system) {
|
|||
system->getDisplay().addFrame(std::shared_ptr<DisplayFrame>(new TextFrame("BEACON", _beaconMsg->toString())));
|
||||
_beacon_timer.start();
|
||||
}
|
||||
time_t diff = _beacon_timer.getTriggerTime() - now();
|
||||
_stateInfo = "beacon " + String(minute(diff)) + ":" + String(second(diff));
|
||||
time_t diff = _beacon_timer.getTriggerTimeInSec();
|
||||
_stateInfo = "beacon " + String(diff / 60) + ":" + String(diff % 60);
|
||||
_state = Okay;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ bool DisplayTask::setup(std::shared_ptr<System> system) {
|
|||
system->getDisplay().setStatusFrame(statusFrame);
|
||||
if (!system->getUserConfig()->display.alwaysOn) {
|
||||
system->getDisplay().activateDisplaySaveMode();
|
||||
system->getDisplay().setDisplayTimeout(system->getUserConfig()->display.timeout);
|
||||
system->getDisplay().setDisplaySaveTimeout(system->getUserConfig()->display.timeout);
|
||||
}
|
||||
_stateInfo = system->getUserConfig()->callsign;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -75,10 +75,12 @@ bool EthTask::setup(std::shared_ptr<System> system) {
|
|||
|
||||
bool EthTask::loop(std::shared_ptr<System> system) {
|
||||
if (!eth_connected) {
|
||||
system->connectedViaWifiEth(false);
|
||||
_stateInfo = "Ethernet not connected";
|
||||
_state = Error;
|
||||
return false;
|
||||
}
|
||||
system->connectedViaWifiEth(true);
|
||||
_stateInfo = ETH.localIP().toString();
|
||||
_state = Okay;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ bool NTPTask::setup(std::shared_ptr<System> system) {
|
|||
}
|
||||
|
||||
bool NTPTask::loop(std::shared_ptr<System> system) {
|
||||
if (!system->isWifiEthConnected()) {
|
||||
return false;
|
||||
}
|
||||
if (!_beginCalled) {
|
||||
_ntpClient->begin();
|
||||
_beginCalled = true;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ bool WifiTask::setup(std::shared_ptr<System> system) {
|
|||
bool WifiTask::loop(std::shared_ptr<System> system) {
|
||||
const uint8_t wifi_status = _wiFiMulti->run();
|
||||
if (wifi_status != WL_CONNECTED) {
|
||||
system->connectedViaWifiEth(false);
|
||||
logPrintlnE("WiFi not connected!");
|
||||
_oldWifiStatus = wifi_status;
|
||||
_stateInfo = "WiFi not connected";
|
||||
|
|
@ -38,6 +39,7 @@ bool WifiTask::loop(std::shared_ptr<System> system) {
|
|||
_oldWifiStatus = wifi_status;
|
||||
return false;
|
||||
}
|
||||
system->connectedViaWifiEth(true);
|
||||
_stateInfo = WiFi.localIP().toString();
|
||||
_state = Okay;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -97,21 +97,3 @@ void ProjectConfigurationManagement::writeProjectConfiguration(std::shared_ptr<C
|
|||
|
||||
data["board"] = conf->board;
|
||||
}
|
||||
|
||||
std::shared_ptr<Configuration> load_config(std::shared_ptr<BoardConfig> boardConfig) {
|
||||
ProjectConfigurationManagement confmg;
|
||||
std::shared_ptr<Configuration> config = confmg.readConfiguration();
|
||||
if (config->callsign == "NOCALL-10") {
|
||||
logPrintlnE("You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
// show_display("ERROR", "You have to change your settings in 'data/is-cfg.json' and upload it via \"Upload File System image\"!");
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
||||
/*if(KEY_BUILTIN != 0 && Config->display.overwritePin == 0)
|
||||
{
|
||||
Config->display.overwritePin = KEY_BUILTIN;
|
||||
}*/
|
||||
logPrintlnI("Configuration loaded!");
|
||||
return config;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue