Skip to content

Commit f1824e6

Browse files
committed
increase repeater max uptime from 49 days to 136 years
1 parent 6288a5d commit f1824e6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
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;

0 commit comments

Comments
 (0)