Skip to content

Commit fb2e579

Browse files
V1.13.5 - Updates
- Track on boot from LCD bug fix. - DEC Guiding may have been misconfigured during parking and after slew to home (if guiding and slewing used different microsteps).
1 parent 2b79480 commit fb2e579

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**V1.13.5 - Updates**
2+
- Ported some bug fix code from the LCD branch (e.g. track on boot)
3+
- Potentially some DEC guide issues were fixed.
4+
15
**V1.13.4 - Updates**
26
- Inadvertantly removed some default #defines. Put them back.
37

Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// Also, numbers are interpreted as simple numbers. _ __ _
44
// So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/
55

6-
#define VERSION "V1.13.4"
6+
#define VERSION "V1.13.5"

src/Mount.cpp

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ void Mount::configureRAdriver(Stream *serial, float rsense, byte driveraddress,
441441
_driverRA->blank_time(24);
442442
_driverRA->microsteps(RA_TRACKING_MICROSTEPPING == 1 ? 0 : RA_TRACKING_MICROSTEPPING); // System starts in tracking mode
443443
_driverRA->fclktrim(4);
444-
_driverRA->TCOOLTHRS(0xFFFFF); //xFFFFF);
445-
_driverRA->semin(0); //disable CoolStep so that current is consistent
444+
_driverRA->TCOOLTHRS(0xFFFFF); //xFFFFF);
445+
_driverRA->semin(0); //disable CoolStep so that current is consistent
446446
_driverRA->SGTHRS(stallvalue);
447447
if (UART_Rx_connected)
448448
{
@@ -481,7 +481,7 @@ void Mount::configureRAdriver(uint16_t RA_SW_RX, uint16_t RA_SW_TX, float rsense
481481
_driverRA->semin(0); //disable CoolStep so that current is consistent
482482
_driverRA->microsteps(RA_TRACKING_MICROSTEPPING == 1 ? 0 : RA_TRACKING_MICROSTEPPING); // System starts in tracking mode
483483
_driverRA->fclktrim(4);
484-
_driverRA->TCOOLTHRS(0xFFFFF); //xFFFFF);
484+
_driverRA->TCOOLTHRS(0xFFFFF); //xFFFFF);
485485
_driverRA->SGTHRS(stallvalue);
486486
if (UART_Rx_connected)
487487
{
@@ -525,7 +525,7 @@ void Mount::configureDECdriver(Stream *serial, float rsense, byte driveraddress,
525525
_driverDEC->microsteps(
526526
DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING); // If 1 then disable microstepping. Start with Guide microsteps.
527527
_driverDEC->TCOOLTHRS(0xFFFFF);
528-
_driverDEC->semin(0); //disable CoolStep so that current is consistent
528+
_driverDEC->semin(0); //disable CoolStep so that current is consistent
529529
_driverDEC->SGTHRS(stallvalue);
530530
if (UART_Rx_connected)
531531
{
@@ -564,7 +564,7 @@ void Mount::configureDECdriver(uint16_t DEC_SW_RX, uint16_t DEC_SW_TX, float rse
564564
_driverDEC->microsteps(
565565
DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING); // If 1 then disable microstepping. Start with Guide microsteps
566566
_driverDEC->TCOOLTHRS(0xFFFFF);
567-
_driverDEC->semin(0); //disable CoolStep so that current is consistent
567+
_driverDEC->semin(0); //disable CoolStep so that current is consistent
568568
_driverDEC->SGTHRS(stallvalue);
569569
if (UART_Rx_connected)
570570
{
@@ -1199,6 +1199,7 @@ void Mount::setLST(const DayTime &lst)
11991199
/////////////////////////////////
12001200
void Mount::setLatitude(Latitude latitude)
12011201
{
1202+
LOG(DEBUG_GENERAL, "[MOUNT]: Setting longitude to %fs", latitude.getTotalHours());
12021203
_latitude = latitude;
12031204
configureHemisphere(_latitude.getTotalHours() > 0);
12041205
EEPROMStore::storeLatitude(_latitude);
@@ -1211,6 +1212,7 @@ void Mount::setLatitude(Latitude latitude)
12111212
/////////////////////////////////
12121213
void Mount::setLongitude(Longitude longitude)
12131214
{
1215+
LOG(DEBUG_GENERAL, "[MOUNT]: Setting longitude to %fs", longitude.getTotalHours());
12141216
_longitude = longitude;
12151217
EEPROMStore::storeLongitude(_longitude);
12161218

@@ -1396,14 +1398,17 @@ void Mount::startSlewingToTarget()
13961398

13971399
if (targetRAPosition != _stepperRA->currentPosition())
13981400
{
1399-
// Only stop tracking if we're actually going to slew somewhere else, otherwise the
1401+
// Only stop tracking if we're tracking and actually going to slew somewhere else, otherwise the
14001402
// mount::loop() code won't detect the end of the slewing operation...
1401-
LOG(DEBUG_STEPPERS, "[MOUNT]: Stop tracking (NEMA steppers)");
1402-
stopSlewing(TRACKING);
1403-
_trackerStoppedAt = millis();
1404-
_compensateForTrackerOff = true;
1403+
if (isSlewingTRK())
1404+
{
1405+
LOG(DEBUG_STEPPERS, "[MOUNT]: Stop tracking (NEMA steppers)");
1406+
stopSlewing(TRACKING);
1407+
_trackerStoppedAt = millis();
1408+
_compensateForTrackerOff = true;
1409+
}
14051410

1406-
// set Slew microsteps for TMC2209 UART once the TRK stepper has stopped
1411+
// Set RA to slew microsteps for TMC2209 UART once the TRK stepper has stopped
14071412
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
14081413
LOG(DEBUG_STEPPERS, "[STEPPERS]: startSlewingToTarget: Switching RA driver to microsteps(%d)", RA_SLEW_MICROSTEPPING);
14091414
_driverRA->microsteps(RA_SLEW_MICROSTEPPING == 1 ? 0 : RA_SLEW_MICROSTEPPING);
@@ -1547,7 +1552,7 @@ void Mount::guidePulse(byte direction, int duration)
15471552
float decGuidingSpeed = _stepsPerDECDegree * (DEC_GUIDE_MICROSTEPPING / DEC_SLEW_MICROSTEPPING) * siderealDegreesInHour
15481553
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
15491554
float raGuidingSpeed = _stepsPerRADegree * (RA_TRACKING_MICROSTEPPING / RA_SLEW_MICROSTEPPING) * siderealDegreesInHour
1550-
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
1555+
/ 3600.0f; // u-steps/deg * deg/hr / sec/hr = u-steps/sec
15511556
raGuidingSpeed *= _trackingSpeedCalibration;
15521557

15531558
// TODO: Do we need to track how many steps the steppers took and add them to the GoHome calculation?
@@ -2927,6 +2932,11 @@ void Mount::loop()
29272932
_targetRA = currentRA();
29282933
if (isParking())
29292934
{
2935+
// Set DEC to Slew microstepping since it is set to guiding.
2936+
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
2937+
LOG(DEBUG_STEPPERS, "[STEPPERS]: Loop: Parking. DEC driver setMicrosteps(%d)", DEC_SLEW_MICROSTEPPING);
2938+
_driverDEC->microsteps(DEC_SLEW_MICROSTEPPING == 1 ? 0 : DEC_SLEW_MICROSTEPPING);
2939+
#endif
29302940
LOG(DEBUG_MOUNT | DEBUG_STEPPERS, "[MOUNT]: Loop: Was parking, so no tracking. Proceeding to park position...");
29312941
_mountStatus &= ~STATUS_PARKING;
29322942
_slewingToPark = true;
@@ -2957,6 +2967,11 @@ void Mount::loop()
29572967
startSlewing(TRACKING);
29582968
}
29592969
_slewingToHome = false;
2970+
// Reset DEC to guide microstepping so that guiding is always ready and no switch is neccessary on guide pulses.
2971+
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
2972+
LOG(DEBUG_STEPPERS, "[STEPPERS]: Loop: Arrived at park. DEC driver setMicrosteps(%d)", DEC_GUIDE_MICROSTEPPING);
2973+
_driverDEC->microsteps(DEC_GUIDE_MICROSTEPPING == 1 ? 0 : DEC_GUIDE_MICROSTEPPING);
2974+
#endif
29602975
}
29612976
else if (_slewingToPark)
29622977
{
@@ -3392,14 +3407,16 @@ void Mount::moveStepperBy(StepperAxis direction, long steps)
33923407
case RA_STEPS:
33933408
if (steps != 0)
33943409
{
3395-
// Only stop tracking if we're actually going to slew somewhere else, otherwise the
3410+
// Only stop tracking if we're actually tracking and going to slew somewhere else, otherwise the
33963411
// mount::loop() code won't detect the end of the slewing operation...
3397-
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: Stop tracking (NEMA steppers)");
3398-
stopSlewing(TRACKING);
3399-
_trackerStoppedAt = millis();
3400-
_compensateForTrackerOff = true;
3401-
3402-
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: TRK stopped at %lms", _trackerStoppedAt);
3412+
if (isSlewingTRK())
3413+
{
3414+
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: Stop tracking (NEMA steppers)");
3415+
stopSlewing(TRACKING);
3416+
_trackerStoppedAt = millis();
3417+
_compensateForTrackerOff = true;
3418+
LOG(DEBUG_STEPPERS, "[STEPPERS]: moveStepperBy: TRK stopped at %lms", _trackerStoppedAt);
3419+
}
34033420
}
34043421

34053422
// set Slew microsteps for TMC2209 UART once the TRK stepper has stopped

src/c65_startup.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ void startupIsCompleted()
4444
inStartup = false;
4545
okToUpdateMenu = true;
4646

47+
#if TRACK_ON_BOOT == 1
48+
// Start tracking.
49+
LOG(DEBUG_ANY, "[STARTUP]: Start Tracking.");
4750
mount.startSlewing(TRACKING);
51+
#endif
4852

4953
// Start on the RA menu
5054
lcdMenu.setActive(RA_Menu);
5155
lcdMenu.updateDisplay();
56+
LOG(DEBUG_ANY, "[STARTUP]: Completed!");
5257
}
5358

5459
bool processStartupKeys()

0 commit comments

Comments
 (0)