Skip to content

Commit

Permalink
add support for M20 versions and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
UpstreamData committed Jul 22, 2022
1 parent 283e3d5 commit 9d3f2b5
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/miners/supported_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
16 changes: 16 additions & 0 deletions docs/miners/whatsminer/M2X.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 33 additions & 0 deletions pyasic/miners/_types/whatsminer/M2X/M20.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions pyasic/miners/_types/whatsminer/M2X/M20S.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
1 change: 1 addition & 0 deletions pyasic/miners/_types/whatsminer/M2X/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions pyasic/miners/miner_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@
"BMMiner": BMMinerT19,
"CGMiner": CGMinerT19,
},
"M20": {
"Default": BTMinerM20,
"BTMiner": BTMinerM20,
"10": BTMinerM20V10,
},
"M20S": {
"Default": BTMinerM20S,
"BTMiner": BTMinerM20S,
Expand Down
31 changes: 31 additions & 0 deletions pyasic/miners/whatsminer/btminer/M2X/M20.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions pyasic/miners/whatsminer/btminer/M2X/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9d3f2b5

Please sign in to comment.