Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/simple_repeater/UITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ void UITask::renderCurrScreen() {
_display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name);

#if ENV_INCLUDE_GPS
if (_gps && _gps->isEnabled()) {
_display->setCursor(0, 10);
_display->setColor(DisplayDriver::YELLOW);
if (_gps->isValid()) {
sprintf(tmp, "GPS: fix %ld sat", _gps->satellitesCount());
} else {
sprintf(tmp, "GPS: no fix %ld sat", _gps->satellitesCount());
}
_display->print(tmp);
}
#endif

// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
Expand Down
10 changes: 10 additions & 0 deletions examples/simple_repeater/UITask.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@
#include <helpers/ui/DisplayDriver.h>
#include <helpers/CommonCLI.h>

#if ENV_INCLUDE_GPS
#include <helpers/sensors/LocationProvider.h>
#endif

class UITask {
DisplayDriver* _display;
unsigned long _next_read, _next_refresh, _auto_off;
int _prevBtnState;
NodePrefs* _node_prefs;
char _version_info[32];
#if ENV_INCLUDE_GPS
LocationProvider* _gps = nullptr;
#endif

void renderCurrScreen();
public:
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
#if ENV_INCLUDE_GPS
void setGPS(LocationProvider* gps) { _gps = gps; }
#endif

void loop();
};
3 changes: 3 additions & 0 deletions examples/simple_repeater/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ void setup() {

#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#if ENV_INCLUDE_GPS
ui_task.setGPS(sensors.getLocationProvider());
#endif
#endif

// send out initial zero hop Advertisement to the mesh
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/CommonCLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
bool enabled = l->isEnabled(); // is EN pin on ?
bool fix = l->isValid(); // has fix ?
int sats = l->satellitesCount();
bool active = !strcmp(_sensors->getSettingByKey("gps"), "1");
const char* gps_val = _sensors->getSettingByKey("gps");
bool active = (gps_val != NULL) && !strcmp(gps_val, "1");
if (enabled) {
sprintf(reply, "on, %s, %s, %d sats",
active?"active":"deactivated",
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/sensors/EnvironmentSensorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,10 @@ void EnvironmentSensorManager::initBasicGPS() {
MESH_DEBUG_PRINTLN("No GPS wake/reset pin found for this board. Continuing on...");
#endif

#ifndef ENV_SKIP_GPS_DETECT
// Give GPS a moment to power up and send data
delay(1000);
#endif

// We'll consider GPS detected if we see any data on Serial1
#ifdef ENV_SKIP_GPS_DETECT
Expand Down
1 change: 1 addition & 0 deletions variants/station_g2/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build_flags =
-I variants/station_g2
-I src/helpers/ui
-D STATION_G2
-D ENV_SKIP_GPS_DETECT
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
Expand Down