-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
added functions in the js interpreter, more serial cmds (not ready to merge) #226
Conversation
@bmorcelli : any idea why this exit function is not working? I'd like a function to exit from a JS script from within the script itself. |
Can we have the audio related functions on the interpreter too? 🥺 |
as alternative, to reduce extra code wrapping, you can do this in a js script:
EDIT: btw for better readability i could add a wrapper to this. |
i see, really smart... |
i'm adding more JS functions, most of them are just serial cmd wrappers, some are not. |
Learned something new about this functionality... once you start it, it won't pass through the loop again, until an error is sent into the exit... So This line Line 360 in f311c4f
can be changed to interpreter_start= false;
and these conditions
can be deleted.. I will comment this in the review use the exit function like this, and it will work ok:
Use this for now and I will make some changes into the Ibnterpreter workflow after we merge your additions. |
if(!checkPrevPress() && !checkNextPress()) interpreter_start=false; | ||
#if defined (CARDPUTER) | ||
if(checkEscPress()) interpreter_start=false; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These conditions can be deleted
src/main.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goto End;
in line 362 must be replaced by: interpreter_start=false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tried those changes, but exit()
still does not work .
In the meanwhile i've added some high-level Dialog and Storage functions.
Any suggestion for the Core series envs failing to build due to insufficient iram0? |
#include "core/serialcmds.h" | ||
#include "modules/rf/rf.h" | ||
#include "modules/ir/ir_read.h" | ||
#include "modules/others/bad_usb.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try adding
#pragma once
in the firs line of these header files.. if it works, add them into all .h files
an in all core files
Now, looking deep i to the code, I suspect that the IRAM problem of the Core Devices is the calling of all these libs in the passwords.h/cpp I am studying a way to enhance that, but I think we should not add more core functionalities with new libs... StickCs are already at 98% of iram memory as well |
If the goal os protect the passwords saved in the bruce.conf file, I think we should use a simpler solution, nothing so fancy, atm.. Im trying to get BLE functions back to the stock Arduino libs to release some more IRAM memory.. so maybe this AES encryption/decryption function needs to be adopted in a near future |
i'll try to comment some stuff in serialcmds.cpp too, i can remove the cjson dep. For the password stuff, these could be used to store user custom secrets as well: If it turns out mbed aes is taking too much iram, i could use another lib. EDIT: building with |
LITE_VERSION may "solve" it.. But for this password encryption I think that simple math solutions might be better than using dedicated libs It isn't a bank password to spend a lot of resources.. I think that if we use simple base64, Ceasar Cypher, or even a bit or 2 left shift would be enough for this application, and won't use a lot of resources.. The ideia of saving the passwords in plain text is to give the StickC users to edit this file in the computer and upload again to the device avoiding typing (that for these devices is fkng annoying).. if we encrypt it, it won't be possible to use this way |
I've tried removing the password module completely and commenting some stuff in serialcmd, but it is still failing to build:
with |
did not work, only adding more features into lite mode worked for me (all RF features or all BT features). |
Ok, then.. I will keep researching a way to reduce the IRAM usage |
I will wait you deploy your changes to the interpreter, so then I look into the exit function.. I've tested it the way I sent you and did work for me.. |
In my research I found that this is an ESP32 problem with the linker, many functions are being stored in IRAM instead of flash, and it doesn't happen with ESP32-S3 chips... Maybe downgrading to older versions of platformio Arduino-esp32 framework can help with it, or recompile the libraries (I have some experience with this subject) with proper changes to use with these devices . References I've added some linker flags in the last PR to monitor the ram memory usage, and differences are huge between esp32 (~99%) and esp32s3 (~28%) |
743fc27
to
5ebb4c6
Compare
added:
serialPrintln(string), serialCmd(string), playAudioFile(filename), tone(freq, duration), irTransmitFile(filename), subghzTransmitFile(filename), badusbRunFile(filename), badusbSetup(), badusbPrint(string), badusbPress(keycode), badusbHold(keycode), badusbRelease(keycode), irRead(), subghzSetFrequency(freq_as_float), subghzRead(), dialogMessage(msg), dialogError(msg), dialogPickFile(path), dialogViewFile(path), keyboard(), storageRead(path), storageWrite(path, data), exit()
(wiki page to be updated with full docs)storage md5
,storage crc32
,storage write
,webui
,subghz|badusb tx_from_buffer
ls, dir, rm, del, md, cat, type, play, rf, bu, set, decrypt, run
wifiIP
address var,SAFE_STACK_BUFFER_SIZE