diff --git a/utility/obsw_binary_uploader.py b/utility/obsw_binary_uploader.py index d27c23236231f3115e67d70a47072d72684271bb..7f162df445e39d990705aef4a4d28c84eca6605f 100644 --- a/utility/obsw_binary_uploader.py +++ b/utility/obsw_binary_uploader.py @@ -140,10 +140,12 @@ def perform_file_upload(com_if: CommunicationInterface, tmtc_printer: TmTcPrinte str(file_transfer_helper.number_of_append_packets) + " append packets." LOGGER.info(print_string) interval = 0.5 + last_sent = time.time() total_time = interval * total_num_packets idx = 1 reception_deque = deque() while tc_queue: + next_send = last_sent + interval (tc_packet, tc_info) = tc_queue.pop() if not isinstance(tc_packet, str): # print_string = "Sending packet " + str(idx) + ".." @@ -153,14 +155,15 @@ def perform_file_upload(com_if: CommunicationInterface, tmtc_printer: TmTcPrinte tmtc_printer.print_telecommand(tc_packet, tc_info) elif tc_packet == "print": LOGGER.info(tc_info) - - time.sleep(0.5) remaining_time_string = "Remaining time: " + str(total_time - (idx - 2) * interval) + \ " seconds" print_progress_bar(idx - 2, total_num_packets, print_end="\n", suffix=remaining_time_string) - # sys.stdout.write("\033[F") # Cursor up one line reception_deque.extend(tm_listener.retrieve_tm_packet_queue()) + time_to_sleep = next_send - time.time() + last_sent = next_send + time.sleep(time_to_sleep) + print_string = "BinaryUploader: All binary packets were sent!" LOGGER.info(print_string) print_string = str(reception_deque.__len__()) + " replies received."