fixed a bug with the board utility

This commit is contained in:
UpstreamData
2022-01-24 16:39:11 -07:00
parent 8edfde96dc
commit dcf1a805c5
2 changed files with 13 additions and 20 deletions

View File

@@ -112,6 +112,9 @@ class BOSMiner(BaseMiner):
async def get_board_info(self) -> dict: async def get_board_info(self) -> dict:
"""Gets data on each board and chain in the miner.""" """Gets data on each board and chain in the miner."""
devdetails = await self.api.devdetails() devdetails = await self.api.devdetails()
if not devdetails.get("DEVDETAILS"):
print("devdetails error", devdetails)
return {6: [], 7: [], 8: []}
devs = devdetails['DEVDETAILS'] devs = devdetails['DEVDETAILS']
boards = {} boards = {}
for board in devs: for board in devs:

View File

@@ -38,7 +38,6 @@ async def scan_network(network):
async def refresh_data(ip_list: list): async def refresh_data(ip_list: list):
await update_ui_with_data("status", "Getting Data") await update_ui_with_data("status", "Getting Data")
await update_ui_with_data("hr_total", "")
ips = [ipaddress.ip_address(ip) for ip in ip_list] ips = [ipaddress.ip_address(ip) for ip in ip_list]
if len(ips) == 0: if len(ips) == 0:
ips = [ipaddress.ip_address(ip) for ip in [item[0] for item in window["ip_table"].Values]] ips = [ipaddress.ip_address(ip) for ip in [item[0] for item in window["ip_table"].Values]]
@@ -60,29 +59,20 @@ async def refresh_data(ip_list: list):
data_point = await all_data data_point = await all_data
if data_point["IP"] in ordered_all_ips: if data_point["IP"] in ordered_all_ips:
ip_table_index = ordered_all_ips.index(data_point["IP"]) ip_table_index = ordered_all_ips.index(data_point["IP"])
ip_table_data[ip_table_index] = [ board_6 = " ".join([chain["chip_status"] for chain in data_point["data"][6]]).replace("o", "")
data_point["IP"], data_point["model"], data_point["host"], str(data_point['TH/s']) + " TH/s", board_7 = " ".join([chain["chip_status"] for chain in data_point["data"][7]]).replace("o", "")
data_point["temp"], board_8 = " ".join([chain["chip_status"] for chain in data_point["data"][8]]).replace("o", "")
data_point['user'], str(data_point['wattage']) + " W" data = [
data_point["IP"],
data_point["model"],
board_6,
board_7,
board_8
] ]
ip_table_data[ip_table_index] = data
window["ip_table"].update(ip_table_data) window["ip_table"].update(ip_table_data)
progress_bar_len += 1 progress_bar_len += 1
asyncio.create_task(update_prog_bar(progress_bar_len)) asyncio.create_task(update_prog_bar(progress_bar_len))
hashrate_list = []
hr_idx = 3
for item, _ in enumerate(window["ip_table"].Values):
if len(window["ip_table"].Values[item]) > hr_idx:
if not window["ip_table"].Values[item][hr_idx] == '':
hashrate_list.append(float(window["ip_table"].Values[item][hr_idx].replace(" TH/s", "")))
else:
hashrate_list.append(0)
else:
hashrate_list.append(0)
total_hr = round(sum(hashrate_list), 2)
window["hr_total"].update(f"{total_hr} TH/s")
await update_ui_with_data("status", "") await update_ui_with_data("status", "")