Skip to content

Commit

Permalink
Adjustments and additional logging for config upgrade.
Browse files Browse the repository at this point in the history
  • Loading branch information
kantlivelong committed Apr 18, 2021
1 parent c6f0b1a commit 32915ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions octoprint_psucontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,10 @@ def on_settings_migrate(self, target, current=None):
# Convert BOARD pin numbers to BCM

try:
global GPIO
import RPi.GPIO as GPIO
_has_gpio = True
except (ImportError, RuntimeError):
except (ImportError, RuntimeError) as e:
self._logger.error("Error importing RPi.GPIO. BOARD->BCM conversion will not occur. Error={}".format(e))
_has_gpio = False

if _has_gpio:
Expand Down Expand Up @@ -773,6 +773,8 @@ def _gpio_board_to_bcm(pin):
self._settings.global_set_int(['plugins', 'psucontrol_rpigpio', 'senseGPIOPin'], cur_senseGPIOPin)
self._settings.global_set_boolean(['plugins', 'psucontrol_rpigpio', 'invertsenseGPIOPin'], cur_invertsenseGPIOPin)
self._settings.global_set(['plugins', 'psucontrol_rpigpio', 'senseGPIOPinPUD'], cur_senseGPIOPinPUD)
else:
self.logger.info("No GPIO pins to convert.")

# Remove now unused config option
self._logger.info("Removing Setting: GPIOMode")
Expand Down

0 comments on commit 32915ad

Please sign in to comment.