diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-04-27 16:29:53 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-04-27 16:29:53 +0300 |
commit | 9ead98ce7dc8a4fe1454a7003b14fee1aab51941 (patch) | |
tree | f63045845dc673e2ca1330c15695c3c80cb99dfa /src/DuetNG | |
parent | 59b942eae8cca6762a6033d7115ee2663a2dd395 (diff) |
Various
Use new NumericConverter, StrToInt32 and StrToUint32 functions in
RRFLibraries
Added DueXn i2C transaction counter
Replaced strptime by SafeStrptime
Diffstat (limited to 'src/DuetNG')
-rw-r--r-- | src/DuetNG/DueXn.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/DuetNG/DueXn.cpp b/src/DuetNG/DueXn.cpp index 3ac8f139..22e83c9b 100644 --- a/src/DuetNG/DueXn.cpp +++ b/src/DuetNG/DueXn.cpp @@ -29,6 +29,8 @@ namespace DuetExpansion static bool additionalIoExpanderPresent = false; static uint16_t additionalIoInputBits = 0; + static uint32_t dueXnReadCount = 0; + static uint32_t dueXnReadCountResetMillis = 0; static volatile bool taskWaiting = false; static volatile bool inputsChanged = false; @@ -82,6 +84,7 @@ namespace DuetExpansion { inputsChanged = false; dueXnInputBits = dueXnExpander.digitalReadAll(); + ++dueXnReadCount; cpu_irq_disable(); if (!inputsChanged) @@ -318,10 +321,19 @@ namespace DuetExpansion } } - // Print diagnostic data - // I2C error counts are now reported by Platform, so nothing to report here. + // Print diagnostic data. I2C error counts are now reported by Platform. void Diagnostics(MessageType mtype) noexcept { + const uint32_t now = millis(); + const uint32_t readCount = dueXnReadCount; + dueXnReadCountResetMillis = now; + dueXnReadCount = 0; + + reprap.GetPlatform().MessageF(mtype, + "=== DueX ===\nRead count %" PRIu32 ", %.02f reads/min\n", + readCount, + (double)((float)readCount * (MillisToSeconds * SecondsToMinutes)/(now - dueXnReadCountResetMillis)) + ); } // Diagnose the SX1509 by setting all pins as inputs and reading them |