feature: add support for Avalon Nano 3.
This commit is contained in:
@@ -284,6 +284,7 @@ class AvalonminerModels(str, Enum):
|
|||||||
Avalon1066 = "Avalon 1066"
|
Avalon1066 = "Avalon 1066"
|
||||||
Avalon1166Pro = "Avalon 1166 Pro"
|
Avalon1166Pro = "Avalon 1166 Pro"
|
||||||
Avalon1246 = "Avalon 1246"
|
Avalon1246 = "Avalon 1246"
|
||||||
|
AvalonNano3 = "Avalon Nano 3"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.value
|
return self.value
|
||||||
|
|||||||
@@ -20,3 +20,4 @@ from .A9X import *
|
|||||||
from .A10X import *
|
from .A10X import *
|
||||||
from .A11X import *
|
from .A11X import *
|
||||||
from .A12X import *
|
from .A12X import *
|
||||||
|
from .nano import *
|
||||||
|
|||||||
17
pyasic/miners/avalonminer/cgminer/nano/__init__.py
Normal file
17
pyasic/miners/avalonminer/cgminer/nano/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from .nano3 import CGMinerAvalonNano3
|
||||||
22
pyasic/miners/avalonminer/cgminer/nano/nano3.py
Normal file
22
pyasic/miners/avalonminer/cgminer/nano/nano3.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Copyright 2022 Upstream Data Inc -
|
||||||
|
# -
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
||||||
|
# you may not use this file except in compliance with the License. -
|
||||||
|
# You may obtain a copy of the License at -
|
||||||
|
# -
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0 -
|
||||||
|
# -
|
||||||
|
# Unless required by applicable law or agreed to in writing, software -
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, -
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
||||||
|
# See the License for the specific language governing permissions and -
|
||||||
|
# limitations under the License. -
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from pyasic.miners.backends import AvalonMiner
|
||||||
|
from pyasic.miners.device.models import AvalonNano3
|
||||||
|
|
||||||
|
|
||||||
|
class CGMinerAvalonNano3(AvalonMiner, AvalonNano3):
|
||||||
|
pass
|
||||||
@@ -124,6 +124,7 @@ class AvalonMiner(CGMiner):
|
|||||||
data_dict = {}
|
data_dict = {}
|
||||||
try:
|
try:
|
||||||
for key, val in [tuple(item) for item in data_list]:
|
for key, val in [tuple(item) for item in data_list]:
|
||||||
|
print(key, val)
|
||||||
data_dict[key] = val
|
data_dict[key] = val
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# --avalon args
|
# --avalon args
|
||||||
@@ -220,7 +221,7 @@ class AvalonMiner(CGMiner):
|
|||||||
try:
|
try:
|
||||||
board_hr = parsed_stats["MGHS"][board]
|
board_hr = parsed_stats["MGHS"][board]
|
||||||
hashboards[board].hashrate = AlgoHashRate.SHA256(
|
hashboards[board].hashrate = AlgoHashRate.SHA256(
|
||||||
board_hr, HashUnit.SHA256.GH
|
float(board_hr), HashUnit.SHA256.GH
|
||||||
).into(self.algo.unit.default)
|
).into(self.algo.unit.default)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -20,3 +20,4 @@ from .A9X import *
|
|||||||
from .A10X import *
|
from .A10X import *
|
||||||
from .A11X import *
|
from .A11X import *
|
||||||
from .A12X import *
|
from .A12X import *
|
||||||
|
from .nano import *
|
||||||
|
|||||||
1
pyasic/miners/device/models/avalonminer/nano/__init__.py
Normal file
1
pyasic/miners/device/models/avalonminer/nano/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from .nano3 import AvalonNano3
|
||||||
10
pyasic/miners/device/models/avalonminer/nano/nano3.py
Normal file
10
pyasic/miners/device/models/avalonminer/nano/nano3.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from pyasic.device import MinerModel
|
||||||
|
from pyasic.miners.device.makes import AvalonMinerMake
|
||||||
|
|
||||||
|
|
||||||
|
class AvalonNano3(AvalonMinerMake):
|
||||||
|
raw_model = MinerModel.AVALONMINER.AvalonNano3
|
||||||
|
|
||||||
|
expected_hashboards = 1
|
||||||
|
expected_chips = 10
|
||||||
|
expected_fans = 1
|
||||||
@@ -332,6 +332,7 @@ MINER_CLASSES = {
|
|||||||
"AVALONMINER 1066": CGMinerAvalon1066,
|
"AVALONMINER 1066": CGMinerAvalon1066,
|
||||||
"AVALONMINER 1166PRO": CGMinerAvalon1166Pro,
|
"AVALONMINER 1166PRO": CGMinerAvalon1166Pro,
|
||||||
"AVALONMINER 1246": CGMinerAvalon1246,
|
"AVALONMINER 1246": CGMinerAvalon1246,
|
||||||
|
"AVALONMINER NANO3": CGMinerAvalonNano3,
|
||||||
},
|
},
|
||||||
MinerTypes.INNOSILICON: {
|
MinerTypes.INNOSILICON: {
|
||||||
None: type("InnosiliconUnknown", (Innosilicon, InnosiliconMake), {}),
|
None: type("InnosiliconUnknown", (Innosilicon, InnosiliconMake), {}),
|
||||||
@@ -906,10 +907,12 @@ class MinerFactory:
|
|||||||
async def get_miner_model_avalonminer(self, ip: str) -> str | None:
|
async def get_miner_model_avalonminer(self, ip: str) -> str | None:
|
||||||
sock_json_data = await self.send_api_command(ip, "version")
|
sock_json_data = await self.send_api_command(ip, "version")
|
||||||
try:
|
try:
|
||||||
miner_model = sock_json_data["VERSION"][0]["PROD"]
|
miner_model = sock_json_data["VERSION"][0]["PROD"].upper()
|
||||||
if "-" in miner_model:
|
if "-" in miner_model:
|
||||||
miner_model = miner_model.split("-")[0]
|
miner_model = miner_model.split("-")[0]
|
||||||
|
if miner_model == "AVALONNANO":
|
||||||
|
nano_subtype = sock_json_data["VERSION"][0]["MODEL"].upper()
|
||||||
|
miner_model = f"AVALONMINER {nano_subtype}"
|
||||||
return miner_model
|
return miner_model
|
||||||
except (TypeError, LookupError):
|
except (TypeError, LookupError):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user