Update main.c move program_radio back to start

beta-v1.3.1-freq
Alan Johnston 2 years ago committed by GitHub
parent c52d0f9666
commit cff2f123eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,6 +45,49 @@ int main(int argc, char * argv[]) {
printf("\n\nCubeSatSim v1.3b starting...\n\n");
// Open configuration file with callsign and reset count
FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
if (config_file == NULL) {
printf("Creating config file.");
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "w");
fprintf(config_file, "%s %d", " ", 100);
fclose(config_file);
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
}
// char * cfg_buf[100];
fscanf(config_file, "%s %d %f %f %s %d %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx);
fclose(config_file);
printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s\n",
call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx);
printf("==%s==%s==\n", tx, rx);
program_radio();
reset_count = (reset_count + 1) % 0xffff;
if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0)) {
printf("Valid latitude and longitude in config file\n");
// convert to APRS DDMM.MM format
// latitude = toAprsFormat(lat_file);
// longitude = toAprsFormat(long_file);
latitude = lat_file;
longitude = long_file;
printf("Lat/Long %f %f\n", latitude, longitude);
printf("Lat/Long in APRS DDMM.MM format: %07.2f/%08.2f\n", toAprsFormat(latitude), toAprsFormat(longitude));
newGpsTime = millis();
} else { // set default
// latitude = toAprsFormat(latitude);
// longitude = toAprsFormat(longitude);
newGpsTime = millis();
}
if (strcmp(sim_yes, "yes") == 0)
sim_mode = TRUE;
wiringPiSetup();
// FILE * rpitx_stop = popen("sudo systemctl stop rpitx", "r");
@ -138,49 +181,6 @@ int main(int argc, char * argv[]) {
printf("Opened telem file\n");
// Open configuration file with callsign and reset count
FILE * config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
if (config_file == NULL) {
printf("Creating config file.");
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "w");
fprintf(config_file, "%s %d", " ", 100);
fclose(config_file);
config_file = fopen("/home/pi/CubeSatSim/sim.cfg", "r");
}
// char * cfg_buf[100];
fscanf(config_file, "%s %d %f %f %s %d %s %s", call, & reset_count, & lat_file, & long_file, sim_yes, & squelch, tx, rx);
fclose(config_file);
printf("Config file /home/pi/CubeSatSim/sim.cfg contains %s %d %f %f %s %d %s %s\n",
call, reset_count, lat_file, long_file, sim_yes, squelch, tx, rx);
printf("==%s==%s==\n", tx, rx);
program_radio();
reset_count = (reset_count + 1) % 0xffff;
if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0)) {
printf("Valid latitude and longitude in config file\n");
// convert to APRS DDMM.MM format
// latitude = toAprsFormat(lat_file);
// longitude = toAprsFormat(long_file);
latitude = lat_file;
longitude = long_file;
printf("Lat/Long %f %f\n", latitude, longitude);
printf("Lat/Long in APRS DDMM.MM format: %07.2f/%08.2f\n", toAprsFormat(latitude), toAprsFormat(longitude));
newGpsTime = millis();
} else { // set default
// latitude = toAprsFormat(latitude);
// longitude = toAprsFormat(longitude);
newGpsTime = millis();
}
if (strcmp(sim_yes, "yes") == 0)
sim_mode = TRUE;
if (mode == AFSK)
{
// Check for SPI and AX-5043 Digital Transceiver Board

Loading…
Cancel
Save

Powered by TurnKey Linux.