Skip to content

Commit

Permalink
TMCL-Mdoule: Add the facilities to store axis parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
trinamic-bp committed Jan 15, 2025
1 parent 7b1e5b3 commit ee747bd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pytrinamic/modules/tmcl_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,16 @@ def _set_global_parameter(self, index: int, bank: int, value: int):
class AxisParameterApiDevice(ABC):

def get_parameter(self, get_target: Union[Parameter]):
"""Get an axis parameter value via the GAP command."""
return self._get_parameter(get_target)

def set_parameter(self, set_target: Union[Parameter, Parameter.Option], value: Optional[Union[int, bool]] = None):
"""Set an axis parameter value via the SAP command."""
return self._set_parameter(set_target, value)

def store_parameter(self, store_target: Union[Parameter]):
"""Store an axis parameter value via the STAP command."""
return self._store_parameter(store_target)

def _get_parameter(self, get_target: Union[Parameter]):
if isinstance(get_target, Parameter):
Expand Down Expand Up @@ -338,6 +344,15 @@ def _set_parameter(self, set_target: Union[Parameter, Parameter.Option], value:
value,
)

def _store_parameter(self, store_target: Union[Parameter]):
if isinstance(store_target, Parameter):
ap = store_target
else:
raise ValueError("store_target must be a Parameter object.")
return self._store_axis_parameter(
ap.index,
)

@abstractmethod
def _get_axis_parameter(self, index: int, signed: bool):
raise NotImplementedError
Expand All @@ -346,6 +361,10 @@ def _get_axis_parameter(self, index: int, signed: bool):
def _set_axis_parameter(self, index: int, value: int):
raise NotImplementedError

@abstractmethod
def _store_axis_parameter(self, index: int):
raise NotImplementedError


class GlobalParameterApiDevice(ABC):

Expand Down

0 comments on commit ee747bd

Please sign in to comment.