bug: make sure self.config is set in all send or get config methods.

This commit is contained in:
UpstreamData
2023-02-23 12:16:19 -07:00
parent 2dc4b2cb8a
commit d5e8062f09
5 changed files with 15 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ class X19(BMMiner):
return self.config
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
self.config = config
conf = config.as_x19(user_suffix=user_suffix)
await self.send_web_command(
"set_miner_conf", params=conf # noqa: ignore conf being a str

View File

@@ -199,7 +199,9 @@ class BOSMiner(BaseMiner):
if conn:
async with conn:
# good ol' BBB compatibility :/
toml_data = toml.loads((await conn.run("cat /etc/bosminer.toml")).stdout)
toml_data = toml.loads(
(await conn.run("cat /etc/bosminer.toml")).stdout
)
logging.debug(f"{self}: Converting config file.")
cfg = MinerConfig().from_raw(toml_data)
self.config = cfg
@@ -208,6 +210,7 @@ class BOSMiner(BaseMiner):
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.")
self.config = config
toml_conf = config.as_bos(
model=self.model.replace(" (BOS)", ""), user_suffix=user_suffix
)
@@ -217,7 +220,9 @@ class BOSMiner(BaseMiner):
return None
async with conn:
# BBB check because bitmain suxx
bbb_check = await conn.run("if [ ! -f /etc/init.d/bosminer ]; then echo '1'; else echo '0'; fi;")
bbb_check = await conn.run(
"if [ ! -f /etc/init.d/bosminer ]; then echo '1'; else echo '0'; fi;"
)
bbb = bbb_check.stdout.strip() == "1"

View File

@@ -115,6 +115,8 @@ class BTMiner(BaseMiner):
return False
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
self.config = config
conf = config.as_wm(user_suffix=user_suffix)
pools_conf = conf["pools"]
@@ -158,7 +160,9 @@ class BTMiner(BaseMiner):
if wattage := summary["SUMMARY"][0].get("Power Limit"):
cfg.autotuning_wattage = wattage
return cfg
self.config = cfg
return self.config
async def set_power_limit(self, wattage: int) -> bool:
try:

View File

@@ -74,6 +74,7 @@ class CGMinerAvalon(CGMiner):
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
"""Configures miner with yaml config."""
self.config = config
return None
logging.debug(f"{self}: Sending config.") # noqa - This doesnt work...
conf = config.as_avalon(user_suffix=user_suffix)

View File

@@ -126,6 +126,7 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
return await self.restart_cgminer()
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
self.config = config
await self.send_web_command(
"updatePools", data=config.as_inno(user_suffix=user_suffix)
)