Skip to content

Commit 53dee5b

Browse files
committed
Add GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
1 parent 1065db5 commit 53dee5b

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

CHANGELOG.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ All notable changes to this project will be documented in this file.
1212
- Berry `serial.read()` read only `n` bytes (#22835)
1313
- Display template for Waveshare ESP32-C6 LCD 1.47 (#22863)
1414
- Berry `tasmota.global.tele_period` and `tasmota.settings.tele_period` (#22865)
15-
- Command `PixelType` to change the WS2812 color order and channel number
16-
- Berry driver for AXP2102 and M5CoreS3
17-
- LVLG/HASPmota add color names from OpenHASP
15+
- ESP32 command `PixelType` to change the WS2812 color order and channel number (#22876)
16+
- Berry driver for AXP2102 and M5CoreS3 (#22878)
17+
- GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869)
18+
- LVLG/HASPmota add color names from OpenHASP (#22879)
1819

1920
### Breaking Changed
2021

RELEASENOTES.md

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

142146
### Breaking Changed
143147

tasmota/include/tasmota_template.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ const char kSensorNamesFixed[] PROGMEM =
533533
#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
534534
#define MAX_CSE7761 2 // Model 1/2 (DUALR3), 2/2 (POWCT)
535535
#define MAX_TWAI SOC_TWAI_CONTROLLER_NUM
536+
#define MAX_GPS_RX 3 // Baudrates 1 (9600), 2 (19200), 3 (38400)
536537

537538
const uint16_t kGpioNiceList[] PROGMEM = {
538539
GPIO_NONE, // Not used
@@ -1091,7 +1092,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
10911092
#endif
10921093
#ifdef USE_GPS
10931094
AGPIO(GPIO_GPS_TX), // GPS serial interface
1094-
AGPIO(GPIO_GPS_RX), // GPS serial interface
1095+
AGPIO(GPIO_GPS_RX) + AGMAX(MAX_GPS_RX), // GPS serial interface
10951096
#endif
10961097
#ifdef USE_HM10
10971098
AGPIO(GPIO_HM10_TX), // HM10 serial interface

tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino

+12-16
Original file line numberDiff line numberDiff line change
@@ -373,25 +373,21 @@ void UBXsendCFGLine(uint8_t _line)
373373

374374
/********************************************************************************************/
375375

376-
void UBXDetect(void)
377-
{
376+
void UBXDetect(void) {
378377
UBX.mode.init = 0;
379-
if (PinUsed(GPIO_GPS_RX) && PinUsed(GPIO_GPS_TX)) {
380-
UBXSerial = new TasmotaSerial(Pin(GPIO_GPS_RX), Pin(GPIO_GPS_TX), 1, 0, UBX_SERIAL_BUFFER_SIZE); // 64 byte buffer is NOT enough
381-
if (UBXSerial->begin(9600)) {
382-
DEBUG_SENSOR_LOG(PSTR("UBX: started serial"));
383-
if (UBXSerial->hardwareSerial()) {
384-
ClaimSerial();
385-
DEBUG_SENSOR_LOG(PSTR("UBX: claim HW"));
386-
}
378+
if (!(PinUsed(GPIO_GPS_RX, GPIO_ANY) && PinUsed(GPIO_GPS_TX))) { return; }
379+
380+
uint32_t option = GetPin(Pin(GPIO_GPS_RX, GPIO_ANY)) - AGPIO(GPIO_GPS_RX); // 0 .. 2
381+
uint32_t baudrate = 9600 << option; // Support 1 (9600), 2 (19200), 3 (38400)
382+
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
383+
if (!UBXSerial->begin(baudrate)) { return; }
384+
385+
if (UBXSerial->hardwareSerial()) {
386+
ClaimSerial();
387+
}
387388
#ifdef ESP32
388-
AddLog(LOG_LEVEL_DEBUG, PSTR("UBX: Serial UART%d"), UBXSerial->getUart());
389+
AddLog(LOG_LEVEL_DEBUG, PSTR("UBX: Serial UART%d"), UBXSerial->getUart());
389390
#endif
390-
}
391-
}
392-
else {
393-
return;
394-
}
395391

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

0 commit comments

Comments
 (0)