mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
transmission progress
This commit is contained in:
parent
56c211b089
commit
5efe491881
4 changed files with 41 additions and 25 deletions
|
@ -392,6 +392,7 @@ def arq_transmit(data_out):
|
||||||
elif static.ARQ_ACK_RECEIVED:
|
elif static.ARQ_ACK_RECEIVED:
|
||||||
transfer_rates = helpers.calculate_transfer_rate()
|
transfer_rates = helpers.calculate_transfer_rate()
|
||||||
logging.info("ARQ | RX | ACK [" + str(transfer_rates[2]) + " bit/s | " + str(transfer_rates[3]) + " B/min]")
|
logging.info("ARQ | RX | ACK [" + str(transfer_rates[2]) + " bit/s | " + str(transfer_rates[3]) + " B/min]")
|
||||||
|
|
||||||
# -----------IF ACK RECEIVED, INCREMENT ITERATOR FOR MAIN LOOP TO PROCEED WITH NEXT FRAMES/BURST
|
# -----------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
|
static.ARQ_N_SENT_FRAMES = static.ARQ_N_SENT_FRAMES + static.ARQ_TX_N_FRAMES_PER_BURST
|
||||||
break
|
break
|
||||||
|
@ -598,10 +599,6 @@ def arq_received_data_channel_opener(data_in):
|
||||||
connection_frame[3:9] = static.MYCALLSIGN
|
connection_frame[3:9] = static.MYCALLSIGN
|
||||||
connection_frame[12:13] = bytes([static.ARQ_DATA_CHANNEL_MODE])
|
connection_frame[12:13] = bytes([static.ARQ_DATA_CHANNEL_MODE])
|
||||||
|
|
||||||
# wait before sending so we can sure, other station is ready for TX
|
|
||||||
wait_until_transmit = time.time() + static.TIME_BETWEEN_RX_TX
|
|
||||||
while time.time() < wait_until_transmit:
|
|
||||||
pass
|
|
||||||
|
|
||||||
modem.transmit_signalling(connection_frame)
|
modem.transmit_signalling(connection_frame)
|
||||||
#modem.transmit_signalling(connection_frame)
|
#modem.transmit_signalling(connection_frame)
|
||||||
|
@ -673,11 +670,6 @@ def received_ping(data_in):
|
||||||
ping_frame[2:3] = static.MYCALLSIGN_CRC8
|
ping_frame[2:3] = static.MYCALLSIGN_CRC8
|
||||||
ping_frame[3:9] = static.MYGRID
|
ping_frame[3:9] = static.MYGRID
|
||||||
|
|
||||||
# wait before sending so we can sure, other station is ready for TX
|
|
||||||
wait_until_transmit = time.time() + static.TIME_BETWEEN_RX_TX
|
|
||||||
while time.time() < wait_until_transmit:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# wait while sending....
|
# wait while sending....
|
||||||
modem.transmit_signalling(ping_frame)
|
modem.transmit_signalling(ping_frame)
|
||||||
#modem.transmit_signalling(ping_frame)
|
#modem.transmit_signalling(ping_frame)
|
||||||
|
|
|
@ -15,6 +15,13 @@ import crcengine
|
||||||
import static
|
import static
|
||||||
import data_handler
|
import data_handler
|
||||||
|
|
||||||
|
def timeout(seconds):
|
||||||
|
timeout = time.time() + seconds
|
||||||
|
|
||||||
|
while time.time() < timeout:
|
||||||
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_crc_8(data):
|
def get_crc_8(data):
|
||||||
"""
|
"""
|
||||||
|
@ -130,20 +137,31 @@ def calculate_transfer_rate():
|
||||||
total_n_frames = int.from_bytes(static.ARQ_TX_N_TOTAL_ARQ_FRAMES, "big")
|
total_n_frames = int.from_bytes(static.ARQ_TX_N_TOTAL_ARQ_FRAMES, "big")
|
||||||
|
|
||||||
|
|
||||||
total_bytes = (total_n_frames * static.ARQ_PAYLOAD_PER_FRAME)
|
static.TOTAL_BYTES = (total_n_frames * static.ARQ_PAYLOAD_PER_FRAME)
|
||||||
total_transmission_time = time.time() - static.ARQ_START_OF_TRANSMISSION
|
total_transmission_time = time.time() - static.ARQ_START_OF_TRANSMISSION
|
||||||
|
|
||||||
|
|
||||||
burst_bytes = static.ARQ_PAYLOAD_PER_FRAME
|
burst_bytes = static.ARQ_PAYLOAD_PER_FRAME
|
||||||
burst_transmission_time = time.time() - static.ARQ_START_OF_BURST
|
burst_transmission_time = time.time() - static.ARQ_START_OF_BURST
|
||||||
|
|
||||||
static.ARQ_BITS_PER_SECOND_TRANSMISSION = int((total_bytes * 8) / total_transmission_time)
|
static.ARQ_BITS_PER_SECOND = int((static.TOTAL_BYTES * 8) / total_transmission_time)
|
||||||
static.ARQ_BYTES_PER_MINUTE_TRANSMISSION = int(((total_bytes) / total_transmission_time) * 60)
|
static.ARQ_BYTES_PER_MINUTE = int(((static.TOTAL_BYTES) / total_transmission_time) * 60)
|
||||||
|
|
||||||
static.ARQ_BITS_PER_SECOND_BURST = int((burst_bytes * 8) / burst_transmission_time)
|
static.ARQ_BITS_PER_SECOND_BURST = int((burst_bytes * 8) / burst_transmission_time)
|
||||||
static.ARQ_BYTES_PER_MINUTE_BURST = int(((burst_bytes) / burst_transmission_time) * 60)
|
static.ARQ_BYTES_PER_MINUTE_BURST = int(((burst_bytes) / burst_transmission_time) * 60)
|
||||||
|
|
||||||
|
|
||||||
return [static.ARQ_BITS_PER_SECOND_TRANSMISSION, static.ARQ_BYTES_PER_MINUTE_TRANSMISSION, static.ARQ_BITS_PER_SECOND_BURST, static.ARQ_BYTES_PER_MINUTE_BURST]
|
# calculate transmission percentage
|
||||||
|
if int(static.ARQ_TX_N_TOTAL_ARQ_FRAMES) > 0:
|
||||||
|
static.ARQ_TRANSMISSION_PERCENT = int(static.ARQ_TX_N_CURRENT_ARQ_FRAME) / int(static.ARQ_TX_N_TOTAL_ARQ_FRAMES)
|
||||||
|
|
||||||
|
elif int(static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME) > 0:
|
||||||
|
static.ARQ_TRANSMISSION_PERCENT = int(static.ARQ_RX_N_CURRENT_ARQ_FRAME) / int(static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME)
|
||||||
|
else:
|
||||||
|
static.ARQ_TRANSMISSION_PERCENT = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
return [static.ARQ_BITS_PER_SECOND, static.ARQ_BYTES_PER_MINUTE, static.ARQ_BITS_PER_SECOND_BURST, static.ARQ_BYTES_PER_MINUTE_BURST]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,10 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
"ARQ_RX_FRAME_N_BURSTS": str(static.ARQ_RX_FRAME_N_BURSTS),
|
"ARQ_RX_FRAME_N_BURSTS": str(static.ARQ_RX_FRAME_N_BURSTS),
|
||||||
"ARQ_RX_N_CURRENT_ARQ_FRAME": str(static.ARQ_RX_N_CURRENT_ARQ_FRAME),
|
"ARQ_RX_N_CURRENT_ARQ_FRAME": str(static.ARQ_RX_N_CURRENT_ARQ_FRAME),
|
||||||
"ARQ_N_ARQ_FRAMES_PER_DATA_FRAME": str(static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME),
|
"ARQ_N_ARQ_FRAMES_PER_DATA_FRAME": str(static.ARQ_N_ARQ_FRAMES_PER_DATA_FRAME),
|
||||||
|
"ARQ_BYTES_PER_MINUTE" : str(static.ARQ_BYTES_PER_MINUTE),
|
||||||
|
"ARQ_TRANSMISSION_PERCENT" : str(static.ARQ_TRANSMISSION_PERCENT),
|
||||||
|
"TOTAL_BYTES" : str(static.TOTAL_BYTES),
|
||||||
|
|
||||||
"STATIONS" : [],
|
"STATIONS" : [],
|
||||||
"EOF" : "EOF",
|
"EOF" : "EOF",
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,8 @@ ARQ_START_OF_BURST = 0
|
||||||
#ARQ_END_OF_TRANSMISSION = 0
|
#ARQ_END_OF_TRANSMISSION = 0
|
||||||
ARQ_BITS_PER_SECOND = 0
|
ARQ_BITS_PER_SECOND = 0
|
||||||
ARQ_BYTES_PER_MINUTE = 0
|
ARQ_BYTES_PER_MINUTE = 0
|
||||||
|
ARQ_TRANSMISSION_PERCENT = 0
|
||||||
|
TOTAL_BYTES = 0
|
||||||
|
|
||||||
# ------- TX BUFFER
|
# ------- TX BUFFER
|
||||||
TX_BUFFER_SIZE = 0
|
TX_BUFFER_SIZE = 0
|
||||||
|
|
Loading…
Reference in a new issue