ensure that there are no duplicate pwms set up for a single GPIO
This commit is contained in:
parent
e3422e8073
commit
338cbf567a
2
app.py
2
app.py
@ -44,7 +44,7 @@ def xml_transfer():
|
||||
shutil.move(str(dir + '/XML/config.xml'),str(dir + '/XML/config_old.xml'))
|
||||
shutil.move('/tmp/aped_device/config.xml',str(dir + '/XML/config.xml'))
|
||||
xml_reader.set_root(str(dir + '/XML/config.xml'))
|
||||
interface_handler = Interface_handler(xml_reader)
|
||||
interface_handler.init_gpio()
|
||||
else:
|
||||
SyntaxError('the config.xml has invalid content')
|
||||
return {'error': ''}
|
||||
|
@ -57,6 +57,9 @@ class Interface_handler:
|
||||
def init_gpio(self):
|
||||
"""initialises the GPIO pins
|
||||
"""
|
||||
for pwm in self.pwms:
|
||||
if pwm != None:
|
||||
pwm.stop()
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
for device_name in self.xml_reader.get_device_names():
|
||||
port_info = self.xml_reader.get_port(device_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user