Skip to content

Commit

Permalink
Add GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 …
Browse files Browse the repository at this point in the history
…(19200bps) or GPS_RX3 (38400bps) (arendst#22869)
  • Loading branch information
arendst committed Jan 25, 2025
1 parent 1065db5 commit 53dee5b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ All notable changes to this project will be documented in this file.
- Berry `serial.read()` read only `n` bytes (#22835)
- Display template for Waveshare ESP32-C6 LCD 1.47 (#22863)
- Berry `tasmota.global.tele_period` and `tasmota.settings.tele_period` (#22865)
- Command `PixelType` to change the WS2812 color order and channel number
- Berry driver for AXP2102 and M5CoreS3
- LVLG/HASPmota add color names from OpenHASP
- ESP32 command `PixelType` to change the WS2812 color order and channel number (#22876)
- Berry driver for AXP2102 and M5CoreS3 (#22878)
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
- LVLG/HASPmota add color names from OpenHASP (#22879)

### Breaking Changed

Expand Down
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Support for PCF85063 RTC [#22727](https://github.com/arendst/Tasmota/issues/22727)
- Support for Senseair S88 CO2 sensor [#22733](https://github.com/arendst/Tasmota/issues/22733)
- Support for ESP32 Two-Wire Automotive Interface (TWAI) or Controller Area Network (CAN) busses
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) [#22869](https://github.com/arendst/Tasmota/issues/22869)
- I2S AAC support for web radio [#22787](https://github.com/arendst/Tasmota/issues/22787)
- I2S Opus stream and file support for opus/aac [#22795](https://github.com/arendst/Tasmota/issues/22795)
- ESP32 command `PixelType` to change the WS2812 color order and channel number [#22876](https://github.com/arendst/Tasmota/issues/22876)
- ESP32 TasmotaLED change dynamically the number of pixels [#22754](https://github.com/arendst/Tasmota/issues/22754)
- ESP32 expand `Pixels` with reverse, height and alternate [#22755](https://github.com/arendst/Tasmota/issues/22755)
- Display template for Waveshare ESP32-C6 LCD 1.47 [#22863](https://github.com/arendst/Tasmota/issues/22863)
Expand All @@ -138,6 +140,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Berry WS2812 real-time Leds panel as app [#22788](https://github.com/arendst/Tasmota/issues/22788)
- Berry `serial.read()` read only `n` bytes [#22835](https://github.com/arendst/Tasmota/issues/22835)
- Berry `tasmota.global.tele_period` and `tasmota.settings.tele_period` [#22865](https://github.com/arendst/Tasmota/issues/22865)
- Berry driver for AXP2102 and M5CoreS3 [#22878](https://github.com/arendst/Tasmota/issues/22878)
- LVLG/HASPmota add color names from OpenHASP [#22879](https://github.com/arendst/Tasmota/issues/22879)

### Breaking Changed

Expand Down
3 changes: 2 additions & 1 deletion tasmota/include/tasmota_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ const char kSensorNamesFixed[] PROGMEM =
#define MAX_BL0942_RX 8 // Baudrates 1/5 (4800), 2/6 (9600), 3/7 (19200), 4/8 (38400), Support Positive values only 1..4, Support also negative values 5..8
#define MAX_CSE7761 2 // Model 1/2 (DUALR3), 2/2 (POWCT)
#define MAX_TWAI SOC_TWAI_CONTROLLER_NUM
#define MAX_GPS_RX 3 // Baudrates 1 (9600), 2 (19200), 3 (38400)

const uint16_t kGpioNiceList[] PROGMEM = {
GPIO_NONE, // Not used
Expand Down Expand Up @@ -1091,7 +1092,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
#endif
#ifdef USE_GPS
AGPIO(GPIO_GPS_TX), // GPS serial interface
AGPIO(GPIO_GPS_RX), // GPS serial interface
AGPIO(GPIO_GPS_RX) + AGMAX(MAX_GPS_RX), // GPS serial interface
#endif
#ifdef USE_HM10
AGPIO(GPIO_HM10_TX), // HM10 serial interface
Expand Down
28 changes: 12 additions & 16 deletions tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -373,25 +373,21 @@ void UBXsendCFGLine(uint8_t _line)

/********************************************************************************************/

void UBXDetect(void)
{
void UBXDetect(void) {
UBX.mode.init = 0;
if (PinUsed(GPIO_GPS_RX) && PinUsed(GPIO_GPS_TX)) {
UBXSerial = new TasmotaSerial(Pin(GPIO_GPS_RX), Pin(GPIO_GPS_TX), 1, 0, UBX_SERIAL_BUFFER_SIZE); // 64 byte buffer is NOT enough
if (UBXSerial->begin(9600)) {
DEBUG_SENSOR_LOG(PSTR("UBX: started serial"));
if (UBXSerial->hardwareSerial()) {
ClaimSerial();
DEBUG_SENSOR_LOG(PSTR("UBX: claim HW"));
}
if (!(PinUsed(GPIO_GPS_RX, GPIO_ANY) && PinUsed(GPIO_GPS_TX))) { return; }

uint32_t option = GetPin(Pin(GPIO_GPS_RX, GPIO_ANY)) - AGPIO(GPIO_GPS_RX); // 0 .. 2
uint32_t baudrate = 9600 << option; // Support 1 (9600), 2 (19200), 3 (38400)
UBXSerial = new TasmotaSerial(Pin(GPIO_GPS_RX, GPIO_ANY), Pin(GPIO_GPS_TX), 1, 0, UBX_SERIAL_BUFFER_SIZE); // 64 byte buffer is NOT enough
if (!UBXSerial->begin(baudrate)) { return; }

if (UBXSerial->hardwareSerial()) {
ClaimSerial();
}
#ifdef ESP32
AddLog(LOG_LEVEL_DEBUG, PSTR("UBX: Serial UART%d"), UBXSerial->getUart());
AddLog(LOG_LEVEL_DEBUG, PSTR("UBX: Serial UART%d"), UBXSerial->getUart());
#endif
}
}
else {
return;
}

UBXinitCFG(); // turn off NMEA, only use "our" UBX-messages
UBX.mode.init = 1;
Expand Down

0 comments on commit 53dee5b

Please sign in to comment.