99
1010import AutoSTAR_remote_ui
1111
12- version = "V1.0"
12+ version = "V1.0.1 "
1313
1414theme_selection = "Dark" # "Dark", "Light"
1515LCD_polling_time = 1000 # milliseconds
16+ LCD_earlyUpdate_time = 200 # milliseconds
1617
1718"""
1819By watching the RS232 communication of the AutoStart Suit telescope control I found the following commands:
@@ -135,7 +136,9 @@ def on_actionconnect_triggered(self):
135136 self .ui .actiondisconnect .setEnabled (True )
136137 self .ui .centralwidget .setEnabled (True )
137138 if self .ui .actionpoll .isChecked ():
138- self .PollingTimer .start ()
139+ if not self .PollingTimer .isActive ():
140+ self .PollingTimer .setInterval (LCD_earlyUpdate_time )
141+ self .PollingTimer .start ()
139142 self .ui .actionupdate_now .setEnabled (True )
140143
141144 @QtCore .pyqtSlot ()
@@ -158,7 +161,13 @@ def sendAction(self, param):
158161 def sendCommandBlind (self , cmd ):
159162 if self .Telescope is not None :
160163 if self .Telescope .Connected :
161- return self .Telescope .CommandBlind (cmd , False )
164+ try :
165+ ret = self .Telescope .CommandBlind (cmd , False )
166+ except win32com .client .pywintypes .com_error as e :
167+ print (f'sendCommandBlind: { e } ' )
168+ return None
169+ else :
170+ return ret
162171 return None
163172
164173 def buttonAction (self , cmd , long_cmd = None ):
@@ -172,9 +181,12 @@ def buttonAction(self, cmd, long_cmd=None):
172181 self .sendCommandBlind (long_cmd )
173182 else :
174183 self .sendCommandBlind (cmd )
175- self .updateLCD ()
184+ # delayed LCD update
185+ self .PollingTimer .stop ()
186+ self .PollingTimer .setInterval (LCD_earlyUpdate_time )
187+ self .PollingTimer .start ()
176188
177- # The :ED# command sends the LCD contents, coded withthe char table of the SED1233 LCD controller.
189+ # The :ED# command sends the LCD contents, coded with the char table of the SED1233 LCD controller.
178190 # For any reason the COM interface or the win32com transforms this into unicode. Unfortunately the
179191 # special characters of the SED1233 controller get mapped to the wrong unicode. Here we fix this
180192 # with a translation table:
@@ -197,8 +209,14 @@ def buttonAction(self, cmd, long_cmd=None):
197209 }
198210
199211 def updateLCD (self ):
200- #LcdText = self.sendAction("readdisplay")
201- LcdText = self .Telescope .CommandString ("ED" , False )
212+ try :
213+ LcdText = self .Telescope .CommandString ("ED" , False )
214+ except win32com .client .pywintypes .com_error as e :
215+ # Sometimes the handbox needs long time for calculations and does not
216+ # send the LCD contents bfore the ASCOM driver trows a timeout exception.
217+ # Here we catch these timeout exceptions.
218+ print (f'updateLCD: { e } ' )
219+ LcdText = None
202220 if LcdText is not None :
203221 LcdText = LcdText .translate (self .CharacterTranslationTable )
204222 Unknown = ord (LcdText [0 ])
@@ -209,7 +227,9 @@ def updateLCD(self):
209227 #print(", ".join([f'{ord(c):02X}' for c in LcdText]))
210228 #print(bytes(LcdText, 'utf-8'))
211229 if self .ui .actionpoll .isChecked ():
212- self .PollingTimer .start ()
230+ if not self .PollingTimer .isActive ():
231+ self .PollingTimer .setInterval (LCD_polling_time )
232+ self .PollingTimer .start ()
213233
214234 @QtCore .pyqtSlot ()
215235 def on_actionupdate_now_triggered (self ):
@@ -219,7 +239,7 @@ def on_actionupdate_now_triggered(self):
219239 def on_actionpoll_toggled (self , isChecked ):
220240 if isChecked :
221241 # start polling timer
222- self .PollingTimer . start ()
242+ self .updateLCD ()
223243 else :
224244 # stop polling timer
225245 self .PollingTimer .stop ()
0 commit comments