From 7a09f947679c8e60fa4fb415afd26fe5b74d2ebb Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sun, 18 Feb 2024 21:08:14 +0100 Subject: [PATCH] added config related parts --- gui/src/components/settings_chat.vue | 19 +++++++++++++++++-- gui/src/store/settingsStore.js | 3 +++ modem/config.py | 4 ++++ modem/frame_handler_beacon.py | 5 +++-- modem/frame_handler_cq.py | 7 +++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/gui/src/components/settings_chat.vue b/gui/src/components/settings_chat.vue index 02a5d726..596132d6 100644 --- a/gui/src/components/settings_chat.vue +++ b/gui/src/components/settings_chat.vue @@ -5,9 +5,24 @@ import { setActivePinia } from "pinia"; import pinia from "../store/index"; setActivePinia(pinia); -import { settingsStore as settings } from "../store/settingsStore.js"; +import { settingsStore as settings, onChange } from "../store/settingsStore.js"; diff --git a/gui/src/store/settingsStore.js b/gui/src/store/settingsStore.js index 8baa9b2d..25a0aa3e 100644 --- a/gui/src/store/settingsStore.js +++ b/gui/src/store/settingsStore.js @@ -98,6 +98,9 @@ const defaultConfig = { tci_ip: "127.0.0.1", tci_port: 0, }, + MESSAGES: { + enable_auto_repeat: false, + }, }, }; diff --git a/modem/config.py b/modem/config.py index b9e20636..cb97eb5f 100644 --- a/modem/config.py +++ b/modem/config.py @@ -67,6 +67,9 @@ class CONFIG: 'tx_delay': int, 'beacon_interval': int, }, + 'MESSAGES': { + 'enable_auto_repeat': bool, + } } default_values = { @@ -175,6 +178,7 @@ class CONFIG: # Sets and writes config data from a dict containing data settings def write(self, data): + print(data) # Validate config data before writing self.validate_data(data) diff --git a/modem/frame_handler_beacon.py b/modem/frame_handler_beacon.py index 7a88dc20..10b79822 100644 --- a/modem/frame_handler_beacon.py +++ b/modem/frame_handler_beacon.py @@ -17,5 +17,6 @@ class BeaconFrameHandler(frame_handler.FrameHandler): self.details['frame']["gridsquare"] ) - # set message to queued if beacon received - DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"]) + if self.config["MESSAGES"]["enable_auto_repeat"]: + # set message to queued if beacon received + DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"]) diff --git a/modem/frame_handler_cq.py b/modem/frame_handler_cq.py index 67fd4e44..1fe59d90 100644 --- a/modem/frame_handler_cq.py +++ b/modem/frame_handler_cq.py @@ -2,6 +2,9 @@ import frame_handler_ping import helpers import data_frame_factory import frame_handler +from message_system_db_messages import DatabaseManagerMessages + + class CQFrameHandler(frame_handler_ping.PingFrameHandler): def should_respond(self): @@ -14,3 +17,7 @@ class CQFrameHandler(frame_handler_ping.PingFrameHandler): self.details['snr'] ) self.transmit(qrv_frame) + + if self.config["MESSAGES"]["enable_auto_repeat"]: + # set message to queued if beacon received + DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"])