enhance code with inital brodcaster

https://github.com/SpudGunMan/meshing-around/issues/51 referenced in this enhancement. this is partially implemented for now in code
This commit is contained in:
SpudGunMan
2024-08-27 16:06:52 -07:00
parent 9d7e42aa60
commit c4ef1251c9
3 changed files with 31 additions and 0 deletions
+16
View File
@@ -421,6 +421,22 @@ async def start_rx():
logger.debug(f"System: Repeater Enabled for Channels: {repeater_channels}")
if radio_dectection_enabled:
logger.debug(f"System: Radio Detection Enabled using rigctld at {rigControlServerAddress} brodcasting to channels: {sigWatchBrodcastCh} for {get_freq_common_name(get_hamlib('f'))}")
if scheduler_enabled:
# Examples of using the scheduler
# https://schedule.readthedocs.io/en/stable/
# Good Morning Every day at 09:00 using send_message function to channel 2 on device 1
#schedule.every().day.at("09:00").do(send_message, "Good Morning", 2, 0, 1)
# Send WX every Morning at 08:00 using handle_wxc function to channel 2 on device 1
#schedule.every().day.at("08:00").do(send_message, handle_wxc(0, 1, 'wx'), 2, 0, 1)
# Send a Net Starting Now Message Every Wednesday at 19:00 using send_message function to channel 2 on device 1
#schedule.every().wednesday.at("19:00").do(send_message, "The Radio Net Starting Now!", 2, 0, 1)
#
logger.debug("System: Starting the broadcast scheduler")
await BroadcastScheduler()
# here we go loopty loo
while True:
+1
View File
@@ -24,6 +24,7 @@ max_retry_count1 = 4 # max retry count for interface 1
max_retry_count2 = 4 # max retry count for interface 2
retry_int1 = False
retry_int2 = False
scheduler_enabled = False # enable the scheduler currently config via code only
# Read the config file, if it does not exist, create basic config file
config = configparser.ConfigParser()
+14
View File
@@ -64,6 +64,13 @@ if dad_jokes_enabled:
trap_list = trap_list + ("joke",)
help_message = help_message + ", joke"
# Scheduled Broadcast Configuration
if scheduler_enabled:
import schedule # pip install schedule
# Reminder Scheduler is enabled every day at noon
schedule.every().day.at("12:00").do(logger.info, "Scheduler: Reminder Scheduler is enabled")
# Sentry Configuration
if sentry_enabled:
from math import sqrt
import geopy.distance # pip install geopy
@@ -323,6 +330,7 @@ def get_node_location(number, nodeInt=1, channel=0):
else:
logger.warning(f"System: No nodes found")
return position
return position
def get_closest_nodes(nodeInt=1,returnCount=3):
node_list = []
@@ -508,6 +516,12 @@ def exit_handler():
asyncLoop.close()
exit (0)
async def BroadcastScheduler():
# handle schedule checks for the broadcast of messages
while True:
schedule.run_pending()
await asyncio.sleep(1)
async def handleSignalWatcher():
global lastHamLibAlert, antiSpam, sigWatchBrodcastCh
# monitor rigctld for signal strength and frequency