Skip to content

Commit

Permalink
Fix for custom guide rates
Browse files Browse the repository at this point in the history
  • Loading branch information
hjd1964 committed Mar 10, 2022
1 parent 4829c1e commit 96a9b74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Command.ino
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ void processCommands() {
reply[i++]='0'+getPulseGuideRate();

// provide guide rate
reply[i++]='0'+getGuideRate();
if (currentGuideRate == -1) reply[i++]='9'; else reply[i++]='0'+currentGuideRate;

// provide general error
reply[i++]='0'+generalError;
Expand Down Expand Up @@ -812,7 +812,7 @@ void processCommands() {
#endif
reply[5]=parkStatus|0b10000000; // Park status: 0 not parked, 1 parking in-progress, 2 parked, 3 park failed
reply[6]=getPulseGuideRate()|0b10000000; // Pulse-guide rate
reply[7]=getGuideRate()|0b10000000; // Guide rate
if (currentGuideRate == -1) reply[7]=9|0b10000000; else reply[7]=currentGuideRate|0b10000000; // Guide rate
reply[8]=generalError|0b10000000; // General error
reply[9]=0;
boolReply=false;
Expand Down Expand Up @@ -1481,7 +1481,7 @@ void processCommands() {
if (&parameter[0] != conv_end) {
if (f < 0.001/60.0/60.0) f=0.001/60.0/60.0;
if (f > maxStepsPerSecond/axis1Settings.stepsPerMeasure) f=maxStepsPerSecond/axis1Settings.stepsPerMeasure;
customGuideRateAxis1(f*240.0,GUIDE_TIME_LIMIT*1000);
customGuideRateAxis1(f*240.0);
}
boolReply=false;
} else
Expand All @@ -1493,7 +1493,7 @@ void processCommands() {
if (&parameter[0] != conv_end) {
if (f < 0.001/60.0/60.0) f=0.001/60.0/60.0;
if (f > maxStepsPerSecond/axis2Settings.stepsPerMeasure) f=maxStepsPerSecond/axis2Settings.stepsPerMeasure;
customGuideRateAxis2(f*240.0,GUIDE_TIME_LIMIT*1000);
customGuideRateAxis2(f*240.0);
}
boolReply=false;
} else
Expand Down
2 changes: 1 addition & 1 deletion Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ double guideRates[10]={3.75,7.5,15,30,60,120,300,720, 720, 720};
#define GuideRateDefault 6
#endif
#define GuideRateNone 255
byte currentGuideRate = GuideRateDefault;
int currentGuideRate = GuideRateDefault;
byte currentPulseGuideRate = GuideRate1x;
volatile byte activeGuideRate = GuideRateNone;

Expand Down
26 changes: 4 additions & 22 deletions Guide.ino
Original file line number Diff line number Diff line change
Expand Up @@ -337,29 +337,16 @@ void guideSpiralPoll() {
}

// custom guide rate in RA or Azm, rate is in x-sidereal, guideDuration is in ms (0 to ignore)
bool customGuideRateAxis1(double rate, long guideDuration) {
bool customGuideRateAxis1(double rate) {
guideTimerCustomRateAxis1=rate;
enableGuideRate(-1);
if ((parkStatus == NotParked) && (trackingState != TrackingMoveTo) && (axis1Enabled) && (guideDirAxis1)) {
guideTimeThisIntervalAxis1=micros();
guideTimeRemainingAxis1=guideDuration*1000L;
if (guideDirAxis1 == 'e') { cli(); guideTimerRateAxis1=-guideTimerBaseRateAxis1; sei(); }
if (guideDirAxis1 == 'w') { cli(); guideTimerRateAxis1= guideTimerBaseRateAxis1; sei(); }
} else return false;
currentGuideRate=-1;
return true;
}

// custom guide rate in Dec or Alt, rate is in x-sidereal, guideDuration is in ms (0 to ignore)
bool customGuideRateAxis2(double rate, long guideDuration) {
bool customGuideRateAxis2(double rate) {
guideTimerCustomRateAxis2=rate;
enableGuideRate(-1);
if ((parkStatus == NotParked) && (trackingState != TrackingMoveTo) && (axis2Enabled) && (guideDirAxis2)) {
guideTimeThisIntervalAxis2=micros();
guideTimeRemainingAxis2=guideDuration*1000L;
if (guideDirAxis2 == 's') { cli(); guideTimerRateAxis2=-guideTimerBaseRateAxis2; sei(); }
if (guideDirAxis2 == 'n') { cli(); guideTimerRateAxis2= guideTimerBaseRateAxis2; sei(); }
if (getInstrPierSide() == PierSideWest) { cli(); guideTimerRateAxis2=-guideTimerRateAxis2; sei(); }
} else return false;
currentGuideRate=-1;
return true;
}

Expand All @@ -371,11 +358,6 @@ void setGuideRate(int g) {
guideTimerCustomRateAxis2=0.0;
}

// gets the rate for guide commands
int getGuideRate() {
return currentGuideRate;
}

// gets the rate for pulse-guide commands
int getPulseGuideRate() {
#if SEPARATE_PULSE_GUIDE_RATE == ON
Expand Down

0 comments on commit 96a9b74

Please sign in to comment.