feature: add support for goldshell shutdown.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pyasic.config import MinerConfig
|
from pyasic.config import MinerConfig, MiningModeConfig
|
||||||
from pyasic.data import HashBoard
|
from pyasic.data import HashBoard
|
||||||
from pyasic.errors import APIError
|
from pyasic.errors import APIError
|
||||||
from pyasic.logger import logger
|
from pyasic.logger import logger
|
||||||
@@ -74,6 +74,8 @@ class GoldshellMiner(BFGMiner):
|
|||||||
|
|
||||||
data_locations = GOLDSHELL_DATA_LOC
|
data_locations = GOLDSHELL_DATA_LOC
|
||||||
|
|
||||||
|
supports_shutdown = True
|
||||||
|
|
||||||
async def get_config(self) -> MinerConfig:
|
async def get_config(self) -> MinerConfig:
|
||||||
# get pool data
|
# get pool data
|
||||||
try:
|
try:
|
||||||
@@ -183,3 +185,21 @@ class GoldshellMiner(BFGMiner):
|
|||||||
logger.error(self, rpc_devdetails)
|
logger.error(self, rpc_devdetails)
|
||||||
|
|
||||||
return hashboards
|
return hashboards
|
||||||
|
|
||||||
|
async def stop_mining(self) -> bool:
|
||||||
|
settings = await self.web.setting()
|
||||||
|
mode = MiningModeConfig.sleep()
|
||||||
|
cfg = mode.as_goldshell()
|
||||||
|
for new_setting in cfg["settings"]:
|
||||||
|
settings[new_setting] = cfg["settings"][new_setting]
|
||||||
|
await self.web.set_setting(settings)
|
||||||
|
return True
|
||||||
|
|
||||||
|
async def resume_mining(self) -> bool:
|
||||||
|
settings = await self.web.setting()
|
||||||
|
mode = MiningModeConfig.normal()
|
||||||
|
cfg = mode.as_goldshell()
|
||||||
|
for new_setting in cfg["settings"]:
|
||||||
|
settings[new_setting] = cfg["settings"][new_setting]
|
||||||
|
await self.web.set_setting(settings)
|
||||||
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user