mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-03 23:42:28 +02:00
auto TEST Buffer
This commit is contained in:
+6
-1
@@ -159,6 +159,8 @@ def handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM, chann
|
||||
if multiPingList[i].get('message_from_id') == message_from_id:
|
||||
multiPingList.pop(i)
|
||||
msg = "🛑 auto-ping"
|
||||
|
||||
# set inital pingCount
|
||||
try:
|
||||
pingCount = int(message.split(" ")[1])
|
||||
if pingCount == 123 or pingCount == 1234:
|
||||
@@ -170,7 +172,10 @@ def handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM, chann
|
||||
|
||||
if pingCount > 1:
|
||||
multiPingList.append({'message_from_id': message_from_id, 'count': pingCount + 1, 'type': type, 'deviceID': deviceID, 'channel_number': channel_number})
|
||||
msg = f"🚦Initalizing {pingCount} auto-ping"
|
||||
if type == "🎙TEST":
|
||||
msg = f"🎙Initalizing buffer Test range {MESSAGE_CHUNK_SIZE / pingCount} to {MESSAGE_CHUNK_SIZE}"
|
||||
else:
|
||||
msg = f"🚦Initalizing {pingCount} auto-ping"
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
+9
-1
@@ -471,6 +471,8 @@ def send_message(message, ch, nodeid=0, nodeInt=1, bypassChuncking=False):
|
||||
if not bypassChuncking:
|
||||
# Split the message into chunks if it exceeds the MESSAGE_CHUNK_SIZE
|
||||
message_list = messageChunker(message)
|
||||
else:
|
||||
message_list = [message]
|
||||
|
||||
if isinstance(message_list, list):
|
||||
# Send the message to the channel or DM
|
||||
@@ -606,7 +608,13 @@ def handleMultiPing(nodeID=0, deviceID=1):
|
||||
if multiPingList[i]['message_from_id'] == message_id_from:
|
||||
multiPingList[i]['count'] = count
|
||||
|
||||
send_message(f"🔂{count} {type}", channel_number, message_id_from, deviceID)
|
||||
if type == '🎙TEST':
|
||||
# use the type for a string of random data divided by MAXBUFFER and count for the length of the string
|
||||
type = ''.join(random.choice(['0', '1']) for i in range(int(MESSAGE_CHUNK_SIZE / count)))
|
||||
count = len(type)
|
||||
|
||||
send_message(f"🔂{count} {type}", channel_number, message_id_from, deviceID, bypassChuncking=True)
|
||||
|
||||
if count < 2:
|
||||
# remove the item from the list
|
||||
for j in range(len(multiPingList)):
|
||||
|
||||
Reference in New Issue
Block a user