Chris/Yanming,
I'm going through the labs on some fresh new HW I designed and I'm running the offset calc lab. I'm following the instructions in the "MotorControl SDK Instaspin Lab Guide". Step 6 in lab 2 seems incorrect. It states I should change the enableOffsetCalibration flag to zero to finish the test, but the source code has a call that re-enables the flag in the ISR. starting at line 760:
if(motorVars.flagEnableOffsetCalc == true)
{
runOffsetsCalculation();
//
// Below two lines code only used in this lab for hardware verification
// these two lines code will be removed for later lab projects
//
if(flagEnableOffsetCalibration == true)
{
motorVars.flagEnableOffsetCalc = true;
}
}
Fast forward 5 minutes, I figured it out what I was doing wrong. There is the motorvars offsetcal enable flag and then the one that isn't in the motorvars struct. If you change the motorvars one, the offsets get reset to zero since it re-enables offset cal. Seems kinda wonky to implement it this way. Could and very likely does lead to user confusion and unnecessary forum posts especially when both variables are populated in the expressions window by the lab's JS file. Maybe give the one the user is supposed to mess with in this lab a different name, or call out the fact that there are two very similarly named variables in the user guide? Maybe don't populate the struct one using the JS file for this example?
Your call, just some feedback. This tripped me up for a second.
Trey