From 64918e55522d8b443fa6e4b71e068b635b12a817 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Thu, 12 May 2022 13:12:54 -0600 Subject: [PATCH] added bosminer board data --- miners/bosminer.py | 24 +++++++++++++++++++++++- tools/cfg_util/layout.py | 10 +++++----- tools/cfg_util/scan/__init__.py | 21 +++++++-------------- tools/cfg_util/tables.py | 11 ++++++++++- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/miners/bosminer.py b/miners/bosminer.py index 262e62af..1386e525 100644 --- a/miners/bosminer.py +++ b/miners/bosminer.py @@ -253,6 +253,12 @@ class BOSMiner(BaseMiner): "Temperature": 0, "Pool User": "Unknown", "Wattage": 0, + "Total": 0, + "Ideal": self.nominal_chips * 3, + "Left Board": 0, + "Center Board": 0, + "Right Board": 0, + "Nominal": False, "Split": "0", "Pool 1": "Unknown", "Pool 1 User": "Unknown", @@ -271,7 +277,7 @@ class BOSMiner(BaseMiner): miner_data = None for i in range(DATA_RETRIES): miner_data = await self.api.multicommand( - "summary", "temps", "tunerstatus", "pools" + "summary", "temps", "tunerstatus", "pools", "devdetails" ) if miner_data: break @@ -281,6 +287,7 @@ class BOSMiner(BaseMiner): temps = miner_data.get("temps")[0] tunerstatus = miner_data.get("tunerstatus")[0] pools = miner_data.get("pools")[0] + devdetails = miner_data.get("devdetails")[0] if summary: hr = summary.get("SUMMARY") @@ -351,4 +358,19 @@ class BOSMiner(BaseMiner): if wattage: data["Wattage"] = wattage + if devdetails: + boards = devdetails.get("DEVDETAILS") + if boards: + if len(boards) > 0: + board_map = {0: "Left Board", 1: "Center Board", 2: "Right Board"} + offset = boards[0]["ID"] + for board in boards: + id = board["ID"] - offset + chips = board["Chips"] + data["Total"] += chips + data[board_map[id]] = chips + + if data["Total"] == data["Ideal"]: + data["Nominal"] = True + return data diff --git a/tools/cfg_util/layout.py b/tools/cfg_util/layout.py index 0cb3a4ec..d6365c13 100644 --- a/tools/cfg_util/layout.py +++ b/tools/cfg_util/layout.py @@ -95,8 +95,8 @@ TABLE_HEADERS = { "BOARDS": [ "IP", "Model", - "Total Chips", - "Nominal Chips", + "Ideal", + "Total", "Left Board", "Center Board", "Right Board", @@ -174,8 +174,8 @@ TEMP_COL_WIDTH = 8 USER_COL_WIDTH = 33 WATTAGE_COL_WIDTH = 10 SPLIT_COL_WIDTH = 8 -TOTAL_CHIP_WIDTH = 14 -NOMINAL_CHIP_WIDTH = 16 +TOTAL_CHIP_WIDTH = 8 +IDEAL_CHIP_WIDTH = 8 SCAN_COL_WIDTHS = [ IP_COL_WIDTH, MODEL_COL_WIDTH, @@ -277,7 +277,7 @@ def get_boards_layout(): IP_COL_WIDTH, MODEL_COL_WIDTH, TOTAL_CHIP_WIDTH, - NOMINAL_CHIP_WIDTH, + IDEAL_CHIP_WIDTH, ] add_length = TABLE_TOTAL_WIDTH - sum(BOARDS_COL_WIDTHS) for i in range(3): diff --git a/tools/cfg_util/scan/__init__.py b/tools/cfg_util/scan/__init__.py index 47f3c3b1..52d677cb 100644 --- a/tools/cfg_util/scan/__init__.py +++ b/tools/cfg_util/scan/__init__.py @@ -3,24 +3,17 @@ import asyncio from miners.miner_factory import MinerFactory from network import MinerNetwork from tools.cfg_util.decorators import disable_buttons -from tools.cfg_util.layout import window, update_prog_bar +from tools.cfg_util.layout import window, update_prog_bar, TABLE_HEADERS from tools.cfg_util.tables import clear_tables, TableManager progress_bar_len = 0 -DEFAULT_DATA = [ - "Model", - "Hostname", - "Hashrate", - "Temperature", - "Pool User", - "Pool 1", - "Pool 1 User", - "Pool 2", - "Pool 2 User", - "Wattage", - "Split", -] + +DEFAULT_DATA = set() + +for table in TABLE_HEADERS: + for header in TABLE_HEADERS[table]: + DEFAULT_DATA.add(header) async def btn_all(): diff --git a/tools/cfg_util/tables.py b/tools/cfg_util/tables.py index 918e1cf2..7feb2165 100644 --- a/tools/cfg_util/tables.py +++ b/tools/cfg_util/tables.py @@ -174,6 +174,7 @@ class TableManager(metaclass=Singleton): def _get_sort(self, data_key: str): if self.sort_key not in self.data[data_key]: + print(self.data[data_key]) return "" if self.sort_key == "IP": @@ -188,7 +189,15 @@ class TableManager(metaclass=Singleton): self.data[data_key]["Hashrate"].replace(" ", "").replace("TH/s", "") ) - if self.sort_key in ["Wattage", "Temp"]: + if self.sort_key in [ + "Wattage", + "Temp", + "Total", + "Ideal", + "Left Chips", + "Center Chips", + "Right Chips", + ]: if isinstance(self.data[data_key][self.sort_key], str): return -300