From 1d2fc138060c077691952ffa52b3c04642016e58 Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Sun, 13 Aug 2023 09:28:50 -0400 Subject: [PATCH] add command_count.txt read --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.c b/main.c index 9b1e16b4..a7582df3 100644 --- a/main.c +++ b/main.c @@ -1512,6 +1512,16 @@ void get_tlm_fox() { encodeA(b, 48 + head_offset, (int)(sensor[XS1] * 10 + 0.5) + 2048); encodeB(b, 49 + head_offset, (int)(sensor[XS2] * 10 + 0.5) + 2048); + FILE * command_count_file = fopen("/home/pi/CubeSatSim/command_count.txt", "r"); + if (command_count_file != NULL) { + char count_string[10]; + if ( (fgets(count_string, 10, command_count_file)) != NULL) + groundCommandCount = strotascii(count_string); + } else + print("Error opening command_count.txt!\n"); + fclose(command_count_file); + printf("Command count: %d\n", groundCommandCount); + int status = STEMBoardFailure + SafeMode * 2 + sim_mode * 4 + PayloadFailure1 * 8 + (i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256;