From 00603fe2c38e5364c06999b822fee79b1a4849e3 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 19 Mar 2022 22:36:33 +0100 Subject: [PATCH] fixing router task --- src/TaskRouter.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/TaskRouter.cpp b/src/TaskRouter.cpp index 2ab3cd5..25cf38d 100644 --- a/src/TaskRouter.cpp +++ b/src/TaskRouter.cpp @@ -16,7 +16,6 @@ RouterTask::~RouterTask() { } bool RouterTask::setup(System &system) { - // setup beacon _beacon_timer.setTimeout(system.getUserConfig()->beacon.timeout * 60 * 1000); _beaconMsg = std::shared_ptr(new APRSMessage()); @@ -30,7 +29,6 @@ bool RouterTask::setup(System &system) { } bool RouterTask::loop(System &system) { - // do routing if (!_fromModem.empty()) { std::shared_ptr modemMsg = _fromModem.getElement(); @@ -49,18 +47,19 @@ bool RouterTask::loop(System &system) { aprsIsMsg->setPath(path + "qAO," + system.getUserConfig()->callsign); - logPrintD("APRS-IS: "); - logPrintlnD(aprsIsMsg->toString()); + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "APRS-IS: %s", aprsIsMsg->toString()); _toAprsIs.addElement(aprsIsMsg); } else { - logPrintlnD("APRS-IS: no forward => RFonly"); + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "APRS-IS: no forward => RFonly"); } } else { - if (!system.getUserConfig()->aprs_is.active) - logPrintlnD("APRS-IS: disabled"); + if (!system.getUserConfig()->aprs_is.active) { + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "APRS-IS: disabled"); + } - if (modemMsg->getSource() == system.getUserConfig()->callsign) - logPrintlnD("APRS-IS: no forward => own packet received"); + if (modemMsg->getSource() == system.getUserConfig()->callsign) { + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "APRS-IS: no forward => own packet received"); + } } if (system.getUserConfig()->digi.active && modemMsg->getSource() != system.getUserConfig()->callsign) { @@ -72,8 +71,7 @@ bool RouterTask::loop(System &system) { // fixme digiMsg->setPath(system.getUserConfig()->callsign + "*"); - logPrintD("DIGI: "); - logPrintlnD(digiMsg->toString()); + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "DIGI: %s", digiMsg->toString()); _toModem.addElement(digiMsg); } @@ -82,8 +80,7 @@ bool RouterTask::loop(System &system) { // check for beacon if (_beacon_timer.check()) { - logPrintD("[" + timeString() + "] "); - logPrintlnD(_beaconMsg->encode()); + system.getLogger().log(logging::LoggerLevel::LOGGER_LEVEL_INFO, getName(), "[%s] %s", timeString(), _beaconMsg->encode()); if (system.getUserConfig()->aprs_is.active) _toAprsIs.addElement(_beaconMsg); @@ -93,7 +90,6 @@ bool RouterTask::loop(System &system) { } system.getDisplay().addFrame(std::shared_ptr(new TextFrame("BEACON", _beaconMsg->toString()))); - _beacon_timer.start(); }