mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-03-29 08:39:52 +00:00
FBT: Close current app when flashing firmware
This commit is contained in:
@@ -24,7 +24,9 @@
|
||||
- JS:
|
||||
- Added ADC (analog voltage) support to gpio library (by @jamisonderek)
|
||||
- Support `subghz` custom modulation, support `transmitFile(path, repeats)`, new `end()` function (by @Willy-JL)
|
||||
- FBT: New `SKIP_EXTERNAL` toggle and `EXTRA_EXT_APPS` config option (by @Willy-JL)
|
||||
- FBT:
|
||||
- New `SKIP_EXTERNAL` toggle and `EXTRA_EXT_APPS` config option (by @Willy-JL)
|
||||
- Close current app when flashing firmware (by @Willy-JL)
|
||||
- GUI: Additional `menu_get_selected_item()` API (by @Willy-JL)
|
||||
- Desktop:
|
||||
- Added TV animation from OFW which was missing (internal on OFW)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import logging
|
||||
import os
|
||||
import pathlib
|
||||
import time
|
||||
|
||||
from flipper.app import App
|
||||
from flipper.storage import FlipperStorage, FlipperStorageOperations
|
||||
@@ -10,6 +11,8 @@ from flipper.utils.cdc import resolve_port
|
||||
|
||||
|
||||
class Main(App):
|
||||
APP_POST_CLOSE_DELAY_SEC = 0.2
|
||||
|
||||
def init(self):
|
||||
self.parser.add_argument("-p", "--port", help="CDC Port", default="auto")
|
||||
|
||||
@@ -48,6 +51,23 @@ class Main(App):
|
||||
flipper_update_path, manifest_path.parents[0]
|
||||
)
|
||||
|
||||
self.logger.info("Closing current app, if any")
|
||||
for _ in range(10):
|
||||
storage.send_and_wait_eol("loader close\r")
|
||||
result = storage.read.until(storage.CLI_EOL)
|
||||
if b"was closed" in result:
|
||||
self.logger.info("App closed")
|
||||
storage.read.until(storage.CLI_EOL)
|
||||
time.sleep(self.APP_POST_CLOSE_DELAY_SEC)
|
||||
elif result.startswith(b"No application"):
|
||||
storage.read.until(storage.CLI_EOL)
|
||||
break
|
||||
else:
|
||||
self.logger.error(
|
||||
f"Unexpected response: {result.decode('ascii')}"
|
||||
)
|
||||
return 4
|
||||
|
||||
storage.send_and_wait_eol(
|
||||
f"update install {flipper_update_path}/{manifest_name}\r"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user