def check_ksp_connection(self): """ checks if we have a connection to Telemachus / KSP :return: None """ if not check_connection(): if self.is_ksp_connected: # we have just lost the connection, illuminate NO ATT annunciator and log it self.dsky.annunciators["no_att"].on() utils.log("No connection to KSP, navigation functions unavailable", log_level="ERROR") self.is_ksp_connected = False else: if not self.is_ksp_connected: # have just regained connection, deluminate NO ATT annunciator and log it self.dsky.annunciators["no_att"].off() utils.log("Connection to KSP established", log_level="INFO") self.is_ksp_connected = True if not telemachus.telemetry: telemachus.get_api_listing()
def on(self): """ Turns the guidance computer on. :return: None """ utils.log("Computer booting...", log_level="INFO") # attempt to load telemetry listing try: telemachus.telemetry = telemachus.get_api_listing() except telemachus.KSPNotConnected: utils.log("Cannot retrieve telemetry listing - no connection to KSP", log_level="WARNING") self.dsky.annunciators["no_att"].on() else: utils.log("Retrieved telemetry listing", log_level="INFO") self.loop_timer.Start(config.LOOP_TIMER_INTERVAL) self.is_powered_on = True for display_item in self.dsky.static_display: display_item.on()