mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-08 05:31:25 +00:00
Adds real GPS support to Raspberry Pi arch
This commit is contained in:
parent
ce8342d3e5
commit
423b8ad603
@ -33,3 +33,8 @@ Lora:
|
|||||||
|
|
||||||
GPIO:
|
GPIO:
|
||||||
# User: 6
|
# User: 6
|
||||||
|
|
||||||
|
# Define GPS
|
||||||
|
|
||||||
|
GPS:
|
||||||
|
# SerialPath: /dev/ttyS0
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "ubx.h"
|
#include "ubx.h"
|
||||||
|
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
|
#include "PortduinoGlue.h"
|
||||||
#include "meshUtils.h"
|
#include "meshUtils.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#endif
|
#endif
|
||||||
@ -15,11 +16,8 @@
|
|||||||
#define GPS_RESET_MODE HIGH
|
#define GPS_RESET_MODE HIGH
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32)
|
#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(ARCH_RASPBERRY_PI)
|
||||||
HardwareSerial *GPS::_serial_gps = &Serial1;
|
HardwareSerial *GPS::_serial_gps = &Serial1;
|
||||||
#elif defined(ARCH_RASPBERRY_PI)
|
|
||||||
// need a translation layer to make _serial_gps work with pigpio https://abyz.me.uk/rpi/pigpio/cif.html#serOpen
|
|
||||||
HardwareSerial *GPS::_serial_gps = NULL;
|
|
||||||
#else
|
#else
|
||||||
HardwareSerial *GPS::_serial_gps = NULL;
|
HardwareSerial *GPS::_serial_gps = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -907,6 +905,10 @@ GPS *GPS::createGps()
|
|||||||
#if defined(PIN_GPS_EN)
|
#if defined(PIN_GPS_EN)
|
||||||
if (!_en_gpio)
|
if (!_en_gpio)
|
||||||
_en_gpio = PIN_GPS_EN;
|
_en_gpio = PIN_GPS_EN;
|
||||||
|
#endif
|
||||||
|
#ifdef ARCH_RASPBERRY_PI
|
||||||
|
if (!settingsMap[has_gps])
|
||||||
|
return nullptr;
|
||||||
#endif
|
#endif
|
||||||
if (!_rx_gpio || !_serial_gps) // Configured to have no GPS at all
|
if (!_rx_gpio || !_serial_gps) // Configured to have no GPS at all
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -147,6 +147,13 @@ void portduinoSetup()
|
|||||||
if (yamlConfig["GPIO"]) {
|
if (yamlConfig["GPIO"]) {
|
||||||
settingsMap[user] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
settingsMap[user] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
||||||
}
|
}
|
||||||
|
if (yamlConfig["GPS"]) {
|
||||||
|
std::string serialPath = yamlConfig["GPS"]["SerialPath"].as<std::string>("");
|
||||||
|
if (serialPath != "") {
|
||||||
|
Serial1.setPath(serialPath);
|
||||||
|
settingsMap[has_gps] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (YAML::Exception e) {
|
} catch (YAML::Exception e) {
|
||||||
std::cout << "*** Exception " << e.what() << std::endl;
|
std::cout << "*** Exception " << e.what() << std::endl;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
extern std::map<int, int> settingsMap;
|
extern std::map<int, int> settingsMap;
|
||||||
|
|
||||||
enum { use_sx1262, cs, irq, busy, reset, dio2_as_rf_switch, use_rf95, user, gpiochip };
|
enum { use_sx1262, cs, irq, busy, reset, dio2_as_rf_switch, use_rf95, user, gpiochip, has_gps };
|
||||||
int initGPIOPin(int pinNum, std::string gpioChipname);
|
int initGPIOPin(int pinNum, std::string gpioChipname);
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user