Improvement to fault_light_on

Allow user to set a flash pattern, and if not, set a nice default flash pattern.
This commit is contained in:
Arceris
2022-12-18 16:30:06 -07:00
committed by GitHub
parent f7cd428366
commit 5bde9d7fe6

View File

@@ -137,12 +137,14 @@ class BTMiner(BaseMiner):
return True
return False
async def fault_light_on(self) -> bool:
async def fault_light_on(self, flash: list = []) -> bool:
if flash == []:
# If no flash pattern is provided, use a red-green semi-slow alternating flash
flash = [{"color": "green", "start":0, "period":400, "duration":200},
{"color": "red", "start":200, "period":400, "duration":200}]
try:
data = await self.api.set_led(auto=False)
await self.api.set_led(
auto=False, color="green", start=0, period=1, duration=0
)
for x in flash:
data = await self.api.set_led(auto=False, **x)
except APIError:
return False
if data: