diff --git a/mesh_bot.py b/mesh_bot.py index 8fcec51..c2b8c8c 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -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 diff --git a/modules/system.py b/modules/system.py index 5f2b180..fa5caf5 100644 --- a/modules/system.py +++ b/modules/system.py @@ -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)):