fixed some bugs and added support for M20Sv10 and 20
This commit is contained in:
@@ -8,3 +8,21 @@ class M20S(BaseMiner):
|
|||||||
self.model = "M20S"
|
self.model = "M20S"
|
||||||
self.nominal_chips = 66
|
self.nominal_chips = 66
|
||||||
self.fan_count = 2
|
self.fan_count = 2
|
||||||
|
|
||||||
|
|
||||||
|
class M20SV10(BaseMiner):
|
||||||
|
def __init__(self, ip: str):
|
||||||
|
super().__init__()
|
||||||
|
self.ip = ip
|
||||||
|
self.model = "M20S"
|
||||||
|
self.nominal_chips = 105
|
||||||
|
self.fan_count = 2
|
||||||
|
|
||||||
|
|
||||||
|
class M20SV20(BaseMiner):
|
||||||
|
def __init__(self, ip: str):
|
||||||
|
super().__init__()
|
||||||
|
self.ip = ip
|
||||||
|
self.model = "M20S"
|
||||||
|
self.nominal_chips = 111
|
||||||
|
self.fan_count = 2
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from .M20S import M20S
|
from .M20S import M20S, M20SV10, M20SV20
|
||||||
from .M20S_Plus import M20SPlus
|
from .M20S_Plus import M20SPlus
|
||||||
|
|
||||||
from .M21 import M21
|
from .M21 import M21
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ MINER_CLASSES = {
|
|||||||
"M20S": {
|
"M20S": {
|
||||||
"Default": BTMinerM20S,
|
"Default": BTMinerM20S,
|
||||||
"BTMiner": BTMinerM20S,
|
"BTMiner": BTMinerM20S,
|
||||||
|
"10": BTMinerM20SV10,
|
||||||
|
"20": BTMinerM20SV20,
|
||||||
},
|
},
|
||||||
"M20S+": {
|
"M20S+": {
|
||||||
"Default": BTMinerM20SPlus,
|
"Default": BTMinerM20SPlus,
|
||||||
@@ -452,24 +454,24 @@ class MinerFactory(metaclass=Singleton):
|
|||||||
if "BOSminer+" in version["VERSION"][0].keys():
|
if "BOSminer+" in version["VERSION"][0].keys():
|
||||||
api = "BOSMiner+"
|
api = "BOSMiner+"
|
||||||
|
|
||||||
|
# check for avalonminers
|
||||||
|
if version["VERSION"][0].get("PROD"):
|
||||||
|
_data = version["VERSION"][0]["PROD"].split("-")
|
||||||
|
model = _data[0]
|
||||||
|
if len(data) > 1:
|
||||||
|
ver = _data[1]
|
||||||
|
elif version["VERSION"][0].get("MODEL"):
|
||||||
|
_data = version["VERSION"][0]["MODEL"].split("-")
|
||||||
|
model = f"AvalonMiner {_data[0]}"
|
||||||
|
if len(data) > 1:
|
||||||
|
ver = _data[1]
|
||||||
|
|
||||||
# if all that fails, check the Description to see if it is a whatsminer
|
# if all that fails, check the Description to see if it is a whatsminer
|
||||||
if version.get("Description") and (
|
if version.get("Description") and (
|
||||||
"whatsminer" in version.get("Description")
|
"whatsminer" in version.get("Description")
|
||||||
):
|
):
|
||||||
api = "BTMiner"
|
api = "BTMiner"
|
||||||
|
|
||||||
# check for avalonminers
|
|
||||||
if version["VERSION"][0].get("PROD"):
|
|
||||||
_data = version["VERSION"][0]["PROD"].split("-")
|
|
||||||
model = _data[0]
|
|
||||||
if len(data) > 1:
|
|
||||||
ver = _data[1]
|
|
||||||
elif version["VERSION"][0].get("MODEL"):
|
|
||||||
_data = version["VERSION"][0]["MODEL"].split("-")
|
|
||||||
model = f"AvalonMiner {_data[0]}"
|
|
||||||
if len(data) > 1:
|
|
||||||
ver = _data[1]
|
|
||||||
|
|
||||||
# if we have no model from devdetails but have version, try to get it from there
|
# if we have no model from devdetails but have version, try to get it from there
|
||||||
if version and not model:
|
if version and not model:
|
||||||
# make sure version isn't blank
|
# make sure version isn't blank
|
||||||
|
|||||||
@@ -1,8 +1,24 @@
|
|||||||
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
|
from pyasic.miners._backends import BTMiner # noqa - Ignore access to _module
|
||||||
from pyasic.miners._types import M20S # noqa - Ignore access to _module
|
from pyasic.miners._types import ( # noqa - Ignore access to _module
|
||||||
|
M20S,
|
||||||
|
M20SV10,
|
||||||
|
M20SV20,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BTMinerM20S(BTMiner, M20S):
|
class BTMinerM20S(BTMiner, M20S):
|
||||||
def __init__(self, ip: str) -> None:
|
def __init__(self, ip: str) -> None:
|
||||||
super().__init__(ip)
|
super().__init__(ip)
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
|
|
||||||
|
|
||||||
|
class BTMinerM20SV10(BTMiner, M20SV10):
|
||||||
|
def __init__(self, ip: str) -> None:
|
||||||
|
super().__init__(ip)
|
||||||
|
self.ip = ip
|
||||||
|
|
||||||
|
|
||||||
|
class BTMinerM20SV20(BTMiner, M20SV20):
|
||||||
|
def __init__(self, ip: str) -> None:
|
||||||
|
super().__init__(ip)
|
||||||
|
self.ip = ip
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from .M20S import BTMinerM20S
|
from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20
|
||||||
from .M20S_Plus import BTMinerM20SPlus
|
from .M20S_Plus import BTMinerM20SPlus
|
||||||
|
|
||||||
from .M21 import BTMinerM21
|
from .M21 import BTMinerM21
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ class MinerNetworkRange:
|
|||||||
Parameters:
|
Parameters:
|
||||||
ip_range: ## A range of IP addresses to put in the network, or a list of IPs
|
ip_range: ## A range of IP addresses to put in the network, or a list of IPs
|
||||||
* Takes a string formatted as:
|
* Takes a string formatted as:
|
||||||
* {ip_range_1_start}-{ip_range_1_end}, {ip_address_1}, {ip_range_2_start}-{ip_range_2_end}, {ip_address_2}...
|
```f"{ip_range_1_start}-{ip_range_1_end}, {ip_address_1}, {ip_range_2_start}-{ip_range_2_end}, {ip_address_2}..."```
|
||||||
* Also takes a list of strings formatted as:
|
* Also takes a list of strings or `ipaddress.ipaddress` formatted as:
|
||||||
* [{ip_address_1}, {ip_address_2}, {ip_address_3}, ...]
|
```[{ip_address_1}, {ip_address_2}, {ip_address_3}, ...]```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, ip_range: Union[str, list]):
|
def __init__(self, ip_range: Union[str, list]):
|
||||||
|
|||||||
Reference in New Issue
Block a user