forked from M-Labs/thermostat
Implement DFU mode
This commit is contained in:
parent
9291160798
commit
bfec9efbec
|
@ -240,3 +240,16 @@ class Client:
|
||||||
await self._writer.drain()
|
await self._writer.drain()
|
||||||
|
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
|
|
||||||
|
async def dfu(self):
|
||||||
|
"""Put the Thermostat in DFU update mode
|
||||||
|
|
||||||
|
The client is disconnected as the Thermostat stops responding to
|
||||||
|
TCP commands in DFU update mode. The only way to exit it is by
|
||||||
|
power-cycling.
|
||||||
|
"""
|
||||||
|
async with self._command_lock:
|
||||||
|
self._writer.write("dfu\n".encode('utf-8'))
|
||||||
|
await self._writer.drain()
|
||||||
|
|
||||||
|
await self.disconnect()
|
||||||
|
|
|
@ -320,7 +320,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
self.actionReset.triggered.connect(reset_thermostat)
|
self.actionReset.triggered.connect(reset_thermostat)
|
||||||
self.thermostat_menu.addAction(self.actionReset)
|
self.thermostat_menu.addAction(self.actionReset)
|
||||||
|
|
||||||
|
@asyncSlot(bool)
|
||||||
|
async def dfu_mode(_):
|
||||||
|
await self._on_connection_changed(False)
|
||||||
|
await self.client.dfu()
|
||||||
|
|
||||||
|
# TODO: add a firmware flashing GUI?
|
||||||
|
|
||||||
|
self.actionEnter_DFU_Mode.triggered.connect(dfu_mode)
|
||||||
self.thermostat_menu.addAction(self.actionEnter_DFU_Mode)
|
self.thermostat_menu.addAction(self.actionEnter_DFU_Mode)
|
||||||
|
|
||||||
self.thermostat_menu.addAction(self.actionNetwork_Settings)
|
self.thermostat_menu.addAction(self.actionNetwork_Settings)
|
||||||
self.thermostat_menu.addAction(self.actionLoad_all_configs)
|
self.thermostat_menu.addAction(self.actionLoad_all_configs)
|
||||||
self.thermostat_menu.addAction(self.actionSave_all_configs)
|
self.thermostat_menu.addAction(self.actionSave_all_configs)
|
||||||
|
|
Loading…
Reference in New Issue