Browse Source

RemoteIDModule: Format update time as h:mm:ss

muramura 3 năm trước cách đây
mục cha
commit
35bcb316d8
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      RemoteIDModule/status.cpp

+ 3 - 1
RemoteIDModule/status.cpp

@@ -190,11 +190,13 @@ String status_json(void)
     const uint32_t sec = now_s % 60;
     const uint32_t min = (now_s / 60) % 60;
     const uint32_t hr = (now_s / 3600) % 24;
+    char minsec_str[6] {};  // HOUR does not include. Because wired powered drones allow for longer flight times.
+    snprintf(minsec_str, sizeof(minsec_str), "%02d:%02d", min, sec);
     char githash[20];
     snprintf(githash, sizeof(githash), "(%08x)", GIT_VERSION);
     const json_table_t table[] = {
         { "STATUS:VERSION", String(FW_VERSION_MAJOR) + "." + String(FW_VERSION_MINOR) + " " + githash},
-        { "STATUS:UPTIME", String(hr) + ":" + String(min) + ":" + String(sec) },
+        { "STATUS:UPTIME", String(hr) + ":" + String(minsec_str) },
         { "STATUS:FREEMEM", String(ESP.getFreeHeap()) },
         { "BASICID:UAType", ENUM_MAP(uatype, UAS_data.BasicID[0].UAType) },
         { "BASICID:IDType", ENUM_MAP(idtype, UAS_data.BasicID[0].IDType) },