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