billroy / bitlash

Bitlash: a programmable command shell for arduino
http://bitlash.net
MIT License
344 stars 73 forks source link

Cannot 'run' api added functions #38

Closed NickShaffner closed 9 years ago

NickShaffner commented 9 years ago

given the below sketch, typing 'run hi' from the console complains that it can't find the identifier 'hi'. Typing 'hi' at the console does the right thing. If you wrap the 'hi' function inside of a 'function hi wrap { hi; }', running hi wrap works.

numvar hi(void) { Serial.println("hello!"); }

void setup() {
initBitlash(115200);
addBitlashFunction("hi",(bitlash_function)hi); }

void loop() { runBitlash(); }

billroy commented 9 years ago

Thanks for your note. This is a known limitation; the run command only runs functions defined in eeprom.

The workaround is to define a “trampoline function” in eeprom in the usual way to call your user-defined “hi” function.

-br

On Oct 19, 2014, at 5:23 PM, Nick Shaffner notifications@github.com wrote:

given the below sketch, typing 'run hi' from the console complains that it can't find the identifier 'hi'.

numvar hi(void) { Serial.println("hello!"); }

void setup() {

initBitlash(115200);

addBitlashFunction("hi",(bitlash_function)hi); }

void loop() { runBitlash(); }

— Reply to this email directly or view it on GitHub https://github.com/billroy/bitlash/issues/38.