@@ -149,36 +149,43 @@ bool processCalibrationKeys() {
149
149
}
150
150
}
151
151
else if (calState == AZIMUTH_CONTROL) {
152
- if (lcdButtons.currentState () == btnUP) {
152
+ if (lcdButtons.currentState () == btnLEFT) {
153
+ // Speed up to the left
153
154
if (AzimuthSpeed < 100 ) {
154
155
AzimuthSpeed += 1 ; // 0.0001;
155
156
}
156
157
157
- calDelay = max (2 , 0.96 * calDelay);
158
+ // Accelerate speed increase over time
159
+ calDelay = max (2 , 0.98 * calDelay);
158
160
checkForKeyChange = false ;
159
161
}
160
- else if (lcdButtons.currentState () == btnDOWN) {
162
+ else if (lcdButtons.currentState () == btnRIGHT) {
163
+ // Speed up to the right
161
164
if (AzimuthSpeed > -100 ) {
162
165
AzimuthSpeed -= 1 ; // 0.0001;
163
166
}
164
167
165
- calDelay = max (2 , 0.96 * calDelay);
168
+ // Accelerate speed increase over time
169
+ calDelay = max (2 , 0.98 * calDelay);
166
170
checkForKeyChange = false ;
167
171
}
168
172
else {
173
+ // No more buttons pressed, decelerate at 3% per cycle
169
174
if (AzimuthSpeed > 0 ) {
170
- AzimuthSpeed = adjustClamp (AzimuthSpeed, -5 , 0 , 100 );
175
+ AzimuthSpeed = adjustClamp (AzimuthSpeed, -3 , 0 , 100 );
171
176
}
172
177
else if (AzimuthSpeed < 0 ) {
173
- AzimuthSpeed = adjustClamp (AzimuthSpeed, 5 , -100 , 0 );
178
+ AzimuthSpeed = adjustClamp (AzimuthSpeed, 3 , -100 , 0 );
174
179
}
175
180
else {
181
+ // Once we're stopped, set the initial key delay back to 100ms
176
182
calDelay = 100 ;
177
183
}
178
184
}
179
185
186
+ // If we changed speeds, tell the mount motor
180
187
if (AzimuthSpeed != lastAzimuthSpeed) {
181
- mount.setSpeed (AZIMUTH_STEPS, 500 .0 * AzimuthSpeed / 100.0 );
188
+ mount.setSpeed (AZIMUTH_STEPS, 300 .0 * AzimuthSpeed / 100.0 );
182
189
lastAzimuthSpeed = AzimuthSpeed;
183
190
}
184
191
0 commit comments