Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Feb 4, 2025
2 parents 1d561af + 042408b commit 49cbe3a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mycodo/outputs/on_off_pinctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def switch_pin(self, pin, state):
set_opt = "dl"
cmd = f"pinctrl set {pin} {set_opt}"
cmd_return, cmd_error, cmd_status = cmd_output(cmd, user="root")
state_text = 'ON' if state else 'OFF'
self.logger.debug(
f"GPIO {self.options_channels['pin'][0]} set ON with '{cmd}': "
f"GPIO {pin} set {state_text} with '{cmd}': "
f"Status: {cmd_status}, Return: {cmd_return}, Error: {cmd_error}")
24 changes: 22 additions & 2 deletions mycodo/outputs/pump_l298n_pi5.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,29 @@ def initialize(self):
"Check your configuration.")
self.channel_setup[channel] = False
else:
cmd = f"pinctrl set {self.options_channels['pin_1'][channel]} op dl"
cmd_return, cmd_error, cmd_status = cmd_output(cmd, user="root")
self.logger.debug(
f"GPIO {self.options_channels['pin_1'][channel]} setup with '{cmd}': "
f"Status: {cmd_status}, Return: {cmd_return}, Error: {cmd_error}")

cmd = f"pinctrl set {self.options_channels['pin_2'][channel]} op dl"
cmd_return, cmd_error, cmd_status = cmd_output(cmd, user="root")
self.logger.debug(
f"GPIO {self.options_channels['pin_2'][channel]} setup with '{cmd}': "
f"Status: {cmd_status}, Return: {cmd_return}, Error: {cmd_error}")

cmd = f"pinctrl set {self.options_channels['pin_enable'][channel]} op dl"
cmd_return, cmd_error, cmd_status = cmd_output(cmd, user="root")
self.logger.debug(
f"GPIO {self.options_channels['pin_enable'][channel]} setup with '{cmd}': "
f"Status: {cmd_status}, Return: {cmd_return}, Error: {cmd_error}")

self.channel_setup[channel] = True
self.output_setup = True
self.output_states[channel] = False

self.output_setup = True

def output_switch(self, state, output_type=None, amount=None, output_channel=None):
if not self.is_setup():
msg = "Error 101: Device not set up. " \
Expand Down Expand Up @@ -280,6 +299,7 @@ def switch_pin(self, pin, state):
set_opt = "dl"
cmd = f"pinctrl set {pin} {set_opt}"
cmd_return, cmd_error, cmd_status = cmd_output(cmd, user="root")
state_text = 'ON' if state else 'OFF'
self.logger.debug(
f"GPIO {self.options_channels['pin'][0]} set ON with '{cmd}': "
f"GPIO {pin} set {state_text} with '{cmd}': "
f"Status: {cmd_status}, Return: {cmd_return}, Error: {cmd_error}")

0 comments on commit 49cbe3a

Please sign in to comment.