From 53dee5b0021bfb14995193b200c7feb8b8fc47aa Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 25 Jan 2025 14:15:11 +0100 Subject: [PATCH] Add GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) (#22869) --- CHANGELOG.md | 7 +++--- RELEASENOTES.md | 4 +++ tasmota/include/tasmota_template.h | 3 ++- tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino | 28 +++++++++------------ 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32ad7f015..13295e3de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f25b68090..09856138c 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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) @@ -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 diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index b53454b25..6d4226967 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -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 @@ -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 diff --git a/tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino b/tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino index 7da62a4d9..91a98c7bf 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_60_GPS.ino @@ -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;