Skip to content

Commit d1bbab9

Browse files
committed
Merge branch 'dev' of github.com:meshcore-dev/MeshCore into dev
2 parents a38418e + 61cd01d commit d1bbab9

File tree

8 files changed

+24
-5
lines changed

8 files changed

+24
-5
lines changed

examples/simple_repeater/MyMesh.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
149149
stats.n_packets_recv = radio_driver.getPacketsRecv();
150150
stats.n_packets_sent = radio_driver.getPacketsSent();
151151
stats.total_air_time_secs = getTotalAirTime() / 1000;
152-
stats.total_up_time_secs = _ms->getMillis() / 1000;
152+
stats.total_up_time_secs = uptime_millis / 1000;
153153
stats.n_sent_flood = getNumSentFlood();
154154
stats.n_sent_direct = getNumSentDirect();
155155
stats.n_recv_flood = getNumRecvFlood();
@@ -594,6 +594,8 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
594594
, bridge(&_prefs, _mgr, &rtc)
595595
#endif
596596
{
597+
last_millis = 0;
598+
uptime_millis = 0;
597599
next_local_advert = next_flood_advert = 0;
598600
dirty_contacts_expiry = 0;
599601
set_radio_at = revert_radio_at = 0;
@@ -891,4 +893,9 @@ void MyMesh::loop() {
891893
acl.save(_fs);
892894
dirty_contacts_expiry = 0;
893895
}
896+
897+
// update uptime
898+
uint32_t now = millis();
899+
uptime_millis += now - last_millis;
900+
last_millis = now;
894901
}

examples/simple_repeater/MyMesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ struct NeighbourInfo {
7878

7979
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
8080
FILESYSTEM* _fs;
81+
uint32_t last_millis;
82+
uint64_t uptime_millis;
8183
unsigned long next_local_advert, next_flood_advert;
8284
bool _logging;
8385
NodePrefs _prefs;

examples/simple_room_server/MyMesh.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int MyMesh::handleRequest(ClientInfo *sender, uint32_t sender_timestamp, uint8_t
144144
stats.n_packets_recv = radio_driver.getPacketsRecv();
145145
stats.n_packets_sent = radio_driver.getPacketsSent();
146146
stats.total_air_time_secs = getTotalAirTime() / 1000;
147-
stats.total_up_time_secs = _ms->getMillis() / 1000;
147+
stats.total_up_time_secs = uptime_millis / 1000;
148148
stats.n_sent_flood = getNumSentFlood();
149149
stats.n_sent_direct = getNumSentDirect();
150150
stats.n_recv_flood = getNumRecvFlood();
@@ -581,6 +581,8 @@ MyMesh::MyMesh(mesh::MainBoard &board, mesh::Radio &radio, mesh::MillisecondCloc
581581
mesh::RTCClock &rtc, mesh::MeshTables &tables)
582582
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
583583
_cli(board, rtc, sensors, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4) {
584+
last_millis = 0;
585+
uptime_millis = 0;
584586
next_local_advert = next_flood_advert = 0;
585587
dirty_contacts_expiry = 0;
586588
_logging = false;
@@ -858,4 +860,9 @@ void MyMesh::loop() {
858860
}
859861

860862
// TODO: periodically check for OLD/inactive entries in known_clients[], and evict
863+
864+
// update uptime
865+
uint32_t now = millis();
866+
uptime_millis += now - last_millis;
867+
last_millis = now;
861868
}

examples/simple_room_server/MyMesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ struct PostInfo {
8888

8989
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
9090
FILESYSTEM* _fs;
91+
uint32_t last_millis;
92+
uint64_t uptime_millis;
9193
unsigned long next_local_advert, next_flood_advert;
9294
bool _logging;
9395
NodePrefs _prefs;

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lib_deps =
2222
rweather/Crypto @ ^0.4.0
2323
adafruit/RTClib @ ^2.1.3
2424
melopero/Melopero RV3028 @ ^1.1.0
25-
electroniccats/CayenneLPP @ 1.4.0
25+
electroniccats/CayenneLPP @ 1.6.1
2626
build_flags = -w -DNDEBUG -DRADIOLIB_STATIC_ONLY=1 -DRADIOLIB_GODMODE=1
2727
-D LORA_FREQ=869.525
2828
-D LORA_BW=250

variants/heltec_t114/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ build_flags =
170170
-D MAX_CONTACTS=350
171171
-D MAX_GROUP_CHANNELS=40
172172
-D BLE_PIN_CODE=123456
173+
-D ENV_INCLUDE_GPS=1 ; enable the GPS page in UI
173174
; -D BLE_DEBUG_LOGGING=1
174175
-D OFFLINE_QUEUE_SIZE=256
175176
; -D MESH_PACKET_LOGGING=1

variants/heltec_t114/target.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,10 @@ bool T114SensorManager::begin() {
7474

7575
if (gps_detected) {
7676
MESH_DEBUG_PRINTLN("GPS detected");
77-
digitalWrite(GPS_EN, LOW); // Power off GPS until the setting is changed
7877
} else {
7978
MESH_DEBUG_PRINTLN("No GPS detected");
80-
digitalWrite(GPS_EN, LOW);
8179
}
80+
digitalWrite(GPS_EN, LOW); // Power off GPS until the setting is changed
8281

8382
return true;
8483
}

variants/heltec_t114/target.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class T114SensorManager : public SensorManager {
3030
bool begin() override;
3131
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
3232
void loop() override;
33+
LocationProvider* getLocationProvider() override { return gps_detected ? _location : NULL; }
3334
int getNumSettings() const override;
3435
const char* getSettingName(int i) const override;
3536
const char* getSettingValue(int i) const override;

0 commit comments

Comments
 (0)