Commit 6f38744a authored by Davide Ricci's avatar Davide Ricci
Browse files

Update .gitlab-ci.yml file

  - Source Commit: 2dddaf83
  - Date: 2025-05-28 16:07:34
  - Job ID: 117306
  - Pipeline ID: 28998
  - [skip ci]
parent 2dddaf83
Loading
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
'''
Main package
'''
+3 −2
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ alt = 1469 # [m] Altitude above sea level.
############

dome_park_position = 57  # azimuth
telescope_flat_position = [24, 240] # alt, az to point the screen with dome parked
# alt, az to point the screen with dome parked
telescope_flat_position = [24, 240]

open_state = {
    0: "Open",
+14 −11
Original line number Diff line number Diff line
@@ -6,12 +6,12 @@ Import devices using configuration files
'''

# System modules
import importlib
import configparser
import importlib
import sys
from pathlib import Path

# Custom modules
# Other templates
from ..utils.url_stuff import build_url

this_module = sys.modules[__name__]
@@ -22,6 +22,7 @@ devs = configparser.ConfigParser()
nodes.read(Path(__file__).parent.parent / 'config' / 'nodes.ini')
devs.read(Path(__file__).parent.parent / 'config' / 'devices.ini')


def dynamic_import(this, dev):
    """Dynamically import into this module the devices
    from the nodes.ini and devices.ini files.
@@ -33,7 +34,8 @@ def dynamic_import(this, dev):

    """

    module = importlib.import_module(__package__ +"."+ devs.get(dev, "module") )
    module = importlib.import_module(
        __package__ + "." + devs.get(dev, "module"))
    cls = getattr(module, devs.get(dev, "class"))

    node = devs.get(dev, "node")
@@ -59,6 +61,7 @@ def dynamic_import(this, dev):
    # Set the instance as an attribute of the current object
    setattr(this, instance_name, instance)


for dev in devs.sections():
    print(f"importing {dev}")
    dynamic_import(this_module, dev)
+6 −6
Original line number Diff line number Diff line
@@ -8,11 +8,11 @@ from urllib.parse import urlencode
# Third-party modules
import requests

# Custom modules
from .basedevice import BaseDevice
# Other templates
from ..config.constants import dome_park_position
from ..utils import check
from ..utils.logger import log
from .basedevice import BaseDevice


class AlpacaDevice(BaseDevice):
@@ -128,7 +128,7 @@ class AlpacaDevice(BaseDevice):
            try:
                float(value)
                return float(value)
            except:
            except BaseException:
                return value

    def commandblind(self, val):
+51 −50
Original line number Diff line number Diff line
@@ -8,10 +8,11 @@ Interface with an Astelco OpenTSI-based device
# System modules
import telnetlib

# Custom modules
from .basedevice import BaseDevice
# Other templates
from ..utils import check
from ..utils.logger import log
from .basedevice import BaseDevice


class OpenTSI(BaseDevice):
    '''Base wrapper class for astelco OpenTSI stuff'''
@@ -56,8 +57,10 @@ class OpenTSI(BaseDevice):
            msglist = message

        # GET: Transforming every string in "1 get string\n2 get string\n"
        # SET: Transforming every string in "1 set string=val\n2 set string=val"
        msg = [f"{i+1} {get_or_set.upper()} {j}\n" for i, j in enumerate(msglist)]
        # SET: Transforming every string in "1 set string=val\n2 set
        # string=val"
        msg = [f"{i + 1} {get_or_set.upper()} {j}\n" for i,
               j in enumerate(msglist)]
        # From list to string, and byte-coded
        msg = bytes("".join(msg), "utf+8")

@@ -113,10 +116,10 @@ class OpenTSI(BaseDevice):

            try:
                telnet_dict[k] = int(v)
            except:
            except BaseException:
                try:
                    telnet_dict[k] = float(v)
                except:
                except BaseException:
                    try:
                        telnet_dict[k] = str(v.replace('"', ''))
                    except ValueError as e:
@@ -131,7 +134,6 @@ class OpenTSI(BaseDevice):
        else:
            return res[0]

        
    def get(self, message):
        '''Send a telnet message to the cabinet to retrieve a value or a set
        of values.'''
@@ -503,7 +505,6 @@ class Rotator(OpenTSI):
        return self._absolute



class Sensor(OpenTSI):
    '''Implementation of a Sensor class.'''

Loading