development computer sync

This commit is contained in:
Cort Buffington 2019-02-27 11:27:11 -06:00
parent 4b90dc7a8c
commit 7e3bf4f16c
2 changed files with 4 additions and 1 deletions

View File

@ -77,6 +77,7 @@ def pkt_gen(_rf_src, _dst_id, _peer, _slot, _phrase):
# Send each burst, six bursts per Superframe rotating through with the proper EMBED value per burst A-F
for word in _phrase:
for burst in range(0, len(word)):
print(burst)
pkt = b'DMRD' + bytes([SEQ]) + SDP + bytes([_slot << 7 | BURSTBITS[burst % 6]]) + STREAM_ID + (word[burst + 0][0] + EMBED[burst % 6] + word[burst + 0][1]).tobytes() + TAIL
SEQ = (SEQ + 1) % 0x100
yield pkt

View File

@ -23,6 +23,7 @@ import sys
from bitarray import bitarray
from time import time, sleep
from importlib import import_module
from binascii import b2a_hex as bhex
# Twisted is pretty important, so I keep it separate
from twisted.internet.protocol import Factory, Protocol
@ -79,7 +80,7 @@ class HBP(HBSYSTEM):
print(int_id(_stream_id), int_id(self.last_stream))
self.last_stream = _stream_id
print('start speech')
speech = pkt_gen(bytes_3(312123), bytes_3(2), bytes_4(312123), 0, [words['all_circuits'], words['enabled'], words['3'], words['1'], words['2'], words['0']])
speech = pkt_gen(bytes_3(3120101), bytes_3(2), bytes_4(3120119), 0, [words['all_circuits'],words['all_circuits']])
sleep(1)
while True:
@ -89,6 +90,7 @@ class HBP(HBSYSTEM):
break
sleep(.058)
self.send_system(pkt)
print(bhex(pkt))
print('end speech')