bug: fix LookupError with AntminerOld
This commit is contained in:
@@ -598,44 +598,52 @@ class AntminerOld(CGMiner):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if rpc_stats is not None:
|
if rpc_stats is not None:
|
||||||
board_offset = -1
|
try:
|
||||||
boards = rpc_stats["STATS"]
|
board_offset = -1
|
||||||
if len(boards) > 1:
|
boards = rpc_stats["STATS"]
|
||||||
for board_num in range(1, 16, 5):
|
if len(boards) > 1:
|
||||||
for _b_num in range(5):
|
for board_num in range(1, 16, 5):
|
||||||
b = boards[1].get(f"chain_acn{board_num + _b_num}")
|
for _b_num in range(5):
|
||||||
|
b = boards[1].get(f"chain_acn{board_num + _b_num}")
|
||||||
|
|
||||||
if b and not b == 0 and board_offset == -1:
|
if b and not b == 0 and board_offset == -1:
|
||||||
board_offset = board_num
|
board_offset = board_num
|
||||||
if board_offset == -1:
|
if board_offset == -1:
|
||||||
board_offset = 1
|
board_offset = 1
|
||||||
|
|
||||||
for i in range(board_offset, board_offset + self.expected_hashboards):
|
for i in range(
|
||||||
hashboard = HashBoard(
|
board_offset, board_offset + self.expected_hashboards
|
||||||
slot=i - board_offset, expected_chips=self.expected_chips
|
):
|
||||||
)
|
hashboard = HashBoard(
|
||||||
|
slot=i - board_offset, expected_chips=self.expected_chips
|
||||||
|
)
|
||||||
|
|
||||||
chip_temp = boards[1].get(f"temp{i}")
|
chip_temp = boards[1].get(f"temp{i}")
|
||||||
if chip_temp:
|
if chip_temp:
|
||||||
hashboard.chip_temp = round(chip_temp)
|
hashboard.chip_temp = round(chip_temp)
|
||||||
|
|
||||||
temp = boards[1].get(f"temp2_{i}")
|
temp = boards[1].get(f"temp2_{i}")
|
||||||
if temp:
|
if temp:
|
||||||
hashboard.temp = round(temp)
|
hashboard.temp = round(temp)
|
||||||
|
|
||||||
hashrate = boards[1].get(f"chain_rate{i}")
|
hashrate = boards[1].get(f"chain_rate{i}")
|
||||||
if hashrate:
|
if hashrate:
|
||||||
hashboard.hashrate = self.algo.hashrate(
|
hashboard.hashrate = self.algo.hashrate(
|
||||||
rate=float(hashrate), unit=self.algo.unit.GH
|
rate=float(hashrate), unit=self.algo.unit.GH
|
||||||
).into(self.algo.unit.default)
|
).into(self.algo.unit.default)
|
||||||
|
|
||||||
chips = boards[1].get(f"chain_acn{i}")
|
chips = boards[1].get(f"chain_acn{i}")
|
||||||
if chips:
|
if chips:
|
||||||
hashboard.chips = chips
|
hashboard.chips = chips
|
||||||
hashboard.missing = False
|
hashboard.missing = False
|
||||||
if (not chips) or (not chips > 0):
|
if (not chips) or (not chips > 0):
|
||||||
hashboard.missing = True
|
hashboard.missing = True
|
||||||
hashboards.append(hashboard)
|
hashboards.append(hashboard)
|
||||||
|
except LookupError:
|
||||||
|
return [
|
||||||
|
HashBoard(slot=i, expected_chips=self.expected_chips)
|
||||||
|
for i in range(self.expected_hashboards)
|
||||||
|
]
|
||||||
|
|
||||||
return hashboards
|
return hashboards
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user