Skip to content

Commit

Permalink
Other fixes wip
Browse files Browse the repository at this point in the history
  • Loading branch information
gnthibault committed Aug 20, 2023
1 parent 0f12889 commit 5660dde
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 37 deletions.
14 changes: 7 additions & 7 deletions conf_files/config_backyard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ cameras:
indi_client:
indi_host: localhost
indi_port: 7628
indi_webmanager:
module: IndiWebManagerClient
master_host: localhost
master_port: 8624
host: localhost
port: 8628
profile_name: altair_pointing
indi_webmanager:
module: IndiWebManagerClient
master_host: localhost
master_port: 8624
host: localhost
port: 8628
profile_name: altair_pointing
pointer:
module: IterativeSync #DifferentialPointer #IterativeSync
gen_hips: False
Expand Down
64 changes: 43 additions & 21 deletions conf_files/spectral_targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,49 @@ targets :
gain: 150
offset: 30
exp_time_sec : 5
# "T CrB" :
# priority : 0
# count : 1
# temperature : 10
# gain: 150
# offset: 30
# exp_time_sec : 20
# "V375 Lac" :
# priority : 0
# count : 2
# temperature : 10
# gain: 150
# offset: 30
# exp_time_sec : 5
# "GK Per":
# priority: 0
# count: 2
# temperature: 15
# gain: 150
# offset: 30
# exp_time_sec: 5
"T CrB" :
priority : 0
count : 1
temperature : 10
gain: 150
offset: 30
exp_time_sec : 20
"V375 Lac" :
priority : 0
count : 2
temperature : 10
gain: 150
offset: 30
exp_time_sec : 5
"GK Per":
priority: 0
count: 2
temperature: 15
gain: 150
offset: 30
exp_time_sec: 5
"Alkaid":
priority: 0
count: 2
temperature: 15
gain: 150
offset: 30
exp_time_sec: 5
"Mizar":
priority: 0
count: 2
temperature: 15
gain: 150
offset: 30
exp_time_sec: 5
"Alioth":
priority: 0
count: 2
temperature: 15
gain: 150
offset: 30
exp_time_sec: 5

reference_observation:
count : 10
temperature : 10
Expand Down
2 changes: 1 addition & 1 deletion helper/IndiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, config):

self.indi_webmanager_client = IndiWebManagerDummy()
if "indi_webmanager" in config:
self.indi_webmanager_client = IndiWebManagerClient(config["indi_webmanager"])
self.indi_webmanager_client = IndiWebManagerClient(config["indi_webmanager"], indi_config=config)

# Start the main ioloop that will serve all async task in another (single) thread
self.device_subscriptions = {} # dict of device_name: coroutines
Expand Down
7 changes: 4 additions & 3 deletions helper/IndiDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,14 @@ def stop_indi_server(self):
else:
# Setup temporary webmanager client
if "indi_webmanager" in self.indi_client_config:
iwmc = IndiWebManagerClient(self.indi_client_config["indi_webmanager"])
iwmc.stop_server()
iwmc = IndiWebManagerClient(config=self.indi_client_config["indi_webmanager"],
indi_config=self.indi_client_config)
iwmc.stop_server(device_name=self.device_name)

def start_indi_server(self):
if self.indi_client is None:
self._setup_indi_client()
self.indi_client.indi_webmanager_client.start_server()
self.indi_client.indi_webmanager_client.start_server(device_name=self.device_name)

def start_indi_driver(self):
self.indi_client.indi_webmanager_client.start_driver(
Expand Down
12 changes: 7 additions & 5 deletions helper/IndiWebManagerClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import urllib.parse

class IndiWebManagerDummy:
def __init__(self, config=None):
def __init__(self, config=None, indi_config=None):
pass
def build_remote_driver_name(self, device_name):
pass
Expand All @@ -30,7 +30,7 @@ def stop_driver(self, driver_name, master=False):

class IndiWebManagerClient:

def __init__(self, config):
def __init__(self, config, indi_config=None):
self.logger = logging.getLogger(__name__)
if config is None:
config = dict(
Expand All @@ -46,9 +46,11 @@ def __init__(self, config):
self.host = config["host"]
self.port = config["port"]
self.profile_name = config["profile_name"]
# Indi config
self.indi_config = indi_config

def build_remote_driver_name(self, device_name):
return f'"{device_name}"@{self.host}:{self.port}'
return f'"{device_name}"@{self.indi_config["indi_host"]}:{self.indi_config["indi_port"]}'

def reset_server(self, device_name=None):
status, profile = self._get_server_status()
Expand Down Expand Up @@ -118,14 +120,14 @@ def is_driver_started(self, driver_name, master=False):
host, port = self.master_host, self.master_port
else:
host, port = self.host, self.port
return driver_name in self.get_running_driver_list(host=host, port=port)
return driver_name in self.get_running_driver_list(master=master)

def get_running_driver_list(self, master=False):
if master:
host, port = self.master_host, self.master_port
else:
host, port = self.host, self.port
running_driver_list = self.get_running_driver(host=host, port=port)
running_driver_list = self.get_running_driver(master=master)
return [driver["name"] for driver in running_driver_list]

def get_running_driver(self, master=False):
Expand Down

0 comments on commit 5660dde

Please sign in to comment.