fixed wrong callsign for ping

This commit is contained in:
DJ2LS 2021-03-07 16:41:02 +01:00 committed by GitHub
parent e73ea21792
commit 5ec22b6b65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -644,9 +644,13 @@ def arq_disconnect_received(data_in):
def transmit_ping(callsign):
static.DXCALLSIGN = bytes(callsign, 'utf-8')
logging.info("PING ["+ str(static.MYCALLSIGN, 'utf-8') + "] >>> [" + str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
frame_type = bytes([210])
ping_payload = b'PING'
ping_frame = frame_type + ping_payload
ping_frame = bytearray(14)
ping_frame[:1] = bytes([210])
ping_frame[1:2] = static.DXCALLSIGN_CRC8
ping_frame[2:3] = static.MYCALLSIGN_CRC8
ping_frame[3:9] = static.MYCALLSIGN
# wait while sending....
while static.CHANNEL_STATE == 'SENDING_SIGNALLING':
@ -655,20 +659,27 @@ def transmit_ping(callsign):
def received_ping(data_in):
static.DXCALLSIGN_CRC8 = bytes(data_in[2:3])
static.DXCALLSIGN = bytes(data_in[3:9])
logging.info("PING ["+ str(static.MYCALLSIGN, 'utf-8') + "] <<< ["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
frame_type = bytes([211])
ping_payload = b'PING_ACK'
ping_frame = frame_type + static.MYCALLSIGN + ping_payload
ping_frame = bytearray(14)
ping_frame[:1] = bytes([211])
ping_frame[1:2] = static.DXCALLSIGN_CRC8
ping_frame[2:3] = static.MYCALLSIGN_CRC8
ping_frame[3:9] = static.MYCALLSIGN
# wait while sending....
while static.CHANNEL_STATE == 'SENDING_SIGNALLING':
time.sleep(0.01)
modem.transmit_signalling(ping_frame)
def received_ping_ack(data_in):
dxcallsign = data_in[1:6]
static.DXCALLSIGN = bytes(dxcallsign)
static.DXCALLSIGN_CRC8 = helpers.get_crc_8(static.DXCALLSIGN)
static.DXCALLSIGN_CRC8 = bytes(data_in[2:3])
static.DXCALLSIGN = bytes(data_in[3:9])
logging.info("PING [" + str(static.DXCALLSIGN, 'utf-8') + "] >|< [" + str(static.MYCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
static.TNC_STATE = 'IDLE'