Skip to content

Commit

Permalink
Merge pull request #89 from leptun/fixCurrentsReporting
Browse files Browse the repository at this point in the history
M913 report rescaled currents
  • Loading branch information
3d-gussner authored Feb 22, 2024
2 parents 0fcbf80 + 0c6e270 commit 4d362c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Firmware/tmc2130.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,10 @@ void tmc2130_setup_chopper(uint8_t axis, uint8_t mres, const MotorCurrents *curr
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"),
currents[0].getiHold(), currents[0].getiRun(),
currents[1].getiHold(), currents[1].getiRun(),
currents[2].getiHold(), currents[2].getiRun(),
currents[3].getiHold(), currents[3].getiRun()
currents[0].getOriginaliHold(), currents[0].getOriginaliRun(),
currents[1].getOriginaliHold(), currents[1].getOriginaliRun(),
currents[2].getOriginaliHold(), currents[2].getOriginaliRun(),
currents[3].getOriginaliHold(), currents[3].getOriginaliRun()
);
}

Expand Down
2 changes: 2 additions & 0 deletions Firmware/tmc2130.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ struct MotorCurrents {

inline uint8_t getiRun() const { return 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 uint8_t getvSense() const { return vSense; }

Expand Down

0 comments on commit 4d362c1

Please sign in to comment.