Update main.c set c2cStatus

beta-ft2
Alan Johnston 1 year ago committed by GitHub
parent 9ff57f8aa9
commit 3325ab89af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -24,7 +24,20 @@
//#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry //#define HAB // uncomment to change APRS icon from Satellite to Balloon and only BAT telemetry
int main(int argc, char * argv[]) { int main(int argc, char * argv[]) {
FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r");
if (command_file == NULL) {
fprintf(stderr,"Command and control is OFF\n");
c2cStatus = 0;
} else {
command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r");
if (command_file == NULL) {
fprintf(stderr,"Command and control Carrier (squelch) is ON\n");
c2cStatus = 1;
} else
fprintf(stderr,"Command and control DTMF or APRS is ON\n");
c2cStatus = 2;
}
char resbuffer[1000]; char resbuffer[1000];
// const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'"; // const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//' | grep '9000'";
const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'"; const char testStr[] = "cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}' | sed 's/^1000//'";
@ -54,22 +67,14 @@ int main(int argc, char * argv[]) {
} }
else { else {
fprintf(stderr,"Pi Zero detected\n"); fprintf(stderr,"Pi Zero detected\n");
FILE * command_file = fopen("/home/pi/CubeSatSim/command_control", "r"); if (c2cStatus == 0) || (c2cStatus == 1) {
if (command_file == NULL) { pi_zero_2_offset = 500;
pi_zero_2_offset = 500;
fprintf(stderr,"Command and control is OFF\n");
} else {
command_file = fopen("/home/pi/CubeSatSim/command_control_direwolf", "r");
if (command_file == NULL) {
pi_zero_2_offset = 500;
fprintf(stderr,"Command and control Carrier (squelch) is ON\n");
}
} }
if (uptime_sec < 30.0) { if (uptime_sec < 30.0) {
FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r"); FILE * rpitx_stop = popen("sudo systemctl start rpitx", "r");
pclose(rpitx_stop); pclose(rpitx_stop);
fprintf(stderr,"Sleep 10 sec"); fprintf(stderr,"Sleep 10 sec");
sleep(10); sleep(10);
} }
} }
@ -1560,7 +1565,7 @@ void get_tlm_fox() {
(i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256; (i2c_bus0 == OFF) * 16 + (i2c_bus1 == OFF) * 32 + (i2c_bus3 == OFF) * 64 + (camera == OFF) * 128 + groundCommandCount * 256;
encodeA(b, 51 + head_offset, status); encodeA(b, 51 + head_offset, status);
encodeB(b, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2); encodeB(b, 52 + head_offset, rxAntennaDeployed + txAntennaDeployed * 2 + c2cStatus * 4);
if (txAntennaDeployed == 0) { if (txAntennaDeployed == 0) {
txAntennaDeployed = 1; txAntennaDeployed = 1;

Loading…
Cancel
Save

Powered by TurnKey Linux.