Merge pull request #4602 from 3d-gussner/MK3_M913

Enable M913
This commit is contained in:
3d-gussner 2024-04-04 07:30:06 +02:00 committed by GitHub
commit af03662c8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View File

@ -8374,6 +8374,7 @@ Sigma_Exit:
} }
break; break;
#ifdef TMC2130
#ifdef TMC2130_SERVICE_CODES_M910_M918 #ifdef TMC2130_SERVICE_CODES_M910_M918
/*! /*!
@ -8434,6 +8435,7 @@ Sigma_Exit:
} }
} }
break; break;
#endif // TMC2130_SERVICE_CODES_M910_M918
/*! /*!
### M913 - Print TMC2130 currents <a href="https://reprap.org/wiki/G-code#M913:_Print_TMC2130_currents">M913: Print TMC2130 currents</a> ### M913 - Print TMC2130 currents <a href="https://reprap.org/wiki/G-code#M913:_Print_TMC2130_currents">M913: Print TMC2130 currents</a>
@ -8446,7 +8448,6 @@ Sigma_Exit:
} }
break; break;
#endif // TMC2130_SERVICE_CODES_M910_M918
/*! /*!
### M914 - Set TMC2130 normal mode <a href="https://reprap.org/wiki/G-code#M914:_Set_TMC2130_normal_mode">M914: Set TMC2130 normal mode</a> ### M914 - Set TMC2130 normal mode <a href="https://reprap.org/wiki/G-code#M914:_Set_TMC2130_normal_mode">M914: Set TMC2130 normal mode</a>
Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout) Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)
@ -8473,7 +8474,6 @@ Sigma_Exit:
- `R` - Revert to EEPROM value - `R` - Revert to EEPROM value
- `Q` - Print effective silent/normal status. (Does not report override) - `Q` - Print effective silent/normal status. (Does not report override)
*/ */
#ifdef TMC2130
case 914: case 914:
case 915: case 915:
{ {
@ -8512,7 +8512,6 @@ Sigma_Exit:
} }
break; break;
#endif // TMC2130
#ifdef TMC2130_SERVICE_CODES_M910_M918 #ifdef TMC2130_SERVICE_CODES_M910_M918
/*! /*!
### M916 - Set TMC2130 Stallguard sensitivity threshold <a href="https://reprap.org/wiki/G-code#M916:_Set_TMC2130_Stallguard_sensitivity_threshold">M916: Set TMC2130 Stallguard sensitivity threshold</a> ### M916 - Set TMC2130 Stallguard sensitivity threshold <a href="https://reprap.org/wiki/G-code#M916:_Set_TMC2130_Stallguard_sensitivity_threshold">M916: Set TMC2130 Stallguard sensitivity threshold</a>
@ -8585,6 +8584,7 @@ Sigma_Exit:
break; break;
#endif //TMC2130_SERVICE_CODES_M910_M918 #endif //TMC2130_SERVICE_CODES_M910_M918
#endif // TMC2130
/*! /*!
### M350 - Set microstepping mode <a href="https://reprap.org/wiki/G-code#M350:_Set_microstepping_mode">M350: Set microstepping mode</a> ### M350 - Set microstepping mode <a href="https://reprap.org/wiki/G-code#M350:_Set_microstepping_mode">M350: Set microstepping mode</a>

View File

@ -580,10 +580,10 @@ void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, const MotorCurrents *curr
void tmc2130_print_currents() void tmc2130_print_currents()
{ {
printf_P(_n("tmc2130_print_currents()\n\tH\tR\nX\t%d\t%d\nY\t%d\t%d\nZ\t%d\t%d\nE\t%d\t%d\n"), printf_P(_n("tmc2130_print_currents()\n\tH\tR\nX\t%d\t%d\nY\t%d\t%d\nZ\t%d\t%d\nE\t%d\t%d\n"),
currents[0].getiHold(), currents[0].getiRun(), currents[0].getOriginaliHold(), currents[0].getOriginaliRun(),
currents[1].getiHold(), currents[1].getiRun(), currents[1].getOriginaliHold(), currents[1].getOriginaliRun(),
currents[2].getiHold(), currents[2].getiRun(), currents[2].getOriginaliHold(), currents[2].getOriginaliRun(),
currents[3].getiHold(), currents[3].getiRun() currents[3].getOriginaliHold(), currents[3].getOriginaliRun()
); );
} }

View File

@ -105,6 +105,8 @@ struct MotorCurrents {
inline uint8_t getiRun() const { return iRun; } inline uint8_t getiRun() const { return iRun; }
inline uint8_t getiHold() const { return min(iHold, iRun); } inline uint8_t getiHold() const { return min(iHold, iRun); }
inline uint8_t getOriginaliRun() const { return vSense ? iRun : iRun << 1; }
inline uint8_t getOriginaliHold() const { return min(vSense ? iHold : iHold << 1, getOriginaliRun()); }
inline bool iHoldIsClamped() const { return iHold > iRun; } inline bool iHoldIsClamped() const { return iHold > iRun; }
inline uint8_t getvSense() const { return vSense; } inline uint8_t getvSense() const { return vSense; }