Browse Source

Merge 12e3543fd4 into e8d3c53ba1

pull/2606/merge
tedder 22 hours ago
committed by GitHub
parent
commit
6c51fbcde7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      examples/simple_repeater/UITask.cpp
  2. 10
      examples/simple_repeater/UITask.h
  3. 3
      examples/simple_repeater/main.cpp
  4. 3
      src/helpers/CommonCLI.cpp
  5. 2
      src/helpers/sensors/EnvironmentSensorManager.cpp
  6. 1
      variants/station_g2/platformio.ini

13
examples/simple_repeater/UITask.cpp

@ -79,6 +79,19 @@ void UITask::renderCurrScreen() {
_display->setColor(DisplayDriver::GREEN); _display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name); _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 // freq / sf
_display->setCursor(0, 20); _display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW); _display->setColor(DisplayDriver::YELLOW);

10
examples/simple_repeater/UITask.h

@ -3,17 +3,27 @@
#include <helpers/ui/DisplayDriver.h> #include <helpers/ui/DisplayDriver.h>
#include <helpers/CommonCLI.h> #include <helpers/CommonCLI.h>
#if ENV_INCLUDE_GPS
#include <helpers/sensors/LocationProvider.h>
#endif
class UITask { class UITask {
DisplayDriver* _display; DisplayDriver* _display;
unsigned long _next_read, _next_refresh, _auto_off; unsigned long _next_read, _next_refresh, _auto_off;
int _prevBtnState; int _prevBtnState;
NodePrefs* _node_prefs; NodePrefs* _node_prefs;
char _version_info[32]; char _version_info[32];
#if ENV_INCLUDE_GPS
LocationProvider* _gps = nullptr;
#endif
void renderCurrScreen(); void renderCurrScreen();
public: public:
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; } UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version); 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(); void loop();
}; };

3
examples/simple_repeater/main.cpp

@ -93,6 +93,9 @@ void setup() {
#ifdef DISPLAY_CLASS #ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION); ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#if ENV_INCLUDE_GPS
ui_task.setGPS(sensors.getLocationProvider());
#endif
#endif #endif
// send out initial zero hop Advertisement to the mesh // send out initial zero hop Advertisement to the mesh

3
src/helpers/CommonCLI.cpp

@ -418,7 +418,8 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, char* command, char* re
bool enabled = l->isEnabled(); // is EN pin on ? bool enabled = l->isEnabled(); // is EN pin on ?
bool fix = l->isValid(); // has fix ? bool fix = l->isValid(); // has fix ?
int sats = l->satellitesCount(); 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) { if (enabled) {
sprintf(reply, "on, %s, %s, %d sats", sprintf(reply, "on, %s, %s, %d sats",
active?"active":"deactivated", active?"active":"deactivated",

2
src/helpers/sensors/EnvironmentSensorManager.cpp

@ -748,8 +748,10 @@ void EnvironmentSensorManager::initBasicGPS() {
MESH_DEBUG_PRINTLN("No GPS wake/reset pin found for this board. Continuing on..."); MESH_DEBUG_PRINTLN("No GPS wake/reset pin found for this board. Continuing on...");
#endif #endif
#ifndef ENV_SKIP_GPS_DETECT
// Give GPS a moment to power up and send data // Give GPS a moment to power up and send data
delay(1000); delay(1000);
#endif
// We'll consider GPS detected if we see any data on Serial1 // We'll consider GPS detected if we see any data on Serial1
#ifdef ENV_SKIP_GPS_DETECT #ifdef ENV_SKIP_GPS_DETECT

1
variants/station_g2/platformio.ini

@ -7,6 +7,7 @@ build_flags =
-I variants/station_g2 -I variants/station_g2
-I src/helpers/ui -I src/helpers/ui
-D STATION_G2 -D STATION_G2
-D ENV_SKIP_GPS_DETECT
-D USE_SX1262 -D USE_SX1262
-D RADIO_CLASS=CustomSX1262 -D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper -D WRAPPER_CLASS=CustomSX1262Wrapper

Loading…
Cancel
Save