@@ -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}
0 commit comments