Skip to content

Commit

Permalink
adding the init of the UI with config values
Browse files Browse the repository at this point in the history
  • Loading branch information
seb5g committed Oct 14, 2024
1 parent 09203d3 commit b513207
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 9 additions & 3 deletions src/pymodaq_plugins_arduino/daq_move_plugins/daq_move_Servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@


from pymodaq.control_modules.move_utility_classes import (DAQ_Move_base, comon_parameters_fun, main,
DataActuatorType,
DataActuatorType, Q_,
DataActuator)
from pymodaq_utils.utils import ThreadCommand
from pymodaq_gui.parameter import Parameter


from pymodaq_plugins_arduino.hardware.arduino_telemetrix import Arduino
from pymodaq_plugins_arduino.utils import Config

Expand All @@ -27,7 +28,7 @@ class DAQ_Move_Servo(DAQ_Move_base):
"""
_axis_names = {'Servo': config('servo', 'pin')}
_controller_units = {'Servo': '°'}
_controller_units = {'Servo': ''}
_epsilons = {'Servo': 1}

data_actuator_type = DataActuatorType['DataActuator']
Expand Down Expand Up @@ -66,7 +67,6 @@ def commit_settings(self, param: Parameter):
param: Parameter
A given parameter (within detector_settings) whose value has been changed by the user
"""
## TODO for your custom plugin
pass

def ini_stage(self, controller=None):
Expand All @@ -93,6 +93,12 @@ def ini_stage(self, controller=None):
)
self.controller.set_pin_mode_servo(config('servo', 'pin'))

self.emit_status(ThreadCommand('update_ui', attribute='set_abs_value_red',
args=[Q_(config('servo', 'pos_1'),
self.controller_units['Servo'])]))
self.emit_status(ThreadCommand('update_ui', attribute='set_abs_value_green',
args=[Q_(config('servo', 'pos_12'),
self.controller_units['Servo'])]))
info = "Whatever info you want to log"
initialized = True
return info, initialized
Expand Down
12 changes: 7 additions & 5 deletions src/pymodaq_plugins_arduino/resources/config_template.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
title = "this is the configuration file of the plugin Arduino"

com_port = "COM23"
com_port = "COM24"

[presets]
preset_for_colorsynthesizer = "ArduinoLED"

[LED]
[LED.pins]
red_pin = 9
green_pin = 10
blue_pin = 11
red_pin = 6
green_pin = 4
blue_pin = 5

[LCD]
address = 0x27
cols = 16
rows = 2

[servo]
pin = 3
pin = 2
pos_1 = 55
pos_2 = 80

0 comments on commit b513207

Please sign in to comment.