Closed RomanTheLegend closed 1 year ago
Hey Roman! Thanks, good stuff.
Do you have any issues with passing the serial iteself? Like here: https://github.com/loginov-rocks/UbxGps/blob/main/examples/Mega_UbxGpsNavPvt.cpp#L20
UbxGpsNavPvt<HardwareSerial> gps(Serial3);
I'm using this block to init:
HardwareSerial SerialGPS(2);
UbxGpsNavPvt<HardwareSerial> gps(SerialGPS);
void setup()
{
Serial.begin(COMPUTER_BAUDRATE);
UbxGpsConfig<HardwareSerial, HardwareSerial> *ubxGpsConfig = new UbxGpsConfig<HardwareSerial, HardwareSerial>(SerialGPS, Serial);
ubxGpsConfig->setCustomPins(TX_PIN, RX_PIN);
ubxGpsConfig->setBaudrate(GPS_BAUDRATE);
ubxGpsConfig->setMessage(UbxGpsConfigMessage::NavPvt);
ubxGpsConfig->setRate(100);
ubxGpsConfig->configure();
delete ubxGpsConfig;
gps.begin(GPS_BAUDRATE, SERIAL_8N1, TX_PIN, RX_PIN);
}
I'm using TTGO T-Display board in which GPIO pins that ESP32 usually allocates for HardwareSerial are not present:
The default pins are Serial0 - RX: GPIO3 , TX: GPIO1 Serial1 - RX: GPIO9 , TX: GPIO10 Serial2 - RX: GPIO16 , TX: GPIO17
On vanilla EPS board this shouldn't be the problem
I suspect this PR should go together with the https://github.com/loginov-rocks/UbxGps/pull/28 because when I introduced a new method it might've extended class headers by 4 bytes so that broke checksum calculation
Sorry, it's still not clear to me what is the issue and why this solution should fix it.
UbxGps is a parser class, it is not required to define Serial communication, but rather use what is provided, otherwise, it will be a mix of responsibilities.
This change will break the class API and impact all its consumers, however, we can continue the discussion on issues.
I've run into a problem that the library doesn't work if I use custom pins on other platforms like ESP32 Couple of overrides to pass TX/RX pins as an argument to both config and begin blocks
Apologies in advance for not making code any prettier