From 45b18c5050a9b1e356f732e0260bcd3bf7b41581 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 30 Jun 2024 11:58:07 -0400 Subject: [PATCH] Update aprs_in.py increment command_count --- aprs_in.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/aprs_in.py b/aprs_in.py index 83331bd6..e696bb6d 100644 --- a/aprs_in.py +++ b/aprs_in.py @@ -38,6 +38,22 @@ if __name__ == "__main__": mode = 'm' change_mode = True if (debug_mode == False) and (change_mode == True): + try: + file = open("/home/pi/CubeSatSim/command_count.txt", "r") + string = file.read() + file.close() + command_count = int(string) + command_count += 1 + filec = open("/home/pi/CubeSatSim/command_count.txt", "w") + command_count_string = str(command_count) + print(command_count_string) + string = filec.write(command_count_string) + filec.close() + except: + print("Can't write command_count file!") + print("Command_count: ") + print(command_count) + print("\n/home/pi/CubeSatSim/config -" + mode) system("/home/pi/CubeSatSim/config -" + mode) change_mode = False