@@ -3182,13 +3182,27 @@ void Mount::setupInfoDisplay()
31823182void Mount::updateInfoDisplay ()
31833183{
31843184 #if (INFO_DISPLAY_TYPE != INFO_DISPLAY_TYPE_NONE)
3185- _loops++;
3186- // Update display every 8 cycles
3187- if (_loops % 8 == 0 )
3185+ // If we update this display too often while slewing, the serial port is unable to process commands fast enough. Which makes the driver
3186+ // timeout, causing ASCOM errors.
3187+ // We will update at 30Hz when idle, 5Hz when slewing one axis and skip updates when slewing both.
3188+ int refreshRateHz = 30 ;
3189+ long now = millis ();
3190+ if ((slewStatus () & (SLEWING_DEC | SLEWING_RA)) == (SLEWING_DEC | SLEWING_RA))
3191+ {
3192+ return ;
3193+ }
3194+
3195+ if (isSlewingRAorDEC ())
3196+ {
3197+ refreshRateHz = 5 ;
3198+ }
3199+
3200+ if (now - _lastInfoUpdate > (1000 / refreshRateHz))
31883201 {
31893202 LOG (DEBUG_DISPLAY, " [DISPLAY]: Render state to OLED ..." );
31903203 infoDisplay->render (this );
31913204 LOG (DEBUG_DISPLAY, " [DISPLAY]: Rendered state to OLED ..." );
3205+ _lastInfoUpdate = now;
31923206 }
31933207 #endif
31943208}
@@ -4011,14 +4025,14 @@ DayTime Mount::calculateLst()
40114025 DayTime timeUTC = getUtcTime ();
40124026 LocalDate localDate = getLocalDate ();
40134027 DayTime lst = Sidereal::calculateByDateAndTime (longitude ().getTotalHours (), localDate.year , localDate.month , localDate.day , &timeUTC);
4014- LOG (DEBUG_INFO,
4015- " [MOUNT]: Calculating LST. UTC time: %s. Date: %d-%d-%d. Longitude: %s" ,
4016- timeUTC.ToString (),
4017- localDate.year ,
4018- localDate.month ,
4019- localDate.day ,
4020- longitude ().ToString ());
4021- LOG (DEBUG_INFO, " [MOUNT]: LST is: %s" , lst.ToString ());
4028+ // LOG(DEBUG_INFO,
4029+ // "[MOUNT]: Calculating LST. UTC time: %s. Date: %d-%d-%d. Longitude: %s",
4030+ // timeUTC.ToString(),
4031+ // localDate.year,
4032+ // localDate.month,
4033+ // localDate.day,
4034+ // longitude().ToString());
4035+ // LOG(DEBUG_INFO, "[MOUNT]: LST is: %s", lst.ToString());
40224036 return lst;
40234037}
40244038
0 commit comments