feature: check vnish presets when set power
This commit is contained in:
committed by
Brett Rowan
parent
a3087e1a96
commit
9e3578b4a2
@@ -275,7 +275,16 @@ class VNish(VNishFirmware, BMMiner):
|
|||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
async def set_power_limit(self, wattage: int) -> bool:
|
async def set_power_limit(self, wattage: int) -> bool:
|
||||||
|
config = await self.get_config()
|
||||||
|
tuned_presets = [
|
||||||
|
preset.power
|
||||||
|
for preset in config.mining_mode.available_presets
|
||||||
|
if preset.tuned
|
||||||
|
]
|
||||||
|
|
||||||
# Can only set power limit to tuned preset
|
# Can only set power limit to tuned preset
|
||||||
|
if wattage not in tuned_presets:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
await self.web.set_power_limit(wattage)
|
await self.web.set_power_limit(wattage)
|
||||||
updated_settings = await self.web.settings()
|
updated_settings = await self.web.settings()
|
||||||
|
|||||||
Reference in New Issue
Block a user