toAprsFormat working, removed 100* on header lat and long

pull/79/head
alanbjohnston 5 years ago committed by GitHub
parent 033a1f0198
commit 5dc95cc483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -838,13 +838,13 @@ void get_tlm(void) {
strcat(str, header_str2);
// sprintf(header_str2b, "=%7.2f%c%c%c%08.2f%cShi hi ",4003.79,'N',0x5c,0x5c,07534.33,'W'); // add APRS lat and long
if (latitude > 0)
sprintf(header_lat, "%7.2f%c", latitude * 100.0, 'N'); // lat
sprintf(header_lat, "%7.2f%c", latitude, 'N'); // lat
else
sprintf(header_lat, "%7.2f%c", latitude * (-100.0), 'S'); // lat
sprintf(header_lat, "%7.2f%c", latitude * (-1.0), 'S'); // lat
if (longitude > 0)
sprintf(header_long, "%08.2f%c", longitude * 100.0, 'E'); // long
sprintf(header_long, "%08.2f%c", longitude, 'E'); // long
else
sprintf(header_long, "%08.2f%c", longitude * (-100.0), 'W'); // long
sprintf(header_long, "%08.2f%c", longitude * (-1.0), 'W'); // long
sprintf(header_str2b, "=%s%c%c%sShi hi ", header_lat, 0x5c, 0x5c, header_long); // add APRS lat and long
printf("\n\nString is %s \n\n", header_str2b);
@ -1979,14 +1979,8 @@ int test_i2c_bus(int bus)
float toAprsFormat(float input) {
// converts decimal coordinate (lattitude or longitude) to APRS DDMM.MM format
int dd = (int) input;
int mm1 = (int)((input - dd) * 60);
int mm2; // = (int)((input - dd - mm1/60) * 60 * 60);
float mm21 = input - dd - (float)mm1/60.0;
printf("%f ", mm21);
mm21 = mm21 * 60 * 60;
printf("%f ", mm21);
mm2 = (int)mm21;
printf("%d ", mm2);
float output = dd * 100 + mm1 + mm2 * 0.01;
int mm1 = (int)((input - dd) * 60.0);
int mm2 = (int)((input - dd - (float)mm1/60.0) * 60.0 * 60.0);
float output = dd * 100 + mm1 + (float)mm2 * 0.01;
return(output);
}

Loading…
Cancel
Save

Powered by TurnKey Linux.