mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-03 11:31:53 +08:00
refactoring
This commit is contained in:
@@ -94,18 +94,18 @@ class Plugin(BaseUserGpioDriver):
|
||||
pwm.period_ns = self.__period
|
||||
pwm.duty_cycle_ns = self.__get_duty_cycle(bool(initial))
|
||||
pwm.enable()
|
||||
except Exception as err:
|
||||
except Exception as ex:
|
||||
logger.error("Can't get PWM chip %d channel %d: %s",
|
||||
self.__chip, pin, tools.efmt(err))
|
||||
self.__chip, pin, tools.efmt(ex))
|
||||
|
||||
async def cleanup(self) -> None:
|
||||
for (pin, pwm) in self.__pwms.items():
|
||||
try:
|
||||
pwm.disable()
|
||||
pwm.close()
|
||||
except Exception as err:
|
||||
except Exception as ex:
|
||||
get_logger(0).error("Can't cleanup PWM chip %d channel %d: %s",
|
||||
self.__chip, pin, tools.efmt(err))
|
||||
self.__chip, pin, tools.efmt(ex))
|
||||
|
||||
async def read(self, pin: str) -> bool:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user