Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor js interpreter to be compatible with flipper zero js #750

Draft
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

Tawank
Copy link
Contributor

@Tawank Tawank commented Jan 29, 2025

You can follow progress here

Proposed Changes

  • Added require() function with modules: audio, badusb, dialog, display, device/flipper, gpio, http, ir, keyboard/input, math, notification, serial, storage, subghz, submenu, widget and wifi
  • Added functions: gpio.dacWrite, parse_int, to_string, to_hex_string, to_lower_case and to_upper_case
  • Added global consts: __filepath, __dirpath and BRUCE_VERSION

Types of Changes

Bugfix, New Feature

Verification

You can copy a Flipper Zero JS script and run it on Bruce - it should work if it only uses functions from this list:
#748
And if it follows this syntax:
https://github.com/jamisonderek/flipper-zero-tutorials/wiki/JavaScript
Other FZ syntax, like the official one, is slightly incompatible with this version.

User-Facing Change

- Added `require()` function and many modules
- Added functions: `gpio.dacWrite`, `parse_int`, `to_string`, `to_hex_string`, `to_lower_case` and `to_upper_case`
- Added global consts: `__filepath`, `__dirpath` and `BRUCE_VERSION`

Further Comments

@Tawank Tawank force-pushed the js_refractor_require branch from 65dfa72 to 35443d6 Compare January 29, 2025 18:42
@Tawank Tawank changed the title Add require function to js interpreter Refactor js interpreter to be compatible with flipper zero js Jan 29, 2025
Tawank added 25 commits January 30, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant