* RAK4632 targets, now requiring ENV_INCLUDE_GPS to enable GPS
This commit is contained in:
@@ -97,6 +97,29 @@ lib_deps =
|
|||||||
${rak4631.lib_deps}
|
${rak4631.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
[env:RAK_4631_GPS_companion_radio_ble]
|
||||||
|
extends = rak4631
|
||||||
|
build_flags =
|
||||||
|
${rak4631.build_flags}
|
||||||
|
-D DISPLAY_CLASS=SSD1306Display
|
||||||
|
-D MAX_CONTACTS=100
|
||||||
|
-D MAX_GROUP_CHANNELS=8
|
||||||
|
-D BLE_PIN_CODE=123456
|
||||||
|
-D BLE_DEBUG_LOGGING=1
|
||||||
|
-D OFFLINE_QUEUE_SIZE=256
|
||||||
|
-D ENV_INCLUDE_GPS=1
|
||||||
|
; -D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||||
|
; -D ENABLE_PRIVATE_KEY_EXPORT=1
|
||||||
|
; -D MESH_PACKET_LOGGING=1
|
||||||
|
; -D MESH_DEBUG=1
|
||||||
|
build_src_filter = ${rak4631.build_src_filter}
|
||||||
|
+<helpers/ui/SSD1306Display.cpp>
|
||||||
|
+<helpers/nrf52/SerialBLEInterface.cpp>
|
||||||
|
+<../examples/companion_radio>
|
||||||
|
lib_deps =
|
||||||
|
${rak4631.lib_deps}
|
||||||
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:RAK_4631_terminal_chat]
|
[env:RAK_4631_terminal_chat]
|
||||||
extends = rak4631
|
extends = rak4631
|
||||||
build_flags =
|
build_flags =
|
||||||
|
|||||||
@@ -11,8 +11,13 @@ WRAPPER_CLASS radio_driver(radio, board);
|
|||||||
|
|
||||||
VolatileRTCClock fallback_clock;
|
VolatileRTCClock fallback_clock;
|
||||||
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Wire);
|
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Wire);
|
||||||
RAK4631SensorManager sensors = RAK4631SensorManager(nmea);
|
RAK4631SensorManager sensors = RAK4631SensorManager(nmea);
|
||||||
|
#else
|
||||||
|
RAK4631SensorManager sensors;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
DISPLAY_CLASS display;
|
DISPLAY_CLASS display;
|
||||||
@@ -68,22 +73,6 @@ void scanDevices(TwoWire *w)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool readStringUntil(Stream& s, char dest[], size_t max_len, char term, unsigned int timeout_millis) {
|
|
||||||
unsigned long timeout = millis() + timeout_millis;
|
|
||||||
char *dp = dest;
|
|
||||||
while (millis() < timeout && dp - dest < max_len - 1) {
|
|
||||||
if (s.available()) {
|
|
||||||
char c = s.read();
|
|
||||||
if (c == term) break;
|
|
||||||
*dp++ = c; // append to dest[]
|
|
||||||
} else {
|
|
||||||
delay(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*dp = 0; // null terminator
|
|
||||||
return millis() < timeout; // false, if timed out
|
|
||||||
}
|
|
||||||
|
|
||||||
bool radio_init() {
|
bool radio_init() {
|
||||||
rtc_clock.begin(Wire);
|
rtc_clock.begin(Wire);
|
||||||
|
|
||||||
@@ -132,6 +121,7 @@ void radio_set_tx_power(uint8_t dbm) {
|
|||||||
radio.setOutputPower(dbm);
|
radio.setOutputPower(dbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
void RAK4631SensorManager::start_gps()
|
void RAK4631SensorManager::start_gps()
|
||||||
{
|
{
|
||||||
//function currently not used
|
//function currently not used
|
||||||
@@ -187,6 +177,7 @@ bool RAK4631SensorManager::gpsIsAwake(uint32_t ioPin){
|
|||||||
//digitalWrite(ioPin,pinInitialState); //reset the IO pin to initial state
|
//digitalWrite(ioPin,pinInitialState); //reset the IO pin to initial state
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool RAK4631SensorManager::begin() {
|
bool RAK4631SensorManager::begin() {
|
||||||
|
|
||||||
@@ -194,6 +185,7 @@ bool RAK4631SensorManager::begin() {
|
|||||||
scanDevices(&Wire);
|
scanDevices(&Wire);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
//search for the correct IO standby pin depending on socket used
|
//search for the correct IO standby pin depending on socket used
|
||||||
if(gpsIsAwake(P_GPS_STANDBY_A)){
|
if(gpsIsAwake(P_GPS_STANDBY_A)){
|
||||||
MESH_DEBUG_PRINTLN("GPS is on socket A");
|
MESH_DEBUG_PRINTLN("GPS is on socket A");
|
||||||
@@ -213,8 +205,10 @@ bool RAK4631SensorManager::begin() {
|
|||||||
|
|
||||||
//Now that GPS is found and set up, set to sleep for initial state
|
//Now that GPS is found and set up, set to sleep for initial state
|
||||||
stop_gps();
|
stop_gps();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
bool RAK4631SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
bool RAK4631SensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
|
||||||
if (requester_permissions & TELEM_PERM_LOCATION && gps_active) { // does requester have permission?
|
if (requester_permissions & TELEM_PERM_LOCATION && gps_active) { // does requester have permission?
|
||||||
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
|
||||||
@@ -261,6 +255,7 @@ bool RAK4631SensorManager::setSettingValue(const char* name, const char* value)
|
|||||||
}
|
}
|
||||||
return false; // not supported
|
return false; // not supported
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mesh::LocalIdentity radio_new_identity() {
|
mesh::LocalIdentity radio_new_identity() {
|
||||||
RadioNoiseListener rng(radio);
|
RadioNoiseListener rng(radio);
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/AutoDiscoverRTCClock.h>
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
#include <helpers/SensorManager.h>
|
#include <helpers/SensorManager.h>
|
||||||
#include <helpers/sensors/LocationProvider.h>
|
#if ENV_INCLUDE_GPS
|
||||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
#include <helpers/sensors/LocationProvider.h>
|
||||||
|
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
|
||||||
|
#endif
|
||||||
#ifdef DISPLAY_CLASS
|
#ifdef DISPLAY_CLASS
|
||||||
#include <helpers/ui/SSD1306Display.h>
|
#include <helpers/ui/SSD1306Display.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -16,6 +18,7 @@
|
|||||||
#define _BV(x) (1 << x)
|
#define _BV(x) (1 << x)
|
||||||
|
|
||||||
class RAK4631SensorManager: public SensorManager {
|
class RAK4631SensorManager: public SensorManager {
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
bool gps_active = false;
|
bool gps_active = false;
|
||||||
bool gps_present = false;
|
bool gps_present = false;
|
||||||
LocationProvider * _nmea;
|
LocationProvider * _nmea;
|
||||||
@@ -27,17 +30,23 @@ class RAK4631SensorManager: public SensorManager {
|
|||||||
void sleep_gps();
|
void sleep_gps();
|
||||||
void wake_gps();
|
void wake_gps();
|
||||||
bool gpsIsAwake(uint32_t ioPin);
|
bool gpsIsAwake(uint32_t ioPin);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
#if ENV_INCLUDE_GPS
|
||||||
RAK4631SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
RAK4631SensorManager(LocationProvider &nmea): _nmea(&nmea) { }
|
||||||
bool begin() override;
|
|
||||||
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
int getNumSettings() const override;
|
int getNumSettings() const override;
|
||||||
const char* getSettingName(int i) const override;
|
const char* getSettingName(int i) const override;
|
||||||
const char* getSettingValue(int i) const override;
|
const char* getSettingValue(int i) const override;
|
||||||
bool setSettingValue(const char* name, const char* value) override;
|
bool setSettingValue(const char* name, const char* value) override;
|
||||||
};
|
#else
|
||||||
|
RAK4631SensorManager() { }
|
||||||
|
#endif
|
||||||
|
bool begin() override;
|
||||||
|
};
|
||||||
|
|
||||||
extern RAK4631Board board;
|
extern RAK4631Board board;
|
||||||
extern WRAPPER_CLASS radio_driver;
|
extern WRAPPER_CLASS radio_driver;
|
||||||
|
|||||||
Reference in New Issue
Block a user