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:
@@ -137,12 +137,14 @@ class BTMiner(BaseMiner):
|
|||||||
return True
|
return True
|
||||||
return False
|
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:
|
try:
|
||||||
data = await self.api.set_led(auto=False)
|
for x in flash:
|
||||||
await self.api.set_led(
|
data = await self.api.set_led(auto=False, **x)
|
||||||
auto=False, color="green", start=0, period=1, duration=0
|
|
||||||
)
|
|
||||||
except APIError:
|
except APIError:
|
||||||
return False
|
return False
|
||||||
if data:
|
if data:
|
||||||
|
|||||||
Reference in New Issue
Block a user