From fa70aa555fabefc23a93d8388323d3ba3ee13f58 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 31 Jul 2024 22:16:53 -0700 Subject: [PATCH] chunkerEnhance --- README.md | 6 ++++-- modules/settings.py | 1 + modules/system.py | 24 ++++++++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0cda00a..38b0110 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ The bot is also capable of using dual radio/nodes, so you can monitor two networ Store and forward-like message re-play with `messages`, and there is a repeater module for dual radio bots to cross post messages. -The bot can alsp monitor a frequency and notify when activy is seen. +The bot can alsp monitor a frequency and notify when activy is seen. Using Hamlib to watch the S meter on a connected radio. You can send alerts to channels when a frequency is detected for 20 seconds within the thresholds set in config.ini + +Any messages which are over 160 charcters are chunked into 160 message bytes to help traverse hops, in testing this keeps delivery success higher. - Various solar details for radio propagation - `sun` and `moon` return info on rise and set local time @@ -40,7 +42,7 @@ Stripped-down bot, mostly around for archive purposes. The mesh-bot enhanced mod ## Hardware The project is written in Linux on a Pi and should work anywhere meshtastic Python module will function, with any supported meshtastic hardware. While BLE and TCP will work they are not as reliable as serial connections. - - Firmware 2.3.14/15 could also have an issue with connectivity reported by a few in discord. + - Firmware 2.3.14/15 could also have an issue with connectivity with slower devices. ## Install Clone the project with `git clone https://github.com/spudgunman/meshing-around` diff --git a/modules/settings.py b/modules/settings.py index 25e796d..428320a 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -7,6 +7,7 @@ WELCOME_MSG = 'MeshBot, here for you like a friend who is not. Try sending: ping MOTD = 'Thanks for using MeshBOT! Have a good day!' # setup the global variables +MESSAGE_CHUNK_SIZE = 160 # message chunk size for sending at high success rate msg_history = [] # message history for the store and forward feature bbs_ban_list = [] # list of banned users bbs_admin_list = [] # list of admin users diff --git a/modules/system.py b/modules/system.py index 3cc7185..94e7173 100644 --- a/modules/system.py +++ b/modules/system.py @@ -237,26 +237,30 @@ def get_node_location(number, nodeInt=1): return position def send_message(message, ch, nodeid=0, nodeInt=1): - # if message over 160 characters, split it into multiple messages - if len(message) > 160: + # if message over MESSAGE_CHUNK_SIZE characters, split it into multiple messages + if len(message) > MESSAGE_CHUNK_SIZE: print (f"{log_timestamp()} System: Splitting Message, Message Length: {len(message)}") - # split the message into 160 character chunks - - #message = message.replace('\n', ' NEWLINE ') # replace newlines with NEWLINE to keep them in split chunks + + # split the message into MESSAGE_CHUNK_SIZE 160 character chunks + message = message.replace('\n', ' NEWLINE ') # replace newlines with NEWLINE to keep them in split chunks split_message = message.split() line = '' - split_len = 160 message_list = [] for word in split_message: - if len(line+word)