chunkerEnhance

This commit is contained in:
SpudGunMan
2024-07-31 22:16:53 -07:00
parent b9862d281a
commit fa70aa555f
3 changed files with 19 additions and 12 deletions
+4 -2
View File
@@ -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`
+1
View File
@@ -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
+14 -10
View File
@@ -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)<split_len:
line += word + ' '
if len(line + word) < MESSAGE_CHUNK_SIZE:
if word == 'NEWLINE':
# chunk by newline if it exists
message_list.append(line)
line = ''
else:
line += word + ' '
else:
message_list.append(line)
line = word + ' '
message_list.append(line) # needed add contents of the last 'line' into the list
#message_list = [x.replace('NEWLINE', '\n') for x in message_list] # put back the newlines
for m in message_list:
if nodeid == 0:
@@ -273,7 +277,7 @@ def send_message(message, ch, nodeid=0, nodeInt=1):
interface1.sendText(text=m, channelIndex=ch, destinationId=nodeid)
if nodeInt == 2:
interface2.sendText(text=m, channelIndex=ch, destinationId=nodeid)
else: # message is less than 160 characters
else: # message is less than MESSAGE_CHUNK_SIZE characters
if nodeid == 0:
# Send to channel
print (f"{log_timestamp()} System: Sending Device:{nodeInt} Channel:{ch} Message: {message}")