From 1bda1299478d1b0a72ea9db7224ca676be0e7005 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Thu, 20 Apr 2023 17:46:56 +0200 Subject: [PATCH] send messages which are coming from aprs is --- src/LoRa_APRS_iGate.cpp | 2 +- src/TaskAprsIs.cpp | 7 +++++-- src/TaskAprsIs.h | 3 ++- src/TaskRadiolib.cpp | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 440949a..5f3f863 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -45,7 +45,7 @@ OTATask otaTask; NTPTask ntpTask; FTPTask ftpTask; MQTTTask mqttTask(toMQTT); -AprsIsTask aprsIsTask(toAprsIs); +AprsIsTask aprsIsTask(toAprsIs, toModem); RouterTask routerTask(fromModem, toModem, toAprsIs, toMQTT); BeaconTask beaconTask(toModem, toAprsIs); diff --git a/src/TaskAprsIs.cpp b/src/TaskAprsIs.cpp index 3fa3da6..b8fccf5 100644 --- a/src/TaskAprsIs.cpp +++ b/src/TaskAprsIs.cpp @@ -4,7 +4,7 @@ #include "TaskAprsIs.h" #include "project_configuration.h" -AprsIsTask::AprsIsTask(TaskQueue> &toAprsIs) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs) { +AprsIsTask::AprsIsTask(TaskQueue> &toAprsIs, TaskQueue> &toModem) : Task(TASK_APRS_IS, TaskAprsIs), _toAprsIs(toAprsIs), _toModem(toModem) { } AprsIsTask::~AprsIsTask() { @@ -30,7 +30,10 @@ bool AprsIsTask::loop(System &system) { return false; } - _aprs_is.getAPRSMessage(); + std::shared_ptr msg = _aprs_is.getAPRSMessage(); + if (msg) { + _toModem.addElement(msg); + } if (!_toAprsIs.empty()) { std::shared_ptr msg = _toAprsIs.getElement(); diff --git a/src/TaskAprsIs.h b/src/TaskAprsIs.h index 30679db..d2de355 100644 --- a/src/TaskAprsIs.h +++ b/src/TaskAprsIs.h @@ -8,7 +8,7 @@ class AprsIsTask : public Task { public: - explicit AprsIsTask(TaskQueue> &toAprsIs); + explicit AprsIsTask(TaskQueue> &toAprsIs, TaskQueue> &toModem); virtual ~AprsIsTask(); virtual bool setup(System &system) override; @@ -18,6 +18,7 @@ private: APRS_IS _aprs_is; TaskQueue> &_toAprsIs; + TaskQueue> &_toModem; bool connect(System &system); }; diff --git a/src/TaskRadiolib.cpp b/src/TaskRadiolib.cpp index 71b6795..7ddf9fc 100644 --- a/src/TaskRadiolib.cpp +++ b/src/TaskRadiolib.cpp @@ -164,6 +164,7 @@ bool RadiolibTask::loop(System &system) { } else { if (!txEnable) { // system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] TX is not enabled", timeString().c_str()); + _toModem.getElement(); // empty list, otherwise memory will get full. } else { if (transmitFlag) { // system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_DEBUG, getName(), "[%s] TX signal detected. Waiting TX", timeString().c_str());