Update main.c add command count and safe mode to FC

fc-jy
Alan Johnston 11 months ago committed by GitHub
parent 94779f8a96
commit b1f4d72074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2388,10 +2388,27 @@ void get_tlm_fc() {
source_bytes[extended + FC_EPS + 17] = source_bytes[extended + FC_EPS + 17] | 0x3f & (temp >> 2);
source_bytes[extended + FC_EPS + 18] = 0xff & (temp << 6);
// source_bytes[extended + FC_EPS + 45] = 0x0a;
source_bytes[extended + FC_EPS + 48] = 0x0a;
source_bytes[extended + 49] = 0xff & ((unsigned long int)sequence >> 16); // was 45 46
source_bytes[extended + 50] = 0xff & ((unsigned long int)sequence >> 8);
source_bytes[extended + 51] = 0xff & (unsigned long int)sequence++;
uint8_t groundCommandCount = 0;
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 = (uint8_t) atoi(count_string);
} else
printf("Error opening command_count.txt!\n");
fclose(command_count_file);
source_bytes[extended + 52] = 0xfc & (groundCommandCount << 2);
source_bytes[extended + 53] = 0x40 & (SafeMode == 1);
/*
source_bytes[extended + 46] = 0x01;
source_bytes[extended + 47] = 0x02;
@ -2425,6 +2442,7 @@ void get_tlm_fc() {
source_bytes[FC_SW + 0] = 0xff & ((unsigned long int)sequence >> 16); // Sequence number
source_bytes[FC_SW + 1] = 0xff & ((unsigned long int)sequence >> 8);
source_bytes[FC_SW + 2] = 0xff & (unsigned long int)sequence++;
#endif
/**/

Loading…
Cancel
Save

Powered by TurnKey Linux.