mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 21:48:35 -07:00
(Experimental) External CLI plugins -29kb DFU
Idea and plugin loader implementation by @akopachov, thanks! All commands done except storage and rpc for latency reasons
This commit is contained in:
@@ -17,6 +17,15 @@ App(
|
||||
sdk_headers=["power_service/power.h", "power_settings.h"],
|
||||
)
|
||||
|
||||
App(
|
||||
appid="power_cli",
|
||||
targets=["f7"],
|
||||
apptype=FlipperAppType.PLUGIN,
|
||||
entry_point="power_cli_plugin_ep",
|
||||
requires=["cli"],
|
||||
sources=["power_cli.c"],
|
||||
)
|
||||
|
||||
App(
|
||||
appid="power_start",
|
||||
apptype=FlipperAppType.STARTUP,
|
||||
|
||||
@@ -106,14 +106,14 @@ void power_cli(Cli* cli, FuriString* args, void* context) {
|
||||
furi_string_free(cmd);
|
||||
}
|
||||
|
||||
void power_on_system_start() {
|
||||
#ifdef SRV_CLI
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
#include <flipper_application/flipper_application.h>
|
||||
|
||||
cli_add_command(cli, "power", CliCommandFlagParallelSafe, power_cli, NULL);
|
||||
static const FlipperAppPluginDescriptor plugin_descriptor = {
|
||||
.appid = "power_cli",
|
||||
.ep_api_version = 1,
|
||||
.entry_point = &power_cli,
|
||||
};
|
||||
|
||||
furi_record_close(RECORD_CLI);
|
||||
#else
|
||||
UNUSED(power_cli);
|
||||
#endif
|
||||
const FlipperAppPluginDescriptor* power_cli_plugin_ep() {
|
||||
return &plugin_descriptor;
|
||||
}
|
||||
|
||||
11
applications/services/power/power_start.c
Normal file
11
applications/services/power/power_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
static void power_cli_wrapper(Cli* cli, FuriString* args, void* context) {
|
||||
cli_plugin_wrapper("power_cli", 1, cli, args, context);
|
||||
}
|
||||
|
||||
void power_on_system_start() {
|
||||
Cli* cli = furi_record_open(RECORD_CLI);
|
||||
cli_add_command(cli, "power", CliCommandFlagParallelSafe, power_cli_wrapper, NULL);
|
||||
furi_record_close(RECORD_CLI);
|
||||
}
|
||||
Reference in New Issue
Block a user