diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-01-12 14:06:19 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-01-12 14:06:19 +0300 |
commit | 783e1a943539f157e0dcc0bd4089c67c8b3ba720 (patch) | |
tree | 5a85111b664a76cb148458e441ef43d871864559 /src/CAN | |
parent | fd7598349dc9e82ee519bf8a884ab0de755ab6ff (diff) |
Added CAN time sync compensation for transmit delay
Also increased minimum step pulse width on SAME70
Removed HAS_LEGACY_NETWORKING
Removes M122 P103. M122 P102 now does both sqrt and sin/cos timings.
Added CAN timestamp counter vs. step clock timing to M122 P108
Diffstat (limited to 'src/CAN')
-rw-r--r-- | src/CAN/CanInterface.cpp | 12 | ||||
-rw-r--r-- | src/CAN/CanInterface.h | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/CAN/CanInterface.cpp b/src/CAN/CanInterface.cpp index 53a43ab6..2f12c247 100644 --- a/src/CAN/CanInterface.cpp +++ b/src/CAN/CanInterface.cpp @@ -522,13 +522,17 @@ void CanInterface::CheckCanAddress(uint32_t address, const GCodeBuffer& gb) THRO } } -#if !SAME70 - uint16_t CanInterface::GetTimeStampCounter() noexcept { +#if USE_NEW_CAN_DRIVER return can0dev->ReadTimeStampCounter(); +#else + return MCAN_MODULE->MCAN_TSCV; +#endif } +#if !SAME70 + uint16_t CanInterface::GetTimeStampPeriod() noexcept { return can0dev->GetTimeStampPeriod(); @@ -637,7 +641,10 @@ extern "C" [[noreturn]] void CanClockLoop(void *) noexcept { msg->lastTimeAcknowledgeDelay = 0; // TODO set lastTimeAcknowledgeDelay correctly } + + msg->realTime = (uint32_t)reprap.GetPlatform().GetDateTime(); // TODO save CAN bandwidth by sending this just once per second msg->isPrinting = reprap.GetGCodes().IsReallyPrinting(); + #if SAME70 lastTimeSent = StepTimer::GetTimerTicks(); #else @@ -648,7 +655,6 @@ extern "C" [[noreturn]] void CanClockLoop(void *) noexcept } #endif msg->timeSent = lastTimeSent; - msg->realTime = (uint32_t)reprap.GetPlatform().GetDateTime(); // TODO save CAN bandwidth by sending this just once per second #if USE_NEW_CAN_DRIVER can0dev->SendMessage(TxBufferIndexTimeSync, 0, &buf); #else diff --git a/src/CAN/CanInterface.h b/src/CAN/CanInterface.h index bdc581a8..356d7346 100644 --- a/src/CAN/CanInterface.h +++ b/src/CAN/CanInterface.h @@ -84,8 +84,9 @@ namespace CanInterface CanMessageBuffer *AllocateBuffer(const GCodeBuffer* gb) THROWS(GCodeException); void CheckCanAddress(uint32_t address, const GCodeBuffer& gb) THROWS(GCodeException); -#if !SAME70 uint16_t GetTimeStampCounter() noexcept; + +#if !SAME70 uint16_t GetTimeStampPeriod() noexcept; #endif |