Closed mark0n closed 10 years ago
This might be related to the fact that I'm using the following configuration:
UEIP
is set to trueSee motorRecord.cc:
/* Get state of motor's or encoder's home switch. */
if (msta.Bits.EA_PRESENT && pmr->ueip)
pmr->athm = (msta.Bits.EA_HOME) ? 1 : 0;
else
pmr->athm = (msta.Bits.RA_HOME) ? 1 : 0;
Note: EA_HOME
corresponds to the HOME
bit of MSTA
while RA_HOME
corresponds to the HOMELS
bit of MSTA
.
Maybe TLIM polling always update the RA_HOME
bit? We might want it to update the RA_HOME
bit instead when an encoder is present? I'll look into this tomorrow...
TLIM polling has to be on, because that's when I set the AtHome bit in MSTA. EA_PRESENT should be on when ENCCNT=1 is set on the controller, although I only read that at startup.
Does it work correctly if UEIP is off?
I'm not sure I've ever set the encoder home bit in MSTA. Any idea what that actually means? On a reference mark?
I suppose we could set both bits on when the home switch is active.
I just gave it a try: Having TLIM polling write to both EA_HOME
and RA_HOME
fixes this issue (see PR).
The
ATHM
field is always 0 even if the home switch is closed and theHOMELS
bit ofMSTA
is 1. This is different from the documentation of the Motor Record which says: "ATHM: The state of the hardware's 'home' switch. If 1, the motor has hit the switch."