diff --git a/src/applications/tkcontrollerapp.py b/src/applications/tkcontrollerapp.py index aab2c95..d84f567 100644 --- a/src/applications/tkcontrollerapp.py +++ b/src/applications/tkcontrollerapp.py @@ -23,6 +23,13 @@ help='When true,logger level will be set to warning. Otherwise, set to "info".') parser.add_argument('-t', '--test', action = 'store_true', help='This is for development testing.') +parser.add_argument('-pmin', '--piezo-min-position', metavar = 'microns', default = 0, type=float, + help='sets min allowed position on piezo controller.') +parser.add_argument('-pmax', '--piezo-max-position', metavar = 'microns', default = 80, type=float, + help='sets min allowed position on piezo controller.') +parser.add_argument('-pscale', '--piezo-scale-microns-per-volt', default = 8, type=float, + help='sets micron to volt scale for piezo controller.') + args = parser.parse_args() logger = logging.getLogger(__name__) @@ -204,7 +211,10 @@ def build_controller(): controller = nipiezojenapy.PiezoControl(device_name = args.daq_name, write_channels = args.piezo_write_channels.split(','), read_channels = args.piezo_read_channels.split(','), - move_settle_time = args.settle_time) + move_settle_time = args.settle_time, + min_position = args.piezo_min_position, + max_position = args.piezo_max_position, + scale_microns_per_volt = args.piezo_scale_microns_per_volt) return controller def main(): diff --git a/src/nipiezojenapy/controller.py b/src/nipiezojenapy/controller.py index fb27453..2b86856 100644 --- a/src/nipiezojenapy/controller.py +++ b/src/nipiezojenapy/controller.py @@ -6,9 +6,9 @@ logger = logging.getLogger(__name__) class BaseControl: - def __init__(self): - self.minimum_allowed_position = 0.00 - self.maximum_allowed_position = 80.0 + def __init__(self, min_allowed_position = 0.0, max_allowed_position = 80.0): + self.minimum_allowed_position = min_allowed_position + self.maximum_allowed_position = max_allowed_position self.last_write_values = [0, 0, 0] def _validate_value(self, position: float) -> None: @@ -81,7 +81,7 @@ def __init__(self, device_name: str, move_settle_time: float = 0.001, min_position: float = 0.0, max_position: float = 80.0) -> None: - super().__init__() + super().__init__(min_allowed_position = min_position, max_allowed_position = max_position) self.device_name = device_name self.write_channels = write_channels