-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uptime to statistics menu #4397
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,8 @@ void buddy::metrics::RecordRuntimeStats() { | |
|
||
METRIC_DEF(heap, "heap", METRIC_VALUE_CUSTOM, 503, METRIC_HANDLER_ENABLE_ALL); | ||
metric_record_custom(&heap, " free=%zui,total=%zui", xPortGetFreeHeapSize(), static_cast<size_t>(heap_total_size)); | ||
|
||
RecordUptime(); | ||
} | ||
|
||
void buddy::metrics::RecordMarlinVariables() { | ||
|
@@ -352,4 +354,9 @@ void buddy::metrics::record_dwarf_internal_temperatures() { | |
} | ||
} | ||
} | ||
|
||
void buddy::metrics::RecordUptime() { | ||
METRIC_DEF(uptime, "uptime", METRIC_VALUE_INTEGER, 1000, METRIC_HANDLER_ENABLE_ALL); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "1000" there means that we would be sending the metric every second. I would say that is a bit wasteful. |
||
metric_record_integer(&uptime, ticks_s() / 3600); | ||
} | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,7 @@ void app_run(void) { | |
loop(); | ||
} | ||
marlin_server::loop(); | ||
buddy::metrics::RecordUptime(); // Pa465 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,14 @@ | |
#include "screen_menu_statistics.hpp" | ||
#include "DialogMoveZ.hpp" | ||
#include "img_resources.hpp" | ||
#include "app_metrics.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we including app_metrics here? |
||
|
||
ScreenMenuStatistics::ScreenMenuStatistics() | ||
: ScreenMenuStatistics__(_(label)) { | ||
EnableLongHoldScreenAction(); | ||
header.SetIcon(&img::info_16x16); | ||
AddItem(&uptime_label); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a valid code for adding menu items in the menu.
|
||
updateUptime(); | ||
} | ||
|
||
void ScreenMenuStatistics::windowEvent(window_t *sender, GUI_event_t event, void *param) { | ||
|
@@ -19,3 +22,9 @@ void ScreenMenuStatistics::windowEvent(window_t *sender, GUI_event_t event, void | |
|
||
ScreenMenu::windowEvent(sender, event, param); | ||
} | ||
|
||
void ScreenMenuStatistics::updateUptime() { | ||
char buffer[32]; | ||
snprintf(buffer, sizeof(buffer), "Uptime: %lu hours", ticks_s() / 3600); | ||
uptime_label.SetText(buffer); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snake_case
for functions as per https://github.com/prusa3d/Prusa-Firmware-Buddy/blob/master/doc/contributing.md