remove incompleted I2C gps support
This commit is contained in:
parent
2961948759
commit
02c29afca6
@ -19,13 +19,9 @@ TinyGPSCustom gpsyear(gps, "GPZDA", 4); // field 4 = year (4-digit)
|
|||||||
static const String ZDA_Request = "$EIGPQ,ZDA*39\r\n";
|
static const String ZDA_Request = "$EIGPQ,ZDA*39\r\n";
|
||||||
TaskHandle_t GpsTask;
|
TaskHandle_t GpsTask;
|
||||||
|
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
HardwareSerial GPS_Serial(1); // use UART #1
|
HardwareSerial GPS_Serial(1); // use UART #1
|
||||||
static uint16_t nmea_txDelay_ms =
|
static uint16_t nmea_txDelay_ms =
|
||||||
(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL) / portTICK_PERIOD_MS);
|
(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL) / portTICK_PERIOD_MS);
|
||||||
#else
|
|
||||||
static uint16_t nmea_txDelay_ms = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// helper functions to send UBX commands to ublox gps chip
|
// helper functions to send UBX commands to ublox gps chip
|
||||||
|
|
||||||
@ -35,28 +31,16 @@ void sendPacket(byte *packet, byte len) {
|
|||||||
uint8_t CK_A = 0;
|
uint8_t CK_A = 0;
|
||||||
uint8_t CK_B = 0;
|
uint8_t CK_B = 0;
|
||||||
|
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++)
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
GPS_Serial.write(packet[i]);
|
GPS_Serial.write(packet[i]);
|
||||||
#elif defined GPS_I2C
|
|
||||||
Wire.write(packet[i]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate Fletcher checksum
|
// calculate and send Fletcher checksum
|
||||||
for (int i = 2; i < len; i++) {
|
for (int i = 2; i < len; i++) {
|
||||||
CK_A += packet[i];
|
CK_A += packet[i];
|
||||||
CK_B += CK_A;
|
CK_B += CK_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send checksum
|
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
GPS_Serial.write(CK_A);
|
GPS_Serial.write(CK_A);
|
||||||
GPS_Serial.write(CK_B);
|
GPS_Serial.write(CK_B);
|
||||||
#elif defined GPS_I2C
|
|
||||||
Wire.write(CK_A);
|
|
||||||
Wire.write(CK_B);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a packet to the receiver to restore default configuration.
|
// Send a packet to the receiver to restore default configuration.
|
||||||
@ -189,7 +173,6 @@ int gps_init(void) {
|
|||||||
|
|
||||||
restoreDefaults();
|
restoreDefaults();
|
||||||
|
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
ESP_LOGI(TAG, "Opening serial GPS");
|
ESP_LOGI(TAG, "Opening serial GPS");
|
||||||
GPS_Serial.begin(GPS_SERIAL);
|
GPS_Serial.begin(GPS_SERIAL);
|
||||||
changeBaudrate(GPS_BAUDRATE);
|
changeBaudrate(GPS_BAUDRATE);
|
||||||
@ -197,18 +180,6 @@ int gps_init(void) {
|
|||||||
GPS_Serial.flush();
|
GPS_Serial.flush();
|
||||||
GPS_Serial.updateBaudRate(GPS_BAUDRATE);
|
GPS_Serial.updateBaudRate(GPS_BAUDRATE);
|
||||||
|
|
||||||
#elif defined GPS_I2C
|
|
||||||
ESP_LOGI(TAG, "Opening I2C GPS");
|
|
||||||
Wire.begin(GPS_I2C, 400000); // I2C connect to GPS device with 400 KHz
|
|
||||||
Wire.beginTransmission(GPS_ADDR);
|
|
||||||
Wire.write(0x00); // dummy write
|
|
||||||
if (Wire.endTransmission()) {
|
|
||||||
ESP_LOGE(TAG, "Quectel L76 GPS chip not found");
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
ESP_LOGI(TAG, "Quectel L76 GPS chip found");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
disableNmea();
|
disableNmea();
|
||||||
changeFrequency();
|
changeFrequency();
|
||||||
// enableNavTimeUTC();
|
// enableNavTimeUTC();
|
||||||
@ -242,13 +213,9 @@ bool gps_hasfix() {
|
|||||||
time_t get_gpstime(uint16_t *msec) {
|
time_t get_gpstime(uint16_t *msec) {
|
||||||
|
|
||||||
// poll NMEA ZDA sentence
|
// poll NMEA ZDA sentence
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
GPS_Serial.print(ZDA_Request);
|
GPS_Serial.print(ZDA_Request);
|
||||||
// wait for gps NMEA answer
|
// wait for gps NMEA answer
|
||||||
// vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL));
|
// vTaskDelay(tx_Ticks(NMEA_FRAME_SIZE, GPS_SERIAL));
|
||||||
#elif defined GPS_I2C
|
|
||||||
Wire.print(ZDA_Request);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// did we get a current date & time?
|
// did we get a current date & time?
|
||||||
if (gpstime.isValid()) {
|
if (gpstime.isValid()) {
|
||||||
@ -291,17 +258,10 @@ void gps_loop(void *pvParameters) {
|
|||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
while (cfg.payloadmask & GPS_DATA) {
|
while (cfg.payloadmask & GPS_DATA) {
|
||||||
#ifdef GPS_SERIAL
|
|
||||||
// feed GPS decoder with serial NMEA data from GPS device
|
// feed GPS decoder with serial NMEA data from GPS device
|
||||||
while (GPS_Serial.available())
|
while (GPS_Serial.available())
|
||||||
if (gps.encode(GPS_Serial.read()))
|
if (gps.encode(GPS_Serial.read()))
|
||||||
break; // NMEA sentence complete
|
break; // NMEA sentence complete
|
||||||
#elif defined GPS_I2C
|
|
||||||
Wire.requestFrom(GPS_ADDR, 32); // caution: this is a blocking call
|
|
||||||
while (Wire.available())
|
|
||||||
if (gps.encode(Wire.read()))
|
|
||||||
break; // NMEA sentence complete
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// (only) while device time is not set or unsynched, and we have a valid
|
// (only) while device time is not set or unsynched, and we have a valid
|
||||||
// GPS time, we call calibrateTime to poll time immeditately from GPS
|
// GPS time, we call calibrateTime to poll time immeditately from GPS
|
||||||
|
@ -20,11 +20,6 @@
|
|||||||
#define HAS_ANTENNA_SWITCH (16) // pin for switching wifi antenna
|
#define HAS_ANTENNA_SWITCH (16) // pin for switching wifi antenna
|
||||||
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
||||||
|
|
||||||
// uncomment this only if your LoPy runs on a PYTRACK BOARD
|
|
||||||
#define HAS_GPS 1
|
|
||||||
#define GPS_I2C GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
|
|
||||||
#define GPS_ADDR 0x10
|
|
||||||
|
|
||||||
// uncomment this only if your LoPy runs on a EXPANSION BOARD
|
// uncomment this only if your LoPy runs on a EXPANSION BOARD
|
||||||
//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED
|
//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED
|
||||||
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
#define HAS_ANTENNA_SWITCH (21) // pin for switching wifi antenna (P12)
|
#define HAS_ANTENNA_SWITCH (21) // pin for switching wifi antenna (P12)
|
||||||
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
#define WIFI_ANTENNA 0 // 0 = internal, 1 = external
|
||||||
|
|
||||||
// uncomment defines in this section ONLY if your LoPy lives on a PYTRACK BOARD
|
|
||||||
//#define HAS_GPS 1
|
|
||||||
//#define GPS_I2C GPIO_NUM_25, GPIO_NUM_26 // SDA (P22), SCL (P21)
|
|
||||||
//#define GPS_ADDR 0x10
|
|
||||||
|
|
||||||
// uncomment defines in this section ONLY if your LoPy lives on a EXPANSION BOARD
|
// uncomment defines in this section ONLY if your LoPy lives on a EXPANSION BOARD
|
||||||
//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED
|
//#define HAS_LED (12) // use if LoPy is on Expansion Board, this has a user LED
|
||||||
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
//#define LED_ACTIVE_LOW 1 // use if LoPy is on Expansion Board, this has a user LED
|
||||||
|
Loading…
Reference in New Issue
Block a user