Introduce TMC2130 currents doxy group
and clean-up doxygen warnings a bitpull/261/head
parent
9fce324bff
commit
7e2375deee
|
|
@ -71,22 +71,22 @@ static constexpr uint8_t feedToBondtechMaxRetries = 2;
|
||||||
static constexpr U_mm pulleyToCuttingEdge = 33.0_mm; /// 33.0_mm /// Pulley to cutting edge.
|
static constexpr U_mm pulleyToCuttingEdge = 33.0_mm; /// 33.0_mm /// Pulley to cutting edge.
|
||||||
/// Case 1: FINDA working: This should be the max retraction after FINDA un-triggers.
|
/// Case 1: FINDA working: This should be the max retraction after FINDA un-triggers.
|
||||||
/// Case 2: FINDA not working: calculate retraction from printer to this point.
|
/// Case 2: FINDA not working: calculate retraction from printer to this point.
|
||||||
static constexpr U_mm filamentMinLoadedToMMU = 20.0_mm; /// 20.0_mm ??? /// Limit of retraction. @TODO find correct distance.
|
static constexpr U_mm filamentMinLoadedToMMU = 20.0_mm; /// Limit of retraction.
|
||||||
static constexpr U_mm ejectFromCuttingEdge = 40.0_mm; /// Eject should ignore FilamentMinLoadedToMMU and retract
|
static constexpr U_mm ejectFromCuttingEdge = 40.0_mm; /// Eject should ignore FilamentMinLoadedToMMU and retract
|
||||||
static constexpr U_mm cuttingEdgeRetract = 5.0_mm; /// 3.0_mm /// Cutting retraction distance (filament should be flush with outlet) @TODO find correct distance.
|
static constexpr U_mm cuttingEdgeRetract = 5.0_mm; /// Cutting retraction distance (filament should be flush with outlet)
|
||||||
static constexpr U_mm cuttingEdgeToFinda = 18.5_mm; /// 18.5_mm -1.0_mm /// Cutting edge to FINDA MMU2 side -1mm tolerance should be ~18.5. FINDA shouldn't trigger here.
|
static constexpr U_mm cuttingEdgeToFinda = 18.5_mm; /// Cutting edge to FINDA MMU2 side -1mm tolerance should be ~18.5. FINDA shouldn't trigger here.
|
||||||
static constexpr U_mm findaTriggerDistance = 4.5_mm; /// 9.0_mm /// FINDA trigger distance +1.0_mm tolerance.
|
static constexpr U_mm findaTriggerDistance = 4.5_mm; /// FINDA trigger distance +1.0_mm tolerance.
|
||||||
static constexpr U_mm cuttingEdgeToFindaMidpoint = 22.85_mm; /// Cutting edge to Midpoint of FINDA should be 22.85_mm.
|
static constexpr U_mm cuttingEdgeToFindaMidpoint = 22.85_mm; /// Cutting edge to Midpoint of FINDA should be 22.85_mm.
|
||||||
static constexpr U_mm findaToCoupler = 12.0_mm; /// 12.0_mm /// FINDA Coupler side to coupler screw.
|
static constexpr U_mm findaToCoupler = 12.0_mm; /// FINDA Coupler side to coupler screw.
|
||||||
static constexpr U_mm couplerToBowden = 3.5_mm; /// 3.5_mm /// FINDA Coupler screw to bowden mmu2s side (in coupling).
|
static constexpr U_mm couplerToBowden = 3.5_mm; /// FINDA Coupler screw to bowden mmu2s side (in coupling).
|
||||||
|
|
||||||
// @@TODO this is very tricky - the same MMU, same PTFE,
|
// @@TODO this is very tricky - the same MMU, same PTFE,
|
||||||
// just another piece of PLA (probably having more resistance in the tubes)
|
// just another piece of PLA (probably having more resistance in the tubes)
|
||||||
// and we are at least 40mm off! It looks like this really depends on the exact position
|
// and we are at least 40mm off! It looks like this really depends on the exact position
|
||||||
// We'll probably need to check for StallGuard while pushing the filament to avoid ginding the filament
|
// We'll probably need to check for StallGuard while pushing the filament to avoid ginding the filament
|
||||||
static constexpr U_mm defaultBowdenLength = 427.0_mm; ///< ~427.0_mm - Default Bowden length. @TODO Should be stored in EEPROM. 392 a 784
|
static constexpr U_mm defaultBowdenLength = 427.0_mm; ///< ~427.0_mm - Default Bowden length. TODO Should be stored in EEPROM. 392 a 784
|
||||||
static constexpr U_mm minimumBowdenLength = 341.0_mm; ///< ~341.0_mm - Minimum bowden length. @TODO Should be stored in EEPROM.
|
static constexpr U_mm minimumBowdenLength = 341.0_mm; ///< ~341.0_mm - Minimum bowden length. TODO Should be stored in EEPROM.
|
||||||
static constexpr U_mm maximumBowdenLength = 792.0_mm; ///< ~792.0_mm - Maximum bowden length. @TODO Should be stored in EEPROM.
|
static constexpr U_mm maximumBowdenLength = 792.0_mm; ///< ~792.0_mm - Maximum bowden length. TODO Should be stored in EEPROM.
|
||||||
static constexpr U_mm feedToFinda = cuttingEdgeToFindaMidpoint + filamentMinLoadedToMMU;
|
static constexpr U_mm feedToFinda = cuttingEdgeToFindaMidpoint + filamentMinLoadedToMMU;
|
||||||
static constexpr U_mm maximumFeedToFinda = feedToFinda + 20.0_mm; ///< allow for some safety margin to load to FINDA
|
static constexpr U_mm maximumFeedToFinda = feedToFinda + 20.0_mm; ///< allow for some safety margin to load to FINDA
|
||||||
static constexpr U_mm pulleyHelperMove = 10.0_mm; ///< Helper move for Load/Unload error states - when the MMU should slowly move the filament a bit
|
static constexpr U_mm pulleyHelperMove = 10.0_mm; ///< Helper move for Load/Unload error states - when the MMU should slowly move the filament a bit
|
||||||
|
|
@ -136,7 +136,7 @@ static constexpr uint8_t selectorCutIRun = 40; ///< 660mA
|
||||||
|
|
||||||
/// Selector motion limits
|
/// Selector motion limits
|
||||||
static constexpr SelectorLimits selectorLimits = {
|
static constexpr SelectorLimits selectorLimits = {
|
||||||
.lenght = 75.0_mm, // @@TODO how does this relate to SelectorOffsetFromMin?
|
.lenght = 75.0_mm, // TODO how does this relate to SelectorOffsetFromMin?
|
||||||
.jerk = 1.0_mm_s,
|
.jerk = 1.0_mm_s,
|
||||||
.accel = 200.0_mm_s2,
|
.accel = 200.0_mm_s2,
|
||||||
};
|
};
|
||||||
|
|
@ -213,7 +213,7 @@ static constexpr U_deg idlerIntermediateSlotPositions[toolCount + 1] = {
|
||||||
IdlerOffsetFromHome ///18.0_deg Fully disengaged all slots
|
IdlerOffsetFromHome ///18.0_deg Fully disengaged all slots
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr U_deg idlerParkPositionDelta = -IdlerSlotDistance + 5.0_deg / 2; ///@TODO verify
|
static constexpr U_deg idlerParkPositionDelta = -IdlerSlotDistance + 5.0_deg / 2; // TODO verify
|
||||||
|
|
||||||
static constexpr U_deg_s idlerFeedrate = 300._deg_s;
|
static constexpr U_deg_s idlerFeedrate = 300._deg_s;
|
||||||
static constexpr U_deg_s idlerHomingFeedrate = 265._deg_s;
|
static constexpr U_deg_s idlerHomingFeedrate = 265._deg_s;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ public:
|
||||||
|
|
||||||
/// Convenience function to read a 1-byte value from EEPROM and check for unitialized EEPROM cells.
|
/// Convenience function to read a 1-byte value from EEPROM and check for unitialized EEPROM cells.
|
||||||
/// @returns 1-byte value read from the EEPROM.
|
/// @returns 1-byte value read from the EEPROM.
|
||||||
/// In case the EEPROM has a default value at @addr, this function returns @defaultValue
|
/// In case the EEPROM has a default value at @p addr, this function returns @p defaultValue
|
||||||
static uint8_t ReadByte(addr_t addr, uint8_t defaultValue);
|
static uint8_t ReadByte(addr_t addr, uint8_t defaultValue);
|
||||||
|
|
||||||
static void WriteWord(addr_t addr, uint16_t value);
|
static void WriteWord(addr_t addr, uint16_t value);
|
||||||
|
|
@ -25,7 +25,7 @@ public:
|
||||||
static uint16_t ReadWord(addr_t addr);
|
static uint16_t ReadWord(addr_t addr);
|
||||||
|
|
||||||
/// @returns physical end address of EEPROM memory end
|
/// @returns physical end address of EEPROM memory end
|
||||||
/// @@TODO this is sad - the constexpr must be inline... find a way around in the future
|
/// TODO this is sad - the constexpr must be inline... find a way around in the future
|
||||||
constexpr static addr_t End() { return 2048; }
|
constexpr static addr_t End() { return 2048; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@
|
||||||
#include "../config/config.h"
|
#include "../config/config.h"
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
|
|
||||||
//! @brief Translate current to tmc2130 vsense and IHOLD or IRUN - copied from MK3 FW repo
|
//! @defgroup TMC2130 current to value translation table
|
||||||
|
//! @{
|
||||||
|
//! @brief Translate current to tmc2130 vsense and IHOLD or IRUN - copied from MK3 FW repo.
|
||||||
//! @param cur current in mA
|
//! @param cur current in mA
|
||||||
//! @return 0 .. 63
|
//! @return 0 .. 63
|
||||||
//! @n most significant bit is CHOPCONF vsense bit (sense resistor voltage based current scaling)
|
//! @n most significant bit is CHOPCONF vsense bit (sense resistor voltage based current scaling).
|
||||||
//! @n rest is to be used in IRUN or IHOLD register
|
//! @n rest is to be used in IRUN or IHOLD register.
|
||||||
//!
|
//!
|
||||||
//! | mA | trinamic register | note |
|
//! | mA | trinamic register | note |
|
||||||
//! | --- | --- | --- |
|
//! | --- | --- | --- |
|
||||||
|
|
@ -74,6 +76,8 @@
|
||||||
//! | 1000 | 61 | |
|
//! | 1000 | 61 | |
|
||||||
//! | 1020 | 62 | |
|
//! | 1020 | 62 | |
|
||||||
//! | 1029 | 63 | |
|
//! | 1029 | 63 | |
|
||||||
|
//! @}
|
||||||
|
|
||||||
namespace hal {
|
namespace hal {
|
||||||
namespace tmc2130 {
|
namespace tmc2130 {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ public:
|
||||||
void SetCurrents(const MotorParams ¶ms, const MotorCurrents ¤ts);
|
void SetCurrents(const MotorParams ¶ms, const MotorCurrents ¤ts);
|
||||||
|
|
||||||
/// Set StallGuard threshold
|
/// Set StallGuard threshold
|
||||||
/// New SGTHRS must be already set in @params
|
/// New SGTHRS must be already set in @p params
|
||||||
/// Beware - there are no checks, new value is written into the TMC register immediately.
|
/// Beware - there are no checks, new value is written into the TMC register immediately.
|
||||||
/// It is advised to prefer setting the SGTHRS via the Init() method.
|
/// It is advised to prefer setting the SGTHRS via the Init() method.
|
||||||
void SetSGTHRS(const MotorParams ¶ms);
|
void SetSGTHRS(const MotorParams ¶ms);
|
||||||
|
|
|
||||||
|
|
@ -49,14 +49,14 @@ public:
|
||||||
/// @param str pointer to a string in RAM to be pushed byte-by-byte into the TX buffer (to be sent)
|
/// @param str pointer to a string in RAM to be pushed byte-by-byte into the TX buffer (to be sent)
|
||||||
/// No NL character is appended
|
/// No NL character is appended
|
||||||
void WriteS(const char *str);
|
void WriteS(const char *str);
|
||||||
/// @param str pointer to a string in PROGMEM to be pushed byte-by-byte into the TX buffer (to be sent)
|
/// @param str_P pointer to a string in PROGMEM to be pushed byte-by-byte into the TX buffer (to be sent)
|
||||||
/// No NL character is appended
|
/// No NL character is appended
|
||||||
void WriteS_P(const char *str_P);
|
void WriteS_P(const char *str_P);
|
||||||
|
|
||||||
/// @param str c string to be sent. NL is appended
|
/// @param str c string to be sent. NL is appended
|
||||||
/// Works on RAM strings
|
/// Works on RAM strings
|
||||||
void puts(const char *str);
|
void puts(const char *str);
|
||||||
/// @param str c string to be sent. NL is appended
|
/// @param str_P c string to be sent. NL is appended
|
||||||
/// Works on PROGMEM strings
|
/// Works on PROGMEM strings
|
||||||
void puts_P(const char *str_P);
|
void puts_P(const char *str_P);
|
||||||
/// @returns true if there is at least one byte free in the TX buffer (i.e. some space to add a character to be sent)
|
/// @returns true if there is at least one byte free in the TX buffer (i.e. some space to add a character to be sent)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ public:
|
||||||
: CommandBase() {}
|
: CommandBase() {}
|
||||||
|
|
||||||
/// Restart the automaton
|
/// Restart the automaton
|
||||||
/// @param param unused
|
|
||||||
bool Reset(uint8_t /*param*/) override;
|
bool Reset(uint8_t /*param*/) override;
|
||||||
|
|
||||||
/// @returns true if the state machine finished its job, false otherwise
|
/// @returns true if the state machine finished its job, false otherwise
|
||||||
|
|
|
||||||
|
|
@ -115,9 +115,9 @@ static constexpr AU unitToAxisUnit(U v) {
|
||||||
/// Convert an AxisUnit to a physical unit with a truncated integer type (normally int32_t).
|
/// Convert an AxisUnit to a physical unit with a truncated integer type (normally int32_t).
|
||||||
/// Inverse of unitToAxisUnit, with the additional constraint that type casts are
|
/// Inverse of unitToAxisUnit, with the additional constraint that type casts are
|
||||||
/// performed earlier so that no floating point computation is required at runtime.
|
/// performed earlier so that no floating point computation is required at runtime.
|
||||||
/// @param U Base unit type (normally U_mm)
|
/// @tparam U Base unit type (normally U_mm)
|
||||||
/// @param AU AxisUnit type (implicit)
|
/// @tparam AU AxisUnit type (implicit)
|
||||||
/// @param T Resulting integer type
|
/// @tparam T Resulting integer type
|
||||||
/// @param v Value to truncate
|
/// @param v Value to truncate
|
||||||
/// @param mul Optional pre-multiplier
|
/// @param mul Optional pre-multiplier
|
||||||
/// @returns Truncated unit (v * mul)
|
/// @returns Truncated unit (v * mul)
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ FilamentLoadState Globals::FilamentLoaded() const {
|
||||||
return filamentLoaded;
|
return filamentLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Globals::SetFilamentLoaded(uint8_t slot, FilamentLoadState newFilamentLoaded) {
|
void __attribute__((noinline)) Globals::SetFilamentLoaded(uint8_t slot, FilamentLoadState newFilamentLoaded) {
|
||||||
filamentLoaded = newFilamentLoaded;
|
filamentLoaded = newFilamentLoaded;
|
||||||
SetActiveSlot(slot);
|
SetActiveSlot(slot);
|
||||||
switch (newFilamentLoaded) {
|
switch (newFilamentLoaded) {
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,9 @@ public:
|
||||||
|
|
||||||
/// Sets the filament loaded flag value, usually after some command/operation.
|
/// Sets the filament loaded flag value, usually after some command/operation.
|
||||||
/// Also updates the EEPROM records accordingly
|
/// Also updates the EEPROM records accordingly
|
||||||
|
/// @param slot slot index
|
||||||
/// @param newFilamentLoaded new state
|
/// @param newFilamentLoaded new state
|
||||||
void __attribute__((noinline)) SetFilamentLoaded(uint8_t slot, FilamentLoadState newFilamentLoaded);
|
void SetFilamentLoaded(uint8_t slot, FilamentLoadState newFilamentLoaded);
|
||||||
|
|
||||||
/// @returns the total number of MMU errors so far
|
/// @returns the total number of MMU errors so far
|
||||||
/// Errors are stored in the EEPROM
|
/// Errors are stored in the EEPROM
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ void MovableBase::PlanHome() {
|
||||||
PlanHomingMoveForward();
|
PlanHomingMoveForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovableBase::SetCurrents(uint8_t iRun, uint8_t iHold) {
|
void __attribute__((noinline)) MovableBase::SetCurrents(uint8_t iRun, uint8_t iHold) {
|
||||||
hal::tmc2130::MotorCurrents tempCurrent(iRun, iHold);
|
hal::tmc2130::MotorCurrents tempCurrent(iRun, iHold);
|
||||||
mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, tempCurrent);
|
mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, tempCurrent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public:
|
||||||
|
|
||||||
/// Set TMC2130 iRun current level for this axis
|
/// Set TMC2130 iRun current level for this axis
|
||||||
/// iRun == 0 means set the default from config
|
/// iRun == 0 means set the default from config
|
||||||
void __attribute__((noinline)) SetCurrents(uint8_t iRun, uint8_t iHold);
|
void SetCurrents(uint8_t iRun, uint8_t iHold);
|
||||||
|
|
||||||
#ifndef UNITTEST
|
#ifndef UNITTEST
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -182,8 +182,7 @@ public:
|
||||||
|
|
||||||
/// Encode response to Query operation status
|
/// Encode response to Query operation status
|
||||||
/// @param msg source request message for this response
|
/// @param msg source request message for this response
|
||||||
/// @param code status of operation (Processing, Error, Finished)
|
/// @param rcs status of operation (Processing, Error, Finished)
|
||||||
/// @param value related to status of operation(e.g. error code or progress)
|
|
||||||
/// @param txbuff where to format the message
|
/// @param txbuff where to format the message
|
||||||
/// @returns number of bytes written into txbuff
|
/// @returns number of bytes written into txbuff
|
||||||
static uint8_t EncodeResponseQueryOperation(const RequestMsg &msg, ResponseCommandStatus rcs, uint8_t *txbuff);
|
static uint8_t EncodeResponseQueryOperation(const RequestMsg &msg, ResponseCommandStatus rcs, uint8_t *txbuff);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/// @file version.h
|
/// @file
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue