Closed 1e9abhi1e10 closed 5 months ago
This needs to be in BTMiner.py, and also the actually sending of the file should be handled by pyasic.rpc.btminer.BTMinerRPCAPI.upgrade_firmware, as documented in their API docs.
Heres the function that should be implemented in the BTMinerRPCAPI
class, then you can call this from the upper levels.
async def update_firmware(self, firmware: bytes): # noqa - static
"""Upgrade the firmware running on the miner.
<details>
<summary>Expand</summary>
Upgrade the firmware on the miner using the firmware passed in bytes.
Returns:
A reply informing of the firmware upgrade as a boolean.
</details>
"""
ready = await self.send_privileged_command("update_firmware")
if not ready.get("Msg") == "ready":
raise APIError(f"Not ready for firmware update: {self}")
file_size = struct.pack("<I", len(firmware))
await self._send_bytes(file_size + firmware)
return True
This PR aims to add update firmware functionality for Whatsminer.