From f9405e69b8f99a0d8101a89520a19333d5303ffa Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Wed, 24 Aug 2022 19:51:30 -0400 Subject: [PATCH] fixed lat lon read --- cubesatsim/cubesatsim.ino | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cubesatsim/cubesatsim.ino b/cubesatsim/cubesatsim.ino index e4a6cd15..fca3c567 100644 --- a/cubesatsim/cubesatsim.ino +++ b/cubesatsim/cubesatsim.ino @@ -382,16 +382,17 @@ void read_config_file() { if ((fabs(lat_file) > 0) && (fabs(lat_file) < 90.0) && (fabs(long_file) > 0) && (fabs(long_file) < 180.0)) { Serial.println("Valid latitude and longitude in config file\n"); // convert to APRS DDMM.MM format - latitude = toAprsFormat(lat_file); - longitude = toAprsFormat(long_file); - Serial.printf("Lat/Long in APRS DDMM.MM format: %f/%f\n", latitude, longitude); - } else { // set default - latitude = toAprsFormat(latitude); - longitude = toAprsFormat(longitude); + latitude = lat_file; // toAprsFormat(lat_file); + longitude = long_file; // toAprsFormat(long_file); + Serial.printf("Lat/Lon updated to: %f/%f\n", latitude, longitude); } +// } else { // set default +// latitude = toAprsFormat(latitude); +// longitude = toAprsFormat(longitude); +// } if (strcmp(sim_yes, "yes") == 0) - sim_mode = TRUE; + sim_mode = true; config_file.close(); } @@ -409,6 +410,8 @@ void write_config_file() { strcpy(sim_yes, "no"); sprintf(buff, "%s %d %f %f %s", callsign, reset_count, latitude, longitude, sim_yes); + Serial.println("Writing string"); + print_string(buff); config_file.write(buff, strlen(buff)); config_file.close(); @@ -4030,7 +4033,9 @@ void prompt_for_input() { Serial.println(float_result); longitude = float_result; } else - Serial.println("Longitude not updated"); + Serial.println("Longitude not updated"); + + write_config_file(); if (mode == AFSK) set_lat_lon();