From 91c0e1c125e0c0fc5064f6d08c4314f86ad99214 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Thu, 23 Feb 2023 14:44:43 -0700 Subject: [PATCH] feature: add low power mode ability for X19 possibly. --- pyasic/config/__init__.py | 5 +++++ pyasic/errors/__init__.py | 2 ++ pyasic/miners/_backends/X19.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pyasic/config/__init__.py b/pyasic/config/__init__.py index 12131750..c1681fc8 100644 --- a/pyasic/config/__init__.py +++ b/pyasic/config/__init__.py @@ -326,6 +326,8 @@ class MinerConfig: if data[key]: if data[key] == 1: self.autotuning_wattage = 0 + if data[key] == 2: + self.autotuning_wattage = 1200 elif key == "fan_control": for _key in data[key].keys(): if _key == "min_fans": @@ -462,6 +464,9 @@ class MinerConfig: if self.autotuning_wattage == 0: cfg["miner-mode"] = 1 # Sleep Mode + if self.autotuning_wattage < 1800: + cfg["miner-mode"] = 2 # LPM? + if not self.temp_mode == "auto": cfg["bitmain-fan-ctrl"] = True diff --git a/pyasic/errors/__init__.py b/pyasic/errors/__init__.py index 206f80c2..590d92f7 100644 --- a/pyasic/errors/__init__.py +++ b/pyasic/errors/__init__.py @@ -24,6 +24,8 @@ class APIError(Exception): def __str__(self): if self.message: + if self.message == "can't access write cmd": + return f"{self.message}, please make sure your miner has been unlocked." return f"{self.message}" else: return "Incorrect API parameters." diff --git a/pyasic/miners/_backends/X19.py b/pyasic/miners/_backends/X19.py index 4f85ee68..7b25d52d 100644 --- a/pyasic/miners/_backends/X19.py +++ b/pyasic/miners/_backends/X19.py @@ -107,7 +107,7 @@ class X19(BMMiner): async def resume_mining(self) -> bool: cfg = await self.get_config() - cfg.autotuning_wattage = 1 + cfg.autotuning_wattage = 3600 await self.send_config(cfg) return True