From 0a8ea24112b868c48328c8478b16741ee9f2f9e1 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 9 Feb 2021 12:35:24 +0100 Subject: [PATCH] improved RPT Now working, but still timing issues and stuck in sync --- arq.py | 153 ++++++++++++++++++++++++------------------------------ modem.py | 126 ++++++++++++-------------------------------- static.py | 4 +- 3 files changed, 103 insertions(+), 180 deletions(-) diff --git a/arq.py b/arq.py index f9747a6f..26f184eb 100644 --- a/arq.py +++ b/arq.py @@ -39,13 +39,8 @@ def data_received(data_in): # payload_data # N [8:N] # payload data - # detect if we got a RPT frame - if int.from_bytes(bytes(data_in[:1]), "big") == 51: - frame_type = int.from_bytes(bytes(data_in[:1]), "big") - else: - frame_type = 10 - static.ARQ_N_FRAME = int.from_bytes(bytes(data_in[:1]), "big") - 10 #get number of burst frame - + + static.ARQ_N_FRAME = int.from_bytes(bytes(data_in[:1]), "big") - 10 #get number of burst frame static.ARQ_N_RX_FRAMES_PER_BURSTS = int.from_bytes(bytes(data_in[1:2]), "big") #get number of bursts from received frame static.ARQ_RX_N_CURRENT_ARQ_FRAME = int.from_bytes(bytes(data_in[2:4]), "big") #get current number of total frames static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME = int.from_bytes(bytes(data_in[4:6]), "big") # get get total number of frames @@ -70,33 +65,32 @@ def data_received(data_in): #allocate ARQ_RX_FRAME_BUFFER as a list with "None" if not already done. This should be done only once per burst! # here we will save the N frame of a data frame to N list position so we can explicit search for it - if static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME != len(static.ARQ_RX_FRAME_BUFFER) and static.ARQ_RX_N_CURRENT_ARQ_FRAME == 1: + + try: + static.ARQ_RX_FRAME_BUFFER[static.ARQ_RX_N_CURRENT_ARQ_FRAME] = bytes(data_in) + + except IndexError: + static.ARQ_RX_FRAME_BUFFER = [] for i in range(0,static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME+1): static.ARQ_RX_FRAME_BUFFER.insert(i,None) + + static.ARQ_RX_FRAME_BUFFER[static.ARQ_RX_N_CURRENT_ARQ_FRAME] = bytes(data_in) + + + try: + static.ARQ_RX_BURST_BUFFER[static.ARQ_N_FRAME] = bytes(data_in) - #allocate ARQ_RX_BURST_BUFFER as a list with "None" if not already done. This should be done only once per burst! - # here we will save the N frame of a burst to N list position so we can explicit search for it - print(len(static.ARQ_RX_BURST_BUFFER)) - print(static.ARQ_N_FRAME) - - - if static.ARQ_N_RX_FRAMES_PER_BURSTS != len(static.ARQ_RX_BURST_BUFFER) and static.ARQ_N_FRAME == 1 and frame_type != 51: + except IndexError: + static.ARQ_RX_BURST_BUFFER = [] - print("ITERATOR!!!!!!!!!!!!!!") for i in range(0,static.ARQ_N_RX_FRAMES_PER_BURSTS+1): static.ARQ_RX_BURST_BUFFER.insert(i,None) - - - # now we add the incoming data to the specified position in our lists - static.ARQ_RX_BURST_BUFFER[static.ARQ_N_FRAME] = bytes(data_in) - static.ARQ_RX_FRAME_BUFFER[static.ARQ_RX_N_CURRENT_ARQ_FRAME] = bytes(data_in) - - for i in range(len(static.ARQ_RX_BURST_BUFFER)): - print(static.ARQ_RX_BURST_BUFFER[i]) - - - + + static.ARQ_RX_BURST_BUFFER[static.ARQ_N_FRAME] = bytes(data_in) + + #for i in range(len(static.ARQ_RX_BURST_BUFFER)): + # print(static.ARQ_RX_BURST_BUFFER[i]) # - ------------------------- ARQ BURST CHECKER @@ -108,60 +102,43 @@ def data_received(data_in): #BUILDING ACK FRAME FOR BURST ----------------------------------------------- ack_payload = b'ACK FRAME' ack_frame = b'<' + ack_payload # < = 60 - ack_buffer = bytearray(static.ARQ_ACK_PAYLOAD_PER_FRAME) - ack_buffer[:len(ack_frame)] = ack_frame # set buffersize to length of data which will be send - + #TRANSMIT ACK FRAME FOR BURST----------------------------------------------- - modem.transmit_arq_ack(ack_buffer) + modem.transmit_arq_ack(ack_frame) #clear burst buffer static.ARQ_RX_BURST_BUFFER = [] #if decoded N frames are unequal to expected frames per burst elif static.ARQ_N_FRAME == static.ARQ_N_RX_FRAMES_PER_BURSTS and static.ARQ_RX_BURST_BUFFER.count(None) != 1: - print("RPT FRAME NEEDS TO BE SEND!!!!") + # --------------- CHECK WHICH BURST FRAMES WE ARE MISSING ------------------------------------------- missing_frames = b'' for burst in range(1,len(static.ARQ_RX_BURST_BUFFER)): if static.ARQ_RX_BURST_BUFFER[burst] == None: - print(burst) burst = burst.to_bytes(2, byteorder='big') missing_frames += burst - - - print("MISSING FRAMES: " + str(missing_frames)) + + logging.info("ARQ | TX | RPT ARQ FRAMES [" + str(missing_frames) + "]") + #BUILDING RPT FRAME FOR BURST ----------------------------------------------- rpt_payload = missing_frames rpt_frame = b'>' + rpt_payload #> = 63 - rpt_buffer = bytearray(static.ARQ_ACK_PAYLOAD_PER_FRAME) - rpt_buffer[:len(rpt_frame)] = rpt_frame # set buffersize to length of data which will be send - modem.transmit_arq_ack(rpt_buffer) - - - - - - - - - + #TRANSMIT RPT FRAME FOR BURST----------------------------------------------- + modem.transmit_arq_ack(rpt_frame) + # ---------------------------- FRAME MACHINE - - # --------------- CHECK IF WE ARE MISSING FRAMES ------------------------------------------- - #for frame in range(1,len(static.ARQ_RX_FRAME_BUFFER)): - # if static.ARQ_RX_FRAME_BUFFER[frame] == None: - # print("Missing frames:" + str(frame)) - + # --------------- IF LIST NOT CONTAINS "None" stick everything together complete_data_frame = bytearray() - print("static.ARQ_RX_FRAME_BUFFER.count(None)" + str(static.ARQ_RX_FRAME_BUFFER.count(None))) + #print("static.ARQ_RX_FRAME_BUFFER.count(None)" + str(static.ARQ_RX_FRAME_BUFFER.count(None))) if static.ARQ_RX_FRAME_BUFFER.count(None) == 1: ## 1 because position 0 of list will alaways be None in our case - print("DECODING FRAME!") + #print("DECODING FRAME!") for frame in range(1,len(static.ARQ_RX_FRAME_BUFFER)): raw_arq_frame = static.ARQ_RX_FRAME_BUFFER[frame] arq_frame_payload = raw_arq_frame[8:] @@ -199,13 +176,12 @@ def data_received(data_in): #BUILDING ACK FRAME FOR DATA FRAME ----------------------------------------------- - ack_frame = b'='+ bytes(static.FRAME_CRC) # < = 61 - ack_buffer = bytearray(static.ARQ_ACK_PAYLOAD_PER_FRAME) - ack_buffer[:len(ack_frame)] = ack_frame # set buffersize to length of data which will be send + ack_frame = b'='+ bytes(static.FRAME_CRC) # < = 61 #TRANSMIT ACK FRAME FOR BURST----------------------------------------------- logging.info("ARQ | TX | ARQ DATA FRAME ACK [" + str(static.FRAME_CRC.hex()) +"]") - modem.transmit_arq_ack(ack_buffer) + time.sleep(0.5) + modem.transmit_arq_ack(ack_frame) # clearing buffers and resetting counters static.ARQ_RX_BURST_BUFFER = [] @@ -220,28 +196,34 @@ def data_received(data_in): else: logging.info("ARQ | RX | DATA FRAME NOT SUCESSFULLY RECEIVED!") - - #break + def burst_ack_received(): logging.info("ARQ | RX | BURST ACK RCVD!") static.ARQ_ACK_TIMEOUT = 1 #Force timer to stop waiting static.ARQ_ACK_RECEIVED = 1 #Force data loops of TNC to stop and continue with next frame - static.RPT_ACK_RECEIVED = False + + static.ARQ_RPT_TIMEOUT = True #Force timer to stop waiting + static.ARQ_RPT_RECEIVED = False + static.ARQ_RPT_FRAMES = [] def burst_rpt_received(data_in): logging.info("ARQ | RX | BURST RPT RCVD!") static.ARQ_ACK_TIMEOUT = 0 #Force timer to stop waiting static.ARQ_ACK_RECEIVED = 0 #Force data loops of TNC to stop and continue with next frame + static.ARQ_RPT_RECEIVED = True - #static.ARQ_RPT_FRAMES = b'123' - missing = 3 - missing = missing.to_bytes(2, byteorder='big') - static.ARQ_RPT_FRAMES.insert(0,missing) + static.ARQ_RPT_FRAMES = [] - print(bytes(data_in)) + missing_area = bytes(data_in[1:9]) + + for i in range(0,6,2): + if not missing_area[i:i+2].endswith(b'\x00\x00'): + missing = missing_area[i:i+2] + static.ARQ_RPT_FRAMES.insert(0,missing) + def frame_ack_received(): @@ -249,7 +231,8 @@ def frame_ack_received(): logging.info("ARQ | RX | FRAME ACK RCVD!") static.ARQ_ACK_TIMEOUT = 1 #Force timer to stop waiting static.ARQ_FRAME_ACK_RECEIVED = 1 #Force data loops of TNC to stop and continue with next frame - + static.RPT_ACK_RECEIVED = False + static.ARQ_RPT_TIMEOUT = True def transmit(data_out): @@ -310,6 +293,7 @@ def transmit(data_out): # lets wait during sending. After sending is finished we will continue while static.ARQ_STATE == 'SENDING_DATA': time.sleep(0.05) + print("sending.....") # --------------------------- START TIMER FOR WAITING FOR ACK ---> IF TIMEOUT REACHED, ACK_TIMEOUT = 1 @@ -325,14 +309,14 @@ def transmit(data_out): timer.start() # --------------------------- WHILE TIMEOUT NOT REACHED AND NO ACK RECEIVED --> LISTEN - while static.ARQ_ACK_TIMEOUT == 0 and static.ARQ_RPT_RECEIVED == False and static.ARQ_ACK_RECEIVED == 0: + while (static.ARQ_ACK_RECEIVED == 0 or static.ARQ_RPT_RECEIVED == False or static.ARQ_FRAME_ACK_RECEIVED == 0) and static.ARQ_TIMEOUT_RECEIVED == 0: time.sleep(0.01) # lets reduce CPU load a little bit #print(static.ARQ_STATE) #-------------------------------------------------------------------------------------------------------------- if static.ARQ_RPT_RECEIVED == True: - print("lets send a rpt packet") + TRANSMIT_ARQ_BURST_THREAD = threading.Thread(target=modem.transmit_arq_burst, name="TRANSMIT_ARQ_BURST") TRANSMIT_ARQ_BURST_THREAD.start() # lets wait during sending. After sending is finished we will continue @@ -342,34 +326,32 @@ def transmit(data_out): static.ARQ_FRAME_ACK_RECEIVED = 0 static.ARQ_ACK_RECEIVED = 0 static.ARQ_ACK_TIMEOUT = 0 + static.ARQ_RPT_TIMEOUT = False static.ARQ_STATE = 'RECEIVING_ACK' timer = threading.Timer(static.ARQ_RPT_TIMEOUT_SECONDS, arq_rpt_timeout) timer.start() - print("kommen wir hier überhaupt an?") - while static.ARQ_ACK_TIMEOUT == 0 and static.ARQ_ACK_RECEIVED == 0 and static.ARQ_RPT_TIMEOUT == False: + + while static.ARQ_ACK_RECEIVED == 0 and static.ARQ_RPT_TIMEOUT == False: time.sleep(0.01) # lets reduce CPU load a little bit - print("waiting for ack while rpt") + if static.ARQ_ACK_RECEIVED == 1: print("ACK WHILE RPT") - time.sleep(1) - static.ARQ_ACK_TIMEOUT = 1 - static.ARQ_RPT_RECEIVED = False - static.ARQ_RPT_TIMEOUT == False - break + static.ARQ_ACK_TIMEOUT = 1 + static.ARQ_RPT_TIMEOUT = True + #break #-------------------------------------------------------------------------------------------------------------- - if static.ARQ_ACK_RECEIVED == 0 and static.ARQ_ACK_TIMEOUT == 1 and static.ARQ_RPT_TIMEOUT == True: - #logging.info("ARQ | RX | ACK TIMEOUT | SENDING ARQ BURST AGAIN") - pass + #if static.ARQ_ACK_RECEIVED == 0 and static.ARQ_ACK_TIMEOUT == 1: + # #logging.info("ARQ | RX | ACK TIMEOUT | SENDING ARQ BURST AGAIN") + # pass - #--------------- BREAK LOOP IF ACK HAS BEEN RECEIVED OR FRAME ACK HAS BEEN RECEIVED - if static.ARQ_ACK_RECEIVED == 1: - print("der interator increment ist wichtig!") + #--------------- BREAK LOOP IF ACK HAS BEEN RECEIVED + if static.ARQ_ACK_RECEIVED == 1: #-----------IF ACK RECEIVED, INCREMENT ITERATOR FOR MAIN LOOP TO PROCEED WITH NEXT FRAMES/BURST static.ARQ_N_SENT_FRAMES = static.ARQ_N_SENT_FRAMES + static.ARQ_TX_N_FRAMES_PER_BURST break @@ -384,7 +366,6 @@ def transmit(data_out): # ----------- if no ACK received and out of retries.....stop frame sending if static.ARQ_ACK_RECEIVED == 0 and static.ARQ_FRAME_ACK_RECEIVED == 0 and static.ARQ_ACK_TIMEOUT == 1: logging.info("ARQ | TX | NO BURST OR FRAME ACK RECEIVED | DATA SHOULD BE RESEND!") - break #-------------------------BREAK TX BUFFER LOOP IF ALL PACKETS HAVE BEEN SENT AND WE GOT A FRAME ACK diff --git a/modem.py b/modem.py index f1106f5f..2751f5b7 100644 --- a/modem.py +++ b/modem.py @@ -56,53 +56,10 @@ class RF(): #--------------------------------------------START DECODER THREAD FREEDV_DECODER_THREAD = threading.Thread(target=self.receive, args=[static.FREEDV_DATA_MODE,static.FREEDV_SIGNALLING_MODE], name="FREEDV_DECODER_THREAD") FREEDV_DECODER_THREAD.start() -#-------------------------------------------------------------------------------------------------------- - # GET DATA AND MODULATE IT - - def transmit(self,mode,data_out): - self.c_lib.freedv_open.restype = ctypes.POINTER(ctypes.c_ubyte) - freedv = self.c_lib.freedv_open(mode) - bytes_per_frame = int(self.c_lib.freedv_get_bits_per_modem_frame(freedv)/8) - payload_per_frame = bytes_per_frame -2 - n_nom_modem_samples = self.c_lib.freedv_get_n_nom_modem_samples(freedv) - n_tx_modem_samples = self.c_lib.freedv_get_n_tx_modem_samples(freedv)*2 #get n_tx_modem_samples which defines the size of the modulation object - - mod_out = ctypes.c_short * n_tx_modem_samples - mod_out = mod_out() - mod_out_preamble = ctypes.c_short * n_tx_modem_samples #1760 for mode 10,11,12 #4000 for mode 9 - mod_out_preamble = mod_out_preamble() - - data_list = [data_out[i:i+payload_per_frame] for i in range(0, len(data_out), payload_per_frame)] # split incomming bytes to size of 30bytes, create a list and loop through it - data_list_length = len(data_list) - for i in range(data_list_length): # LOOP THROUGH DATA LIST - - buffer = bytearray(payload_per_frame) # use this if CRC16 checksum is required ( DATA1-3) - buffer[:len(data_list[i])] = data_list[i] # set buffersize to length of data which will be send - - crc = ctypes.c_ushort(self.c_lib.freedv_gen_crc16(bytes(buffer), payload_per_frame)) # generate CRC16 - crc = crc.value.to_bytes(2, byteorder='big') # convert crc to 2 byte hex string - buffer += crc # append crc16 to buffer - - data = (ctypes.c_ubyte * bytes_per_frame).from_buffer_copy(buffer) - self.c_lib.freedv_rawdatapreambletx(freedv, mod_out_preamble) - self.c_lib.freedv_rawdatatx(freedv,mod_out,data) # modulate DATA and safe it into mod_out pointer - - # -------------- preamble area - # WE NEED TO ADJUST IT FOR SINGLE TRANSMISSION - - txbuffer = bytearray() - txbuffer += bytes(mod_out_preamble) - txbuffer += bytes(mod_out) - txbuffer = txbuffer.rstrip(b'\x00') - - - # -------------- transmit audio - self.stream_tx.write(bytes(txbuffer)) - #-------------------------------------------------------------------------------------------------------- def transmit_arq_ack(self,ack_buffer): - + #print(ack_buffer) static.ARQ_STATE = 'SENDING_ACK' self.c_lib.freedv_open.restype = ctypes.POINTER(ctypes.c_ubyte) @@ -123,7 +80,6 @@ class RF(): crc = ctypes.c_ushort(self.c_lib.freedv_gen_crc16(bytes(buffer), payload_per_frame)) # generate CRC16 crc = crc.value.to_bytes(2, byteorder='big') # convert crc to 2 byte hex string buffer += crc # append crc16 to buffer - #print(bytes(buffer)) data = (ctypes.c_ubyte * bytes_per_frame).from_buffer_copy(buffer) preamble_bytes = self.c_lib.freedv_rawdatapreambletx(freedv, mod_out_preamble) @@ -137,14 +93,13 @@ class RF(): # -------------- transmit audio twice self.stream_tx.write(bytes(txbuffer)) self.stream_tx.write(bytes(txbuffer)) - + static.ARQ_STATE = 'RECEIVING_DATA' #-------------------------------------------------------------------------------------------------------- # GET ARQ BURST FRAME VOM BUFFER AND MODULATE IT def transmit_arq_burst(self): static.ARQ_STATE = 'SENDING_DATA' - time.sleep(3) - + self.c_lib.freedv_open.restype = ctypes.POINTER(ctypes.c_ubyte) freedv = self.c_lib.freedv_open(static.FREEDV_DATA_MODE) static.FREEDV_DATA_BYTES_PER_FRAME = int(self.c_lib.freedv_get_bits_per_modem_frame(freedv)/8) @@ -202,10 +157,9 @@ class RF(): elif static.ARQ_RPT_RECEIVED == True: for n in range(0,len(static.ARQ_RPT_FRAMES)): - - + missing_frame = int.from_bytes(static.ARQ_RPT_FRAMES[n], "big") - print("MISSING_FRAME: " + str(missing_frame)) + print("MISSING ARQ FRAME: " + str(missing_frame)) #---------------------------BUILD ARQ BURST --------------------------------------------------------------------- frame_type = 10 + missing_frame #static.ARQ_TX_N_FRAMES_PER_BURST frame_type = bytes([frame_type]) @@ -225,9 +179,7 @@ class RF(): static.DXCALLSIGN_CRC8 + \ static.MYCALLSIGN_CRC8 + \ payload_data - - #print(arqframe) - + buffer = bytearray(static.FREEDV_DATA_PAYLOAD_PER_FRAME) # create TX buffer buffer[:len(arqframe)] = arqframe # set buffersize to length of data which will be send @@ -240,13 +192,7 @@ class RF(): txbuffer += bytes(mod_out) txbuffer = txbuffer.rstrip(b'\x00') #lets remove unallocated memory because of wrong buffer :-/ - - - - - - - + # -------------- transmit audio self.stream_tx.write(bytes(txbuffer)) @@ -280,9 +226,7 @@ class RF(): stuck_in_sync_counter = 0 stuck_in_sync_10_counter = 0 # - - - + while static.ARQ_STATE == 'RECEIVING_DATA': time.sleep(0.01) @@ -296,7 +240,7 @@ class RF(): self.c_lib.freedv_rawdatarx.argtype = [ctypes.POINTER(ctypes.c_ubyte), data_bytes_out, data_in] # check if really neccessary nbytes = self.c_lib.freedv_rawdatarx(freedv_data, data_bytes_out, data_in) # demodulate audio - print(self.c_lib.freedv_get_rx_status(freedv_data)) + #print(self.c_lib.freedv_get_rx_status(freedv_data)) #-------------STUCK IN SYNC DETECTOR @@ -306,12 +250,12 @@ class RF(): #print(stuck_in_sync_counter) - if stuck_in_sync_counter == 33 and self.c_lib.freedv_get_rx_status(freedv_data) == 10: - print("stuck in sync #1 --> DOING UNSYNC") - self.c_lib.freedv_set_sync(freedv_data, 0) #FORCE UNSYNC - stuck_in_sync_counter = 0 - stuck_in_sync_10_counter = 0 - data_in = None + #if stuck_in_sync_counter == 33 and self.c_lib.freedv_get_rx_status(freedv_data) == 10: + # print("stuck in sync #1 --> DOING UNSYNC") + # self.c_lib.freedv_set_sync(freedv_data, 0) #FORCE UNSYNC + # stuck_in_sync_counter = 0 + # stuck_in_sync_10_counter = 0 + # data_in = None if stuck_in_sync_counter >= 66 and stuck_in_sync_10_counter >= 2: @@ -321,16 +265,10 @@ class RF(): stuck_in_sync_10_counter = 0 data_in = None #----------------------------------- - - - #modem_stats_snr = c_float() - #modem_stats_sync = c_int() - - #self.c_lib.freedv_get_modem_stats(freedv_data,byref(modem_stats_sync), byref(modem_stats_snr)) - #modem_stats_snr = modem_stats_snr.value - #print(modem_stats_snr) + if nbytes == static.FREEDV_DATA_BYTES_PER_FRAME: + # counter reset for stuck in sync counter stuck_in_sync_counter = 0 stuck_in_sync_10_counter = 0 @@ -344,20 +282,24 @@ class RF(): if 50 >= frametype >= 10: if frame != 3 or force == True: arq.data_received(bytes(data_bytes_out[:-2])) #send payload data to arq checker without CRC16 + #print("static.ARQ_RX_BURST_BUFFER.count(None) " + str(static.ARQ_RX_BURST_BUFFER.count(None))) + if static.ARQ_RX_BURST_BUFFER.count(None) <= 1: + print("FULL BURST BUFFER ---> UNSYNC") + self.c_lib.freedv_set_sync(freedv_data, 0) + else: - print("---------------------------3er FRAME") + print("---------------------------SIMULATED MISSING FRAME") force = True else: print("MODE: " + str(data_mode) + " DATA: " + str(bytes(data_bytes_out))) - # NEEDS TO BE OPTIMIZED - # DO UNSYNC AFTER LAST BURST by checking the frame numbers agains the total frames per burst + + # DO UNSYNC AFTER LAST BURST by checking the frame numbers agains the total frames per burst if frame == n_frames_per_burst: + print("LAST FRAME ---> UNSYNC") self.c_lib.freedv_set_sync(freedv_data, 0) #FORCE UNSYNC - - if static.ARQ_RX_BURST_BUFFER.count(None) == 1: - self.c_lib.freedv_set_sync(freedv_data, 0) + while static.ARQ_STATE == 'IDLE' or static.ARQ_STATE == 'RECEIVING_ACK': time.sleep(0.01) @@ -374,8 +316,9 @@ class RF(): # CHECK IF FRAME CONTAINS ACK------------------------ if nbytes == static.FREEDV_SIGNALLING_BYTES_PER_FRAME: - + self.c_lib.freedv_set_sync(freedv_signalling, 0) frametype = int.from_bytes(bytes(signalling_bytes_out[:1]), "big") + print("SIGNALLING RECEIVED") # BURST ACK if frametype == 60: @@ -384,16 +327,15 @@ class RF(): # FRAME ACK if frametype == 61: arq.frame_ack_received() - + # FRAME RPT if frametype == 62: arq.burst_rpt_received(signalling_bytes_out[:-2]) - - - + rxstatus = self.c_lib.freedv_get_rx_status(freedv_signalling) + print("ACK") print(rxstatus) - if nbytes == static.FREEDV_SIGNALLING_BYTES_PER_FRAME or rxstatus == 10: - self.c_lib.freedv_set_sync(freedv_signalling, 0) #FORCE UNSYNC + #if nbytes == static.FREEDV_SIGNALLING_BYTES_PER_FRAME:# or rxstatus == 10: + # self.c_lib.freedv_set_sync(freedv_signalling, 0) #FORCE UNSYNC diff --git a/static.py b/static.py index 0da64763..0222509a 100644 --- a/static.py +++ b/static.py @@ -85,10 +85,10 @@ ARQ_ACK_PAYLOAD_PER_FRAME = 0 # PAYLOAD per ACK frame ARQ_ACK_RECEIVED = 0 # set to 1 if ACK received ARQ_FRAME_ACK_RECEIVED = 0 # set to 1 if FRAME ACK received ARQ_ACK_TIMEOUT = 0 # set to 1 if timeut reached -ARQ_ACK_TIMEOUT_SECONDS = 4.0 #timeout for waiting for ACK frames +ARQ_ACK_TIMEOUT_SECONDS = 6.0 #timeout for waiting for ACK frames ARQ_RPT_TIMEOUT = False -ARQ_RPT_TIMEOUT_SECONDS = 4.0 +ARQ_RPT_TIMEOUT_SECONDS = 6.0 ARQ_RPT_RECEIVED = False #indicate if RPT frame has been received ARQ_RPT_FRAMES = []