Skip to content

Commit

Permalink
added uptime command to the quick command list
Browse files Browse the repository at this point in the history
  • Loading branch information
gigapod committed Mar 7, 2024
1 parent f49a51e commit 34ba2cc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/relnotes/rn_v010200.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ The following commands are supported:
| !save-settings | Save the current settings to on-board flash |
| !sdcard | Output the current SD card usage statistics |
| !systime | Output current system time |
| !uptime | The uptime of the device |
| !wifi | Output current system WiFi state |

#### Log Data Rate
Expand Down
24 changes: 24 additions & 0 deletions sfeDataLoggerIoT/sfeDLCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,29 @@ class sfeDLCommands

return true;
}

//---------------------------------------------------------------------
///
/// @brief outputs uptime
///
/// @param dlApp Pointer to the DataLogger App
/// @retval bool indicates success (true) or failure (!true)
///
bool outputUpTime(sfeDataLogger *dlApp)
{
if (!dlApp)
return false;

// uptime
uint32_t days, hours, minutes, secs, mills;

flx_utils::uptime(days, hours, minutes, secs, mills);

flxLog_I("Uptime: %u days, %02u:%02u:%02u.%u", days, hours, minutes, secs, mills);

return true;
}

//---------------------------------------------------------------------
// our command map - command name to callback method
commandMap_t _commandMap = {
Expand All @@ -406,6 +429,7 @@ class sfeDLCommands
{"debug-output", &sfeDLCommands::logLevelDebug},
{"verbose-output", &sfeDLCommands::logLevelVerbose},
{"systime", &sfeDLCommands::outputSystemTime},
{"uptime", &sfeDLCommands::outputUpTime},
{"about", &sfeDLCommands::aboutDevice},
{"help", &sfeDLCommands::helpDevice},
};
Expand Down

0 comments on commit 34ba2cc

Please sign in to comment.