GPS integration now fully functional

This commit is contained in:
Klaus K Wilting 2018-06-10 16:00:11 +02:00
parent aa1b4172fe
commit e30e133bf1
4 changed files with 18 additions and 16 deletions

View File

@ -104,15 +104,13 @@ Legend for RGB LED (LoPy/LoPy4/FiPy/Lolin32 only):
LoRaWAN Port #1:
byte 1: Paxcount Wifi, MSB
byte 2: Paxcount WiFi, LSB
byte 3: Paxcount Bluetooth, MSB
byte 4: Paxcount Bluetooth, LSB
byte 1-2: Number of unique pax, first seen on Wifi
byte 3-4: Number of unique pax, first seen on Bluetooth [0 if BT disabled]
bytes 5-8: GPS latitude
bytes 9-12: GPS longitude
bytes 13-14: GPS satellites
bytes 13-14: GPS number of satellites
bytes 15-16: GPS HDOP
bytes 17-18: GPS altitude
bytes 17-18: GPS altitude [meter]
LoRaWAN Port #2:
@ -281,13 +279,13 @@ device answers with it's current configuration. The configuration is a C structu
bytes 1-2: battery voltage in millivolt, 0 if unreadable (little endian format)
0x84 get device GPS status (NOT YET IMPLEMENTED)
0x84 get device GPS status
bytes 1-4: latitude
bytes 5-8: longitude
byte 9: number of satellites
byte 10: HDOP
bytes 11-12: altidute [meter]
byte 9-10: number of satellites
byte 11-12: HDOP
bytes 13-14: altidute [meter]
# License

View File

@ -32,8 +32,7 @@ lib_deps_display =
lib_deps_rgbled =
SmartLeds@>=1.1.3
lib_deps_gps =
https://github.com/mikalhart/TinyGPSPlus.git
;beware of TinyGPSplus in PlatformIO library manager, it loads old v.092 labeled as 1.0.0 !!
TinyGPSPlus@>=1.0.2
build_flags =
; we need build_flag for logging, otherwise we can't use ESP_LOGx in arduino framework
; ---> NOTE: For production run set DEBUG_LEVEL level to NONE! <---

View File

@ -133,9 +133,14 @@ void do_send(osjob_t* j){
static uint8_t gpsdata[18];
if (cfg.gpsmode && gps.location.isValid()) {
gps_read();
memcpy (gpsdata+4, &gps_status, sizeof(gps_status));
memcpy (gpsdata, mydata, 4);
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);
memcpy (gpsdata+4, &gps_status, sizeof(gps_status));
ESP_LOGI(TAG, "lat=%.6f / lon=%.6f | %u Sats | HDOP=%.1f | Altitude=%u m", \
gps_status.latitude / (float) 1000000, \
gps_status.longitude / (float) 1000000, \
gps_status.satellites, \
gps_status.hdop / (float) 100, \
gps_status.altitude);
LMIC_setTxData2(COUNTERPORT, gpsdata, sizeof(gpsdata), (cfg.countermode & 0x02));
ESP_LOGI(TAG, "%d bytes queued to send", sizeof(gpsdata));
}

View File

@ -630,7 +630,7 @@ void loop() {
}
if ( (uptime() % 10000) == 0 )
ESP_LOGI(TAG, "GPS NMEA data: passed %d / failed: %d / with fix: %d", gps.passedChecksum(), gps.failedChecksum(), gps.sentencesWithFix());
ESP_LOGD(TAG, "GPS NMEA data: passed %d / failed: %d / with fix: %d", gps.passedChecksum(), gps.failedChecksum(), gps.sentencesWithFix());
vTaskDelay(1/portTICK_PERIOD_MS); // reset watchdog