Improve/fix some comments
parent
74629f0103
commit
5571e77809
|
|
@ -15,7 +15,7 @@ bool TMC2130::Init(const MotorParams ¶ms, const MotorCurrents ¤ts, Mot
|
||||||
// if the version is incorrect or a bit always set to 1 is suddenly 0
|
// if the version is incorrect or a bit always set to 1 is suddenly 0
|
||||||
// (the supposed SD_MODE pin that doesn't exist on this driver variant)
|
// (the supposed SD_MODE pin that doesn't exist on this driver variant)
|
||||||
if (((IOIN >> 24U) != 0x11) | !(IOIN & (1U << 6U)))
|
if (((IOIN >> 24U) != 0x11) | !(IOIN & (1U << 6U)))
|
||||||
return true; // @todo return some kind of failure
|
return true; // @@TODO return some kind of failure
|
||||||
|
|
||||||
///clear reset_flag as we are (re)initializing
|
///clear reset_flag as we are (re)initializing
|
||||||
errorFlags.reset_flag = false;
|
errorFlags.reset_flag = false;
|
||||||
|
|
@ -63,7 +63,7 @@ bool TMC2130::Init(const MotorParams ¶ms, const MotorCurrents ¤ts, Mot
|
||||||
|
|
||||||
void TMC2130::SetMode(const MotorParams ¶ms, MotorMode mode) {
|
void TMC2130::SetMode(const MotorParams ¶ms, MotorMode mode) {
|
||||||
///0xFFF00 is used as a "Normal" mode threshold since stealthchop will be used at standstill.
|
///0xFFF00 is used as a "Normal" mode threshold since stealthchop will be used at standstill.
|
||||||
WriteRegister(params, Registers::TPWMTHRS, (mode == Stealth) ? 70 : 0xFFF00); // @todo should be configurable
|
WriteRegister(params, Registers::TPWMTHRS, (mode == Stealth) ? 70 : 0xFFF00); // @@TODO should be configurable
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMC2130::SetCurrents(const MotorParams ¶ms, const MotorCurrents ¤ts) {
|
void TMC2130::SetCurrents(const MotorParams ¶ms, const MotorCurrents ¤ts) {
|
||||||
|
|
@ -81,7 +81,7 @@ void TMC2130::SetEnabled(const MotorParams ¶ms, bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMC2130::ClearStallguard(const MotorParams ¶ms) {
|
void TMC2130::ClearStallguard(const MotorParams ¶ms) {
|
||||||
// @todo: maximum resolution right now is x256/4 (uint8_t / 4)
|
// @@TODO maximum resolution right now is x256/4 (uint8_t / 4)
|
||||||
sg_counter = 4 * (1 << (8 - params.mRes)) - 1; /// one electrical full step (4 steps when fullstepping)
|
sg_counter = 4 * (1 << (8 - params.mRes)) - 1; /// one electrical full step (4 steps when fullstepping)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,6 +132,7 @@ void TMC2130::_spi_tx_rx(const MotorParams ¶ms, uint8_t (&pData)[5]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMC2130::_handle_spi_status(const MotorParams ¶ms, uint8_t status) {
|
void TMC2130::_handle_spi_status(const MotorParams ¶ms, uint8_t status) {
|
||||||
|
//@@TODO
|
||||||
// errorFlags.reset_flag |= status & (1 << 0);
|
// errorFlags.reset_flag |= status & (1 << 0);
|
||||||
// errorFlags.driver_error |= status & (1 << 1);
|
// errorFlags.driver_error |= status & (1 << 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ private:
|
||||||
|
|
||||||
ErrorFlags errorFlags;
|
ErrorFlags errorFlags;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
uint8_t sg_counter;
|
uint8_t sg_counter = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace tmc2130
|
} // namespace tmc2130
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ bool CommandBase::Step() {
|
||||||
// if (ms::selector.State() == ms::Selector::Failed) {
|
// if (ms::selector.State() == ms::Selector::Failed) {
|
||||||
// state = ProgressCode::ERRTMCFailed;
|
// state = ProgressCode::ERRTMCFailed;
|
||||||
// error |= TMC2130ToErrorCode(mm::motion.DriverForAxis(mm::Axis::Selector), mm::Axis::Selector);
|
// error |= TMC2130ToErrorCode(mm::motion.DriverForAxis(mm::Axis::Selector), mm::Axis::Selector);
|
||||||
// return true; // the HW error prevents us from continuing with the with the state machine - the MMU must be restarted/fixed before continuing
|
// return true; // the HW error prevents us from continuing with the state machine - the MMU must be restarted/fixed before continuing
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @@TODO not sure how to prevent losing the previously accumulated error ... or do I really need to do it?
|
// @@TODO not sure how to prevent losing the previously accumulated error ... or do I really need to do it?
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
/// TMC_PULLEY_BIT, TMC_SELECTOR_BIT, TMC_IDLER_BIT,
|
/// TMC_PULLEY_BIT, TMC_SELECTOR_BIT, TMC_IDLER_BIT,
|
||||||
/// The resulting error is a bitwise OR over 3 TMC drivers and their status, which should cover most of the situations correctly.
|
/// The resulting error is a bitwise OR over 3 TMC drivers and their status, which should cover most of the situations correctly.
|
||||||
enum class ErrorCode : uint_fast16_t {
|
enum class ErrorCode : uint_fast16_t {
|
||||||
RUNNING = 0x0000, ///< the operation is still running
|
RUNNING = 0x0000, ///< the operation is still running - keep this value as ZERO as it is used for initialization of error codes as well
|
||||||
OK = 0x0001, ///< the operation finished OK
|
OK = 0x0001, ///< the operation finished OK
|
||||||
|
|
||||||
/// Unload Filament related error codes
|
/// Unload Filament related error codes
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue