mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-26 18:26:31 +00:00
0154018363
* FBT: cdefines to env, libs order * API: strtod, modf, itoa, calloc * Apps: elk js * Apps: mjs * JS: scripts as assets * mjs: composite resolver * mjs: stack trace * ELK JS example removed * MJS thread, MJS lib modified to support script interruption * JS console UI * Module system, BadUSB bindings rework * JS notifications, simple dialog, BadUSB demo * Custom dialogs, dialog demo * MJS as system library, some dirty hacks to make it compile * Plugin-based js modules * js_uart(BadUART) module * js_uart: support for byte array arguments * Script icon and various fixes * File browser: multiple extensions filter, running js scripts from app loader * Running js scripts from archive browser * JS Runner as system app * Example scripts moved to /ext/apps/Scripts * JS bytecode listing generation * MJS builtin printf cleanup * JS examples cleanup * mbedtls version fix * Unused lib cleanup * Making PVS happy & TODOs cleanup * TODOs cleanup #2 * MJS: initial typed arrays support * JS: fix mem leak in uart destructor Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
34 lines
916 B
JavaScript
34 lines
916 B
JavaScript
let badusb = require("badusb");
|
|
let notify = require("notification");
|
|
let flipper = require("flipper");
|
|
let dialog = require("dialog");
|
|
|
|
badusb.setup({ vid: 0xAAAA, pid: 0xBBBB, mfr_name: "Flipper", prod_name: "Zero" });
|
|
dialog.message("BadUSB demo", "Press OK to start");
|
|
|
|
if (badusb.isConnected()) {
|
|
notify.blink("green", "short");
|
|
print("USB is connected");
|
|
|
|
badusb.println("Hello, world!");
|
|
|
|
badusb.press("CTRL", "a");
|
|
badusb.press("CTRL", "c");
|
|
badusb.press("DOWN");
|
|
delay(1000);
|
|
badusb.press("CTRL", "v");
|
|
delay(1000);
|
|
badusb.press("CTRL", "v");
|
|
|
|
badusb.println("1234", 200);
|
|
|
|
badusb.println("Flipper Model: " + flipper.getModel());
|
|
badusb.println("Flipper Name: " + flipper.getName());
|
|
badusb.println("Battery level: " + to_string(flipper.getBatteryCharge()) + "%");
|
|
|
|
notify.success();
|
|
} else {
|
|
print("USB not connected");
|
|
notify.error();
|
|
}
|