Bridge and reflector logic tweaks

This commit is contained in:
Simon 2020-09-19 14:05:52 +01:00
parent 14ce37c3a6
commit 99372356e0
2 changed files with 14 additions and 10 deletions

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
############################################################################### ###############################################################################
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com> # Copyright (C) 2020 Simon Adlem, G7RZU <g7rzu@gb7fr.org.uk>
# Copyright (C) 2016-2019 Cortney T. Buffington, N0MJS <n0mjs@me.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -68,7 +69,7 @@ logger = logging.getLogger(__name__)
# Does anybody read this stuff? There's a PEP somewhere that says I should do this. # Does anybody read this stuff? There's a PEP somewhere that says I should do this.
__author__ = 'Cortney T. Buffington, N0MJS, Forked by Simon Adlem - G7RZU' __author__ = 'Cortney T. Buffington, N0MJS, Forked by Simon Adlem - G7RZU'
__copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group, Simon Adlem, G7RZU 2020' __copyright__ = 'Copyright (c) 2016-2019 Cortney T. Buffington, N0MJS and the K0USY Group, Simon Adlem, G7RZU 2020'
__credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT' __credits__ = 'Colin Durbridge, G4EML, Steve Zingman, N4IRS; Mike Zingman, N4IRR; Jonathan Naylor, G4KLX; Hans Barthen, DL5DI; Torsten Shultze, DG1HT; Jon Lee, G4TSN'
__license__ = 'GNU GPLv3' __license__ = 'GNU GPLv3'
__maintainer__ = 'Simon Adlem G7RZU' __maintainer__ = 'Simon Adlem G7RZU'
__email__ = 'simon@gb7fr.org.uk' __email__ = 'simon@gb7fr.org.uk'
@ -613,7 +614,7 @@ class routerHBP(HBSYSTEM):
continue continue
for _system in BRIDGES[_bridge]: for _system in BRIDGES[_bridge]:
_dehash_bridge = _bridge[1:] _dehash_bridge = _bridge[1:]
if _system['SYSTEM'] == self._system: if _system['SYSTEM'] == self._system and _slot == _system['TS']:
_active = False _active = False
if _system['ACTIVE'] == True: if _system['ACTIVE'] == True:
_say.append(words['silence']) _say.append(words['silence'])
@ -624,6 +625,7 @@ class routerHBP(HBSYSTEM):
for num in str(_dehash_bridge): for num in str(_dehash_bridge):
_say.append(words[num]) _say.append(words[num])
_active = True _active = True
if _active == False: if _active == False:
@ -642,16 +644,17 @@ class routerHBP(HBSYSTEM):
speech = pkt_gen(bytes_3(9), bytes_3(9), bytes_4(9), 1, _say) speech = pkt_gen(bytes_3(9), bytes_3(9), bytes_4(9), 1, _say)
sleep(1)
while True: while True:
try: try:
pkt = next(speech) pkt = next(speech)
except StopIteration: except StopIteration:
break break
self.send_system(pkt)
#Packet every 60ms #Packet every 60ms
sleep(0.06) sleep(0.058)
self.send_system(pkt)
#print(len(pkt), pkt[4], pkt)
# Mark status variables for use later # Mark status variables for use later
self.STATUS[_slot]['RX_PEER'] = _peer_id self.STATUS[_slot]['RX_PEER'] = _peer_id
self.STATUS[_slot]['RX_SEQ'] = _seq self.STATUS[_slot]['RX_SEQ'] = _seq
@ -849,8 +852,9 @@ class routerHBP(HBSYSTEM):
# #
# Iterate the rules dictionary # Iterate the rules dictionary
for _bridge in BRIDGES: for _bridge in BRIDGES:
if _bridge[0:1] == '#':
continue
for _system in BRIDGES[_bridge]: for _system in BRIDGES[_bridge]:
if _system['SYSTEM'] == self._system: if _system['SYSTEM'] == self._system:

View File

@ -11,7 +11,7 @@ class readAMBE:
def _make_bursts(self,data): def _make_bursts(self,data):
it = iter(data) it = iter(data)
for i in range(0, len(data), 108): for i in range(0, len(data), 108):
yield bitarray([k for k in islice(it, 108)]) yield bitarray([k for k in islice(it, 108)] )
def readfiles(self): def readfiles(self):
_AMBE_LENGTH = 9 _AMBE_LENGTH = 9
@ -57,8 +57,8 @@ class readAMBE:
except IOError: except IOError:
return False return False
_wordBADict['silence'] = ([ _wordBADict['silence'] = ([
[bitarray('000000001010110000000000000000001010101000000000000000000100000000000000000000000010000000000000000000000'), [bitarray('101011000000101010100000010000000000001000000000000000000000010001000000010000000000100000000000100000000000'),
bitarray('0000000000000000000000001000100000000000000000001000000000000000000000010000000000000000000000010000000')] bitarray('001010110000001010101000000100000000000010000000000000000000000100010000000100000000001000000000001000000000')]
]) ])
return _wordBADict return _wordBADict