diff --git a/AutoSTAR_remote_V1.0.png b/AutoSTAR_remote_V1.0.png new file mode 100644 index 0000000..35f7b1e Binary files /dev/null and b/AutoSTAR_remote_V1.0.png differ diff --git a/README.md b/README.md index 9ed9318..07c6e5d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # AutoSTAR_remote This is a GUI to remote control (using ASCOM) the Meade AutoSTAR #497 handheld. +![screenshot](AutoSTAR_remote_V1.0.png) + +Press [SHIFT] when clicking on "ENTER", "MODE" or "GO TO" to generate a long key press. + It requires the ASCOM driver from https://bitbucket.org/cjdskunkworks/meadeautostar497 diff --git a/src/AutoSTAR_remote.py b/src/AutoSTAR_remote.py index 6d5c6e8..5a6a52f 100644 --- a/src/AutoSTAR_remote.py +++ b/src/AutoSTAR_remote.py @@ -9,10 +9,11 @@ import AutoSTAR_remote_ui -version = "V1.0" +version = "V1.0.1" theme_selection = "Dark" # "Dark", "Light" LCD_polling_time = 1000 # milliseconds +LCD_earlyUpdate_time = 200 # milliseconds """ By watching the RS232 communication of the AutoStart Suit telescope control I found the following commands: @@ -135,7 +136,9 @@ def on_actionconnect_triggered(self): self.ui.actiondisconnect.setEnabled(True) self.ui.centralwidget.setEnabled(True) if self.ui.actionpoll.isChecked(): - self.PollingTimer.start() + if not self.PollingTimer.isActive(): + self.PollingTimer.setInterval(LCD_earlyUpdate_time) + self.PollingTimer.start() self.ui.actionupdate_now.setEnabled(True) @QtCore.pyqtSlot() @@ -158,7 +161,13 @@ def sendAction(self, param): def sendCommandBlind(self, cmd): if self.Telescope is not None: if self.Telescope.Connected: - return self.Telescope.CommandBlind(cmd, False) + try: + ret = self.Telescope.CommandBlind(cmd, False) + except win32com.client.pywintypes.com_error as e: + print(f'sendCommandBlind: {e}') + return None + else: + return ret return None def buttonAction(self, cmd, long_cmd=None): @@ -172,9 +181,12 @@ def buttonAction(self, cmd, long_cmd=None): self.sendCommandBlind(long_cmd) else: self.sendCommandBlind(cmd) - self.updateLCD() + # delayed LCD update + self.PollingTimer.stop() + self.PollingTimer.setInterval(LCD_earlyUpdate_time) + self.PollingTimer.start() - # The :ED# command sends the LCD contents, coded withthe char table of the SED1233 LCD controller. + # The :ED# command sends the LCD contents, coded with the char table of the SED1233 LCD controller. # For any reason the COM interface or the win32com transforms this into unicode. Unfortunately the # special characters of the SED1233 controller get mapped to the wrong unicode. Here we fix this # with a translation table: @@ -197,8 +209,14 @@ def buttonAction(self, cmd, long_cmd=None): } def updateLCD(self): - #LcdText = self.sendAction("readdisplay") - LcdText = self.Telescope.CommandString("ED", False) + try: + LcdText = self.Telescope.CommandString("ED", False) + except win32com.client.pywintypes.com_error as e: + # Sometimes the handbox needs long time for calculations and does not + # send the LCD contents bfore the ASCOM driver trows a timeout exception. + # Here we catch these timeout exceptions. + print(f'updateLCD: {e}') + LcdText = None if LcdText is not None: LcdText = LcdText.translate(self.CharacterTranslationTable) Unknown = ord(LcdText[0]) @@ -209,7 +227,9 @@ def updateLCD(self): #print(", ".join([f'{ord(c):02X}' for c in LcdText])) #print(bytes(LcdText, 'utf-8')) if self.ui.actionpoll.isChecked(): - self.PollingTimer.start() + if not self.PollingTimer.isActive(): + self.PollingTimer.setInterval(LCD_polling_time) + self.PollingTimer.start() @QtCore.pyqtSlot() def on_actionupdate_now_triggered(self): @@ -219,7 +239,7 @@ def on_actionupdate_now_triggered(self): def on_actionpoll_toggled(self, isChecked): if isChecked: # start polling timer - self.PollingTimer.start() + self.updateLCD() else: # stop polling timer self.PollingTimer.stop()