|
|
@ -20,12 +20,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace plugin {
|
|
|
|
namespace plugin {
|
|
|
|
uint32_t CycleTimeReport::next_report_time_;
|
|
|
|
uint16_t CycleTimeReport::last_report_time_;
|
|
|
|
uint32_t CycleTimeReport::loop_start_time_;
|
|
|
|
uint32_t CycleTimeReport::loop_start_time_;
|
|
|
|
uint32_t CycleTimeReport::average_loop_time;
|
|
|
|
uint32_t CycleTimeReport::average_loop_time;
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult CycleTimeReport::onSetup() {
|
|
|
|
EventHandlerResult CycleTimeReport::onSetup() {
|
|
|
|
next_report_time_ = millis() + 1000;
|
|
|
|
last_report_time_ = Kaleidoscope.millisAtCycleStart();
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -42,11 +42,11 @@ EventHandlerResult CycleTimeReport::afterEachCycle() {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
average_loop_time = loop_time;
|
|
|
|
average_loop_time = loop_time;
|
|
|
|
|
|
|
|
|
|
|
|
if (millis() >= next_report_time_) {
|
|
|
|
if (Kaleidoscope.hasTimeExpired(last_report_time_, uint16_t(1000))) {
|
|
|
|
cycleTimeReport();
|
|
|
|
cycleTimeReport();
|
|
|
|
|
|
|
|
|
|
|
|
average_loop_time = 0;
|
|
|
|
average_loop_time = 0;
|
|
|
|
next_report_time_ = millis() + 1000;
|
|
|
|
last_report_time_ = Kaleidoscope.millisAtCycleStart();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|