Pass lon/lat to geofence update functions as 100 nanodeg int32_t instead of float

master
Richard Meadows 2015-07-22 22:56:33 +01:00
rodzic 3165b5dbbd
commit 8cff9a91fd
4 zmienionych plików z 14 dodań i 12 usunięć

Wyświetl plik

@ -29,11 +29,11 @@
#include "samd20.h"
bool telemetry_location_tx_allow(void);
void telemetry_location_update(float lon, float lat);
void telemetry_location_update(int32_t lon_i, int32_t lat_i);
bool latlon_in_aprs_zone(int32_t aprs_zone, int32_t aprs_zone_outline, float lon, float lat);
bool aprs_location_tx_allow(void);
int32_t aprs_location_frequency(void);
void aprs_location_update(float lon, float lat);
void aprs_location_update(int32_t lon_i, int32_t lat_i);
#endif /* LOCATION_H */

Wyświetl plik

@ -158,10 +158,7 @@ void cron_telemetry(struct tracker_time* t, struct tracker_datapoint* dp)
if (gps_is_locked()) { /* Don't bother with no GPS */
float lat = (float)dp->latitude / 10000000.0; /* degrees */
float lon = (float)dp->longitude / 10000000.0; /* degrees */
telemetry_location_update(lon, lat);
telemetry_location_update(dp->longitude, dp->latitude);
}
}
}

Wyświetl plik

@ -108,10 +108,14 @@ bool telemetry_location_tx_allow(void)
}
/**
* Updates the current telemetry location based on the current lat/lon
*
* lat_i, lon_i in 100 nanodeg
*/
void telemetry_location_update(float lon, float lat)
void telemetry_location_update(int32_t lon_i, int32_t lat_i)
{
uint32_t outline;
float lat = lat_i / 10000000.0; /* degrees */
float lon = lon_i / 10000000.0; /* degrees */
/* Were we in a telemetry outline last time? */
if (current_no_telem_outline >= 0) {
@ -173,10 +177,14 @@ int32_t aprs_location_frequency(void)
}
/**
* Updates the aprs location based on the current lat/lon
*
* lat_i, lon_i in 100 nanodeg
*/
void aprs_location_update(float lon, float lat)
void aprs_location_update(int32_t lat_i, int32_t lon_i)
{
uint32_t z, outline;
float lat = lat_i / 10000000.0; /* degrees */
float lon = lon_i / 10000000.0; /* degrees */
/* Were we in an aprs zone last time? */
if (current_aprs_zone >= 0 && current_aprs_zone_outline >= 0) {

Wyświetl plik

@ -164,11 +164,8 @@ void aprs_telemetry(struct tracker_datapoint* dp) {
if (!gps_is_locked()) return; /* Don't bother with no GPS */
float lat = (float)dp->latitude / 10000000.0; /* degrees */
float lon = (float)dp->longitude / 10000000.0; /* degrees */
/* Update location */
aprs_location_update(lon, lat);
aprs_location_update(dp->longitude, dp->latitude);
#if APRS_USE_GEOFENCE
/* aprs okay here? */