From 46ff02ab0e71a85d7a339b604d70823e2d2ea3bf Mon Sep 17 00:00:00 2001 From: Rob Giseburt Date: Wed, 13 Nov 2019 22:42:44 -0600 Subject: [PATCH] Minor cleanup is status reports --- g2core/report.cpp | 11 +++++++---- g2core/report.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/g2core/report.cpp b/g2core/report.cpp index bffd58a9..decefc2c 100644 --- a/g2core/report.cpp +++ b/g2core/report.cpp @@ -267,7 +267,7 @@ stat_t sr_request_status_report(cmStatusReportRequest request_type) return (STAT_OK); } - sr.status_report_systick = SysTickTimer.getValue(); + sr.status_report_systick.set(0); if (request_type == SR_REQUEST_IMMEDIATE) { sr.status_report_request = SR_FILTERED; // will trigger a filtered or verbose report depending on verbosity setting @@ -276,11 +276,11 @@ stat_t sr_request_status_report(cmStatusReportRequest request_type) } else if (request_type == SR_REQUEST_TIMED) { sr.status_report_request = sr.status_report_verbosity; - sr.status_report_systick += sr.status_report_interval; + sr.status_report_systick.set(sr.status_report_interval); } else { sr.status_report_request = SR_VERBOSE; - sr.status_report_systick += sr.status_report_interval; + sr.status_report_systick.set(sr.status_report_interval); } return (STAT_OK); } @@ -293,10 +293,13 @@ stat_t sr_status_report_callback() // called by controller dispatcher // conditions where autogenerated SRs will not be returned if ((sr.status_report_request == SR_OFF) || (sr.status_report_verbosity == SR_OFF) || - (SysTickTimer.getValue() < sr.status_report_systick) ) { + (!sr.status_report_systick.isPast()) || + (cs.controller_state != CONTROLLER_READY) ) { return (STAT_NOOP); } + sr.status_report_systick.clear(); + // don't send an SR if you the planner is experiencing a time constraint if (!mp_is_phat_city_time()) { if (++sr.throttle_counter != SR_THROTTLE_COUNT) { diff --git a/g2core/report.h b/g2core/report.h index d81daf5f..881fde1f 100644 --- a/g2core/report.h +++ b/g2core/report.h @@ -65,7 +65,7 @@ typedef struct srSingleton { /*** runtime values (PRIVATE) ***/ srVerbosity status_report_request; // flag that SR has been requested, and what type - uint32_t status_report_systick; // SysTick value for next status report + Motate::Timeout status_report_systick; // SysTick value for next status report index_t stat_index; // table index value for stat - determined during initialization uint8_t throttle_counter; // slow down SRs when in a constrained time (not phat_city) index_t status_report_list[NV_STATUS_REPORT_LEN]; // status report elements to report