Update service.py

This commit is contained in:
gunu3371 2024-07-14 01:39:53 +09:00 committed by GitHub
parent f168bae171
commit f5bbfec17f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,7 +90,7 @@ class Alarm:
self.piezo.frequency = 523 self.piezo.frequency = 523
def on(self): def on(self):
self.piezo.duty_cycle = 45000 self.piezo.duty_cycle = 50000
def off(self): def off(self):
self.piezo.duty_cycle = 0 self.piezo.duty_cycle = 0
@ -115,6 +115,7 @@ while not killer.kill_now:
elif ps == "chg": elif ps == "chg":
log.info('AC power restored Charging') log.info('AC power restored Charging')
elif ps == "dch": elif ps == "dch":
buz.on()
log.warn('AC power loss') log.warn('AC power loss')
pw = int(ups.get_curvol()) pw = int(ups.get_curvol())
if pw <= 3500: if pw <= 3500:
@ -130,5 +131,7 @@ while not killer.kill_now:
log.info("Current Voltage "+ups.get_curvol()+"mV") log.info("Current Voltage "+ups.get_curvol()+"mV")
time.sleep(0.5) time.sleep(0.5)
buz.off()
time.sleep(0.5)
buz.off()
log.info('UPS service stopped successfully') log.info('UPS service stopped successfully')