diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-07-04 14:52:37 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-07-04 14:52:37 +0300 |
commit | e00b988031ccea7cc58a847d5368c185706ca2dd (patch) | |
tree | 2c2929f12fcaafc5e4f7ad085cd011c0ab56ad31 | |
parent | 2814b809db709e7b0eff3639315372019b1f2f84 (diff) |
Changes for ATE firmware build
-rw-r--r-- | src/CAN/CanMessageGenericConstructor.cpp | 13 | ||||
-rw-r--r-- | src/CAN/CanMessageGenericConstructor.h | 1 | ||||
-rw-r--r-- | src/Platform/Platform.h | 6 | ||||
-rw-r--r-- | src/RepRapFirmware.h | 6 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/CAN/CanMessageGenericConstructor.cpp b/src/CAN/CanMessageGenericConstructor.cpp index ef61896e..a62f01bd 100644 --- a/src/CAN/CanMessageGenericConstructor.cpp +++ b/src/CAN/CanMessageGenericConstructor.cpp @@ -329,6 +329,19 @@ void CanMessageGenericConstructor::AddDriverIdParam(char c, DriverId did) THROWS InsertValue(&did.localDriver, sz, pos); } +void CanMessageGenericConstructor::AddFloatArrayParam(char c, const float *v, size_t numV) THROWS(GCodeException) +{ + ParamDescriptor::ParamType t; + size_t sz; + const unsigned int pos = FindInsertPoint(c, t, sz); + if (t != ParamDescriptor::float_array || numV != sz) + { + throw ConstructParseException("fval array wrong parameter type or length"); + } + InsertValue(&numV, sizeof(uint8_t), pos); + InsertValue(v, numV * sizeof(float), pos + sizeof(uint8_t)); +} + GCodeResult CanMessageGenericConstructor::SendAndGetResponse(CanMessageType msgType, CanAddress dest, const StringRef& reply) const noexcept { CanMessageBuffer * const buf = CanMessageBuffer::Allocate(); diff --git a/src/CAN/CanMessageGenericConstructor.h b/src/CAN/CanMessageGenericConstructor.h index d23447aa..d8f80f65 100644 --- a/src/CAN/CanMessageGenericConstructor.h +++ b/src/CAN/CanMessageGenericConstructor.h @@ -34,6 +34,7 @@ public: void AddCharParam(char c, char v) THROWS(GCodeException); void AddStringParam(char c, const char* v) THROWS(GCodeException); void AddDriverIdParam(char c, DriverId did) THROWS(GCodeException); + void AddFloatArrayParam(char c, const float *v, size_t numV) THROWS(GCodeException); GCodeResult SendAndGetResponse(CanMessageType msgType, CanAddress dest, const StringRef& reply) const noexcept; diff --git a/src/Platform/Platform.h b/src/Platform/Platform.h index 585bf64a..a8ae2c27 100644 --- a/src/Platform/Platform.h +++ b/src/Platform/Platform.h @@ -705,12 +705,6 @@ private: void ReportDrivers(MessageType mt, DriversBitmap& whichDrivers, const char *_ecv_array text, bool& reported) noexcept; #endif - // Convert microseconds to step clocks, rounding up to the next step clock - static constexpr uint32_t MicrosecondsToStepClocks(float us) noexcept - { - return (uint32_t)ceilf((float)StepClockRate * 0.000001 * us); - } - #ifdef DUET3_MB6XD void UpdateDriverTimings() noexcept; #endif diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index b47a86d6..179b865a 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -502,6 +502,12 @@ constexpr uint32_t StepClockRate = SystemCoreClockFreq/128; // Duet 2 and Ma constexpr uint64_t StepClockRateSquared = (uint64_t)StepClockRate * StepClockRate; constexpr float StepClocksToMillis = 1000.0/(float)StepClockRate; +// Convert microseconds to step clocks, rounding up to the next step clock +static inline constexpr uint32_t MicrosecondsToStepClocks(float us) noexcept +{ + return (uint32_t)ceilf((float)StepClockRate * 0.000001 * us); +} + // Functions to convert speeds and accelerations between seconds and step clocks static inline constexpr float ConvertSpeedFromMmPerSec(float speed) noexcept { |