kopia lustrzana https://github.com/bristol-seds/pico-tracker
Pass lon/lat to geofence update functions as 100 nanodeg int32_t instead of float
rodzic
3165b5dbbd
commit
8cff9a91fd
|
@ -29,11 +29,11 @@
|
||||||
#include "samd20.h"
|
#include "samd20.h"
|
||||||
|
|
||||||
bool telemetry_location_tx_allow(void);
|
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 latlon_in_aprs_zone(int32_t aprs_zone, int32_t aprs_zone_outline, float lon, float lat);
|
||||||
bool aprs_location_tx_allow(void);
|
bool aprs_location_tx_allow(void);
|
||||||
int32_t aprs_location_frequency(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 */
|
#endif /* LOCATION_H */
|
||||||
|
|
|
@ -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 */
|
if (gps_is_locked()) { /* Don't bother with no GPS */
|
||||||
|
|
||||||
float lat = (float)dp->latitude / 10000000.0; /* degrees */
|
telemetry_location_update(dp->longitude, dp->latitude);
|
||||||
float lon = (float)dp->longitude / 10000000.0; /* degrees */
|
|
||||||
|
|
||||||
telemetry_location_update(lon, lat);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,10 +108,14 @@ bool telemetry_location_tx_allow(void)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Updates the current telemetry location based on the current lat/lon
|
* 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;
|
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? */
|
/* Were we in a telemetry outline last time? */
|
||||||
if (current_no_telem_outline >= 0) {
|
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
|
* 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;
|
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? */
|
/* Were we in an aprs zone last time? */
|
||||||
if (current_aprs_zone >= 0 && current_aprs_zone_outline >= 0) {
|
if (current_aprs_zone >= 0 && current_aprs_zone_outline >= 0) {
|
||||||
|
|
|
@ -164,11 +164,8 @@ void aprs_telemetry(struct tracker_datapoint* dp) {
|
||||||
|
|
||||||
if (!gps_is_locked()) return; /* Don't bother with no GPS */
|
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 */
|
/* Update location */
|
||||||
aprs_location_update(lon, lat);
|
aprs_location_update(dp->longitude, dp->latitude);
|
||||||
|
|
||||||
#if APRS_USE_GEOFENCE
|
#if APRS_USE_GEOFENCE
|
||||||
/* aprs okay here? */
|
/* aprs okay here? */
|
||||||
|
|
Ładowanie…
Reference in New Issue