From 9d3f2b5968affcf667f1e47b038c07bf2b86b147 Mon Sep 17 00:00:00 2001 From: UpstreamData <75442874+UpstreamData@users.noreply.github.com> Date: Fri, 22 Jul 2022 13:04:47 -0600 Subject: [PATCH] add support for M20 versions and update docs --- docs/miners/supported_types.md | 2 ++ docs/miners/whatsminer/M2X.md | 16 +++++++++ pyasic/miners/_types/whatsminer/M2X/M20.py | 33 +++++++++++++++++++ pyasic/miners/_types/whatsminer/M2X/M20S.py | 4 +-- .../miners/_types/whatsminer/M2X/__init__.py | 1 + pyasic/miners/miner_factory.py | 5 +++ pyasic/miners/whatsminer/btminer/M2X/M20.py | 31 +++++++++++++++++ .../miners/whatsminer/btminer/M2X/__init__.py | 1 + 8 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 pyasic/miners/_types/whatsminer/M2X/M20.py create mode 100644 pyasic/miners/whatsminer/btminer/M2X/M20.py diff --git a/docs/miners/supported_types.md b/docs/miners/supported_types.md index 170edede..50c077a0 100644 --- a/docs/miners/supported_types.md +++ b/docs/miners/supported_types.md @@ -27,6 +27,8 @@ Supported miner types are here on this list. If your miner (or miner version) i * [VE20][pyasic.miners.whatsminer.btminer.M3X.M31S_Plus.BTMinerM31SPlusVE20] * [M32S][pyasic.miners.whatsminer.btminer.M3X.M32S.BTMinerM32S] * M2X Series: + * [M20][pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20]: + * [V10][pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20V10] * [M20S][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20S]: * [V10][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20SV10] * [V20][pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20SV20] diff --git a/docs/miners/whatsminer/M2X.md b/docs/miners/whatsminer/M2X.md index 1b0a5d3c..a78d8cd5 100644 --- a/docs/miners/whatsminer/M2X.md +++ b/docs/miners/whatsminer/M2X.md @@ -1,6 +1,22 @@ # pyasic ## M2X Models +## M20 + +::: pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20 + handler: python + options: + show_root_heading: false + heading_level: 4 + +## M20V10 + +::: pyasic.miners.whatsminer.btminer.M2X.M20.BTMinerM20V10 + handler: python + options: + show_root_heading: false + heading_level: 4 + ## M20S ::: pyasic.miners.whatsminer.btminer.M2X.M20S.BTMinerM20S diff --git a/pyasic/miners/_types/whatsminer/M2X/M20.py b/pyasic/miners/_types/whatsminer/M2X/M20.py new file mode 100644 index 00000000..fdb55bac --- /dev/null +++ b/pyasic/miners/_types/whatsminer/M2X/M20.py @@ -0,0 +1,33 @@ +# 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 import BaseMiner + + +class M20(BaseMiner): + def __init__(self, ip: str): + super().__init__() + self.ip = ip + self.model = "M20" + self.nominal_chips = 70 + self.fan_count = 2 + + +class M20V10(BaseMiner): + def __init__(self, ip: str): + super().__init__() + self.ip = ip + self.model = "M20 V10" + self.nominal_chips = 70 + self.fan_count = 2 diff --git a/pyasic/miners/_types/whatsminer/M2X/M20S.py b/pyasic/miners/_types/whatsminer/M2X/M20S.py index 16e9444e..45323302 100644 --- a/pyasic/miners/_types/whatsminer/M2X/M20S.py +++ b/pyasic/miners/_types/whatsminer/M2X/M20S.py @@ -28,7 +28,7 @@ class M20SV10(BaseMiner): def __init__(self, ip: str): super().__init__() self.ip = ip - self.model = "M20S" + self.model = "M20S V10" self.nominal_chips = 105 self.fan_count = 2 @@ -37,6 +37,6 @@ class M20SV20(BaseMiner): def __init__(self, ip: str): super().__init__() self.ip = ip - self.model = "M20S" + self.model = "M20S V20" self.nominal_chips = 111 self.fan_count = 2 diff --git a/pyasic/miners/_types/whatsminer/M2X/__init__.py b/pyasic/miners/_types/whatsminer/M2X/__init__.py index 28041632..a8e6637c 100644 --- a/pyasic/miners/_types/whatsminer/M2X/__init__.py +++ b/pyasic/miners/_types/whatsminer/M2X/__init__.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from .M20 import M20, M20V10 from .M20S import M20S, M20SV10, M20SV20 from .M20S_Plus import M20SPlus diff --git a/pyasic/miners/miner_factory.py b/pyasic/miners/miner_factory.py index fb14506a..aadb46a0 100644 --- a/pyasic/miners/miner_factory.py +++ b/pyasic/miners/miner_factory.py @@ -132,6 +132,11 @@ "BMMiner": BMMinerT19, "CGMiner": CGMinerT19, }, + "M20": { + "Default": BTMinerM20, + "BTMiner": BTMinerM20, + "10": BTMinerM20V10, + }, "M20S": { "Default": BTMinerM20S, "BTMiner": BTMinerM20S, diff --git a/pyasic/miners/whatsminer/btminer/M2X/M20.py b/pyasic/miners/whatsminer/btminer/M2X/M20.py new file mode 100644 index 00000000..f3c390cf --- /dev/null +++ b/pyasic/miners/whatsminer/btminer/M2X/M20.py @@ -0,0 +1,31 @@ +# 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 BTMiner # noqa - Ignore access to _module +from pyasic.miners._types import ( # noqa - Ignore access to _module + M20, + M20V10, +) + + +class BTMinerM20(BTMiner, M20): + def __init__(self, ip: str) -> None: + super().__init__(ip) + self.ip = ip + + +class BTMinerM20V10(BTMiner, M20V10): + def __init__(self, ip: str) -> None: + super().__init__(ip) + self.ip = ip diff --git a/pyasic/miners/whatsminer/btminer/M2X/__init__.py b/pyasic/miners/whatsminer/btminer/M2X/__init__.py index 75b41d39..5171f895 100644 --- a/pyasic/miners/whatsminer/btminer/M2X/__init__.py +++ b/pyasic/miners/whatsminer/btminer/M2X/__init__.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from .M20 import BTMinerM20, BTMinerM20V10 from .M20S import BTMinerM20S, BTMinerM20SV10, BTMinerM20SV20 from .M20S_Plus import BTMinerM20SPlus