format: reformat T3H+ get_data to improve error handling and checking of data.

This commit is contained in:
Upstream Data
2022-11-05 09:40:56 -06:00
parent e02457f0b2
commit d9b522734a

View File

@@ -162,6 +162,10 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
ip=str(self.ip), ip=str(self.ip),
ideal_chips=self.nominal_chips * self.ideal_hashboards, ideal_chips=self.nominal_chips * self.ideal_hashboards,
ideal_hashboards=self.ideal_hashboards, ideal_hashboards=self.ideal_hashboards,
hashboards=[
HashBoard(slot=i, expected_chips=self.nominal_chips)
for i in range(self.ideal_hashboards)
],
) )
board_offset = -1 board_offset = -1
@@ -220,20 +224,29 @@ class CGMinerInnosiliconT3HPlus(CGMiner, InnosiliconT3HPlus):
stats = stats[0] stats = stats[0]
if stats.get("STATS"): if stats.get("STATS"):
for idx, board in enumerate(stats["STATS"]): for idx, board in enumerate(stats["STATS"]):
temp_board = HashBoard( data.hashboards[idx].missing = True
slot=idx, chips = board.get("Num active chips")
chip_temp=round(board.get("Temp")), if chips:
chips=board.get("Num active chips"), data.hashboards[idx].chips = chips
missing=False if board.get("Num active chips") > 0 else True, if chips > 0:
expected_chips=self.nominal_chips, data.hashboards[idx].missing = False
)
data.hashboards.append(temp_board)
if all_data: if all_data:
if all_data.get("chain"): if all_data.get("chain"):
for idx, board in enumerate(all_data["chain"]): for idx, board in enumerate(all_data["chain"]):
data.hashboards[idx].temp = round(board.get("Temp min")) temp = board.get("Temp min")
data.hashboards[idx].hashrate = round(board.get("Hash Rate H") / 1000000000000, 2) if temp:
data.hashboards[idx].temp = round(temp)
hashrate = board.get("Hash Rate H")
if hashrate:
data.hashboards[idx].hashrate = round(
hashrate / 1000000000000, 2
)
chip_temp = board.get("Temp max")
if chip_temp:
data.hashboards[idx].chip_temp = round(chip_temp)
if all_data.get("fansSpeed"): if all_data.get("fansSpeed"):
speed = round((all_data["fansSpeed"] * 6000) / 100) speed = round((all_data["fansSpeed"] * 6000) / 100)