Hello!
I have found that in ACP if I in something like a weather script ask for the dome to home it in fact homes but does not report back to ACP. My workaround is to just slew dome to where home should be. That is fine. Following is my current working prototype ACP-Weather js script (comments are longer than the code). The comments describe the behavior. I've asked Bob Denny (ACP) for his advice on what response back is expected.
//is a comment line..
function main()
{
if(Telescope.Connected) {
Console.PrintLine("Weather Safety Script..");
Telescope.Tracking = false;
Util.WaitForMilliseconds(2000);
Console.PrintLine("Positioning shutter over charger tabs...");
//Only reason to move dome at all is in case weather stays bad from rain.
//Might not be able to open and turn. Need to avoid rotator gear running
//over the charging tabs
//Following three lines home dome but PDM driver does not report back to ACP.
//Only recovery is to disconnect all and power cycle rotator.
//Dome.FindHome();
//while(!Dome.AtHome)
//Util.WaitForMilliseconds(2000);
//This Alternate to above 3 lines seems ok
Dome.Slew(0);
while(Dome.Slewing)
Util.WaitForMilliseconds(2000);
Dome.CloseShutter();
Console.PrintLine("Closing shutter...waiting 120sec for it to complete....");
Util.WaitForMilliseconds(120000);
Console.PrintLine("Done.");
}
}
No, this line is exiting the StartHoming() function.. it's not supposed to return anything (the function is of type void).
The way it works:
- 'h#" command received, start the homing process by calling StartHoming(). This will either return immediately if the dome is already home, or set _seekMode to HOMING_HOME if not.
- The Run() function is call from the loop fonction in PDMRotator.ino . This function check the _seekMode against some values, one of them being HOMING_HOME :
if (_seekMode == HOMING_HOME && digitalRead(HOME_PIN) == 0) // We're looking for home and found it
This is line 692 in RotatorClass.h . If the above is true, the code issue a Stop() call and reset some variable.
The code then check to see if the stepper is still running ( if (stepper.isRunning()) return; ) and exit if it is.
If the stepper has stopped, the code recheck for the home sensor ( if (digitalRead(HOME_PIN) == 0 ) // Not moving but we're at home ), and set some variable if that's true, including _isAtHome = true;
So if the motor has gone too far and stopped the code above is false and doesn't report that the dome is not at home.