Add keep_setting arg in miners/base.py/BaseMiner/upgrade_firmware
This commit is contained in:
@@ -561,27 +561,18 @@ class BaseMiner(MinerProtocol):
|
||||
if self._ssh_cls is not None:
|
||||
self.ssh = self._ssh_cls(ip)
|
||||
|
||||
async def upgrade_firmware(self, file: str = None, url: str = None, version: str = "latest") -> bool:
|
||||
async def upgrade_firmware(self, *, file: str = None, url: str = None, version: str = "latest", keep_settings: bool = True) -> bool:
|
||||
"""Upgrade the firmware of the miner.
|
||||
|
||||
Parameters:
|
||||
file: The file path to the firmware to upgrade from.
|
||||
url: The URL to download the firmware from.
|
||||
version: The version of the firmware to upgrade to.
|
||||
keep_settings: Whether to keep the current settings during the upgrade.
|
||||
|
||||
Returns:
|
||||
A boolean value of the success of the firmware upgrade.
|
||||
"""
|
||||
try:
|
||||
if file is not None:
|
||||
await self.web.send_command("firmware-upgrade", file=file)
|
||||
elif url is not None:
|
||||
await self.web.send_command("firmware-upgrade", url=url)
|
||||
else:
|
||||
await self.web.send_command("firmware-upgrade", version=version)
|
||||
return True
|
||||
except Exception as e:
|
||||
logging.error(f"Firmware upgrade failed: {e}")
|
||||
return False
|
||||
return False
|
||||
|
||||
AnyMiner = TypeVar("AnyMiner", bound=BaseMiner)
|
||||
Reference in New Issue
Block a user