Skip to content

Commit 273a54f

Browse files
committed
increase room server max uptime from 49 days to 136 years
1 parent f1824e6 commit 273a54f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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;

0 commit comments

Comments
 (0)