GPS testing (experimental)
This commit is contained in:
parent
600ba2bd71
commit
21c387c028
@ -7,8 +7,8 @@ static const char TAG[] = "main";
|
||||
|
||||
// read GPS data and cast to global struct
|
||||
void gps_read(){
|
||||
gps_status.latitude = (uint32_t) gps.location.lat() * 100;
|
||||
gps_status.longitude = (uint32_t) gps.location.lng() * 100;
|
||||
gps_status.latitude = (uint32_t) (gps.location.lat() * 1000000);
|
||||
gps_status.longitude = (uint32_t) (gps.location.lng() * 1000000);
|
||||
gps_status.satellites = (uint8_t) gps.satellites.value();
|
||||
gps_status.hdop = (uint16_t) gps.hdop.value();
|
||||
gps_status.altitude = (uint16_t) gps.altitude.meters();
|
||||
@ -19,7 +19,13 @@ void gps_loop(void * pvParameters) {
|
||||
|
||||
configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check
|
||||
|
||||
#ifdef GPS_SERIAL
|
||||
HardwareSerial GPS_Serial(1);
|
||||
#endif
|
||||
|
||||
#ifdef GPS_I2C
|
||||
// to be done
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
|
||||
|
@ -138,7 +138,7 @@ void do_send(osjob_t* j){
|
||||
if (cfg.gpsmode && gps.location.isValid()) {
|
||||
gps_read();
|
||||
LMIC_setTxData2(GPSPORT, (byte*)&gps_status, sizeof(gps_status), (cfg.countermode & 0x02));
|
||||
ESP_LOGI(TAG, "HDOP=%d, SATS=%d, LAT=%f, LON=%f", gps_status.hdop, gps_status.satellites, gps_status.latitude, gps_status.longitude );
|
||||
ESP_LOGI(TAG, "lat=%f / lon=%f | Sats=%u | HDOP=%u | Alti=%u", gps_status.latitude / 1000000, gps_status.longitude / 1000000, gps_status.satellites, gps_status.hdop, gps_status.altitude);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -262,7 +262,7 @@ void get_gps (uint8_t val) {
|
||||
#ifdef HAS_GPS
|
||||
gps_read();
|
||||
transmit((byte*)&gps_status, sizeof(gps_status));
|
||||
ESP_LOGI(TAG, "HDOP=%d, SATS=%d, LAT=%f, LON=%f", gps_status.hdop, gps_status.satellites, gps_status.latitude, gps_status.longitude );
|
||||
ESP_LOGI(TAG, "lat=%f / lon=%f | Sats=%u | HDOP=%u | Alti=%u", gps_status.latitude / 1000000, gps_status.longitude / 1000000, gps_status.satellites, gps_status.hdop, gps_status.altitude);
|
||||
#else
|
||||
ESP_LOGE(TAG, "GPS not present");
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user