i2c gps read fixes

This commit is contained in:
Klaus K Wilting 2018-06-17 19:03:49 +02:00
parent 500d7dd656
commit 706f90453f
4 changed files with 9 additions and 11 deletions

View File

@ -11,11 +11,11 @@
; ---> SELECT TARGET PLATFORM HERE! <--- ; ---> SELECT TARGET PLATFORM HERE! <---
[platformio] [platformio]
;env_default = heltec env_default = heltec
;env_default = ttgov1 ;env_default = ttgov1
;env_default = ttgov2 ;env_default = ttgov2
;env_default = ttgov21 ;env_default = ttgov21
env_default = ttgobeam ;env_default = ttgobeam
;env_default = lopy ;env_default = lopy
;env_default = lopy4 ;env_default = lopy4
;env_default = fipy ;env_default = fipy

View File

@ -24,7 +24,7 @@ void gps_loop(void *pvParameters) {
#if defined GPS_SERIAL #if defined GPS_SERIAL
HardwareSerial GPS_Serial(1); HardwareSerial GPS_Serial(1);
#elif defined GPS_QUECTEL_L76 #elif defined GPS_QUECTEL_L76
Wire.begin(GPS_QUECTEL_L76, 400000); // I2C connect to GPS device with 400 Wire.begin(GPS_QUECTEL_L76, 400000); // I2C connect to GPS device with 400 KHz
#endif #endif
while (1) { while (1) {
@ -47,16 +47,16 @@ void gps_loop(void *pvParameters) {
#elif defined GPS_QUECTEL_L76 #elif defined GPS_QUECTEL_L76
Wire.beginTransmission(GPS_I2C_ADDRESS_WRITE); Wire.beginTransmission(GPS_ADDR);
Wire.write(0x00); // dummy write to start read Wire.write(0x00); // dummy write to start read
Wire.endTransmission(); Wire.endTransmission();
Wire.beginTransmission(GPS_I2C_ADDRESS_READ); Wire.beginTransmission(GPS_ADDR);
while (cfg.gpsmode) { while (cfg.gpsmode) {
Wire.requestFrom(GPS_I2C_ADDRESS_READ, 32); Wire.requestFrom(GPS_ADDR | 0x01, 32);
while (Wire.available()) { while (Wire.available()) {
gps.encode(Wire.read()); gps.encode(Wire.read());
vTaskDelay(500 / portTICK_PERIOD_MS); // polling mode: 500ms sleep vTaskDelay(1 / portTICK_PERIOD_MS); // polling mode: 500ms sleep
} }
ESP_LOGI(TAG, "GPS NMEA data: passed %d / failed: %d / with fix: %d", ESP_LOGI(TAG, "GPS NMEA data: passed %d / failed: %d / with fix: %d",

View File

@ -9,8 +9,7 @@
// see http://www.quectel.com/UploadImage/Downlad/Quectel_L76-L_I2C_Application_Note_V1.0.pdf // see http://www.quectel.com/UploadImage/Downlad/Quectel_L76-L_I2C_Application_Note_V1.0.pdf
//#define HAS_GPS 1 //#define HAS_GPS 1
//#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21) //#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
//#define GPS_I2C_ADDRESS_READ 0x21 //#define GPS_ADDR 0x10
//#define GPS_I2C_ADDRESS_WRITE 0x20
//#define HAS_BUTTON GPIO_NUM_37 // (P14) //#define HAS_BUTTON GPIO_NUM_37 // (P14)
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown //#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown

View File

@ -9,8 +9,7 @@
// see http://www.quectel.com/UploadImage/Downlad/Quectel_L76-L_I2C_Application_Note_V1.0.pdf // see http://www.quectel.com/UploadImage/Downlad/Quectel_L76-L_I2C_Application_Note_V1.0.pdf
//#define HAS_GPS 1 //#define HAS_GPS 1
//#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21) //#define GPS_QUECTEL_L76 GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
//#define GPS_I2C_ADDRESS_READ 0x21 //#define GPS_ADDR 0x10
//#define GPS_I2C_ADDRESS_WRITE 0x20
//#define HAS_BUTTON GPIO_NUM_37 // (P14) //#define HAS_BUTTON GPIO_NUM_37 // (P14)
//#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown //#define BUTTON_PULLUP 1 // Button need pullup instead of default pulldown