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

Talk to arduino without >command #43

Open
borgdrone7 opened this issue Mar 13, 2015 · 6 comments
Open

Talk to arduino without >command #43

borgdrone7 opened this issue Mar 13, 2015 · 6 comments

Comments

@borgdrone7
Copy link

Hi,
I am trying to use bitlash with C#. Everything is perfect and works except one thing which ruins everything for me. Bilash by default thinks that I am in terminal and echos my commands and > sign. However in order for it to be usable when talking with C# program over serial it must send only result of the command. Currently when I write printf("a0:%d", a0) as a response I will get:
printf("a0:%d", a0)
a0:551

I want to get:
a0:551

I am sure I am missing something obvious but I cannot seem to find a solution. Whats the catch?

Thanks in advance!

@billroy
Copy link
Owner

billroy commented Mar 13, 2015

Hello and thanks for your note.

You can modify Bitlash so it doesn’t echo characters (though this will make it more difficult to use manually, of course).

In src/bitlash-cmdline.c at line 117 you will find the “spb(c)” that echoes the input character back over the serial link. Comment that function call out and you should be good to go.

Happy to take followup questions if that doesn’t work for you.

-br

On Mar 12, 2015, at 9:46 PM, borgdrone7 notifications@github.com wrote:

Hi,
I am trying to use bitlash with C#. Everything is perfect and works except one thing which ruins everything for me. Bilash by default thinks that I am in terminal and echos my commands and > sign. However in order for it to be usable when talking with C# program over serial it must send only result of the command. Currently when I write printf("a0:%d", a0) as a response I will get:
printf("a0:%d", a0)
a0:551

I want to get:
a0:551

I am sure I am missing something obvious but I cannot seem to find a solution. Whats the catch?

Thanks in advance!


Reply to this email directly or view it on GitHub #43.

@borgdrone7
Copy link
Author

Hi,
Thank you very much for quick answer. Commenting that line solved echo, however there is still "> " which "pollutes" the output. How can I remove that too? I just want result of the command.
I think you should add something like flag or if we define NO_CONSOLE for example that there is no echo and "> " sign.
Another question is, is it possible to upload function but that it is not automatically saved to EPROM? That way I can define all functions in C# strings and every time connection is started just send them with no need for big EPROM, so I could have more functions than what can fit there.
Thanks again for making so wonderful library. I looked at all libraries out there and I think yours is by far the best.

@billroy
Copy link
Owner

billroy commented Mar 13, 2015

You can suppress the prompt by defining an empty function named “prompt”:

function prompt {}

Your question about functions “not saved to EEPROM” puzzles me. Where would you suggest to store them? It would be possible to store them in RAM, I suppose, on the larger-ram Arduinos.

-br

On Mar 13, 2015, at 3:46 PM, borgdrone7 notifications@github.com wrote:

Hi,
Thank you very much for quick answer. Commenting that line solved echo, however there is still "> " which "pollutes" the output. How can I remove that too. I just want result of the command. Another question is, is it possible to upload function but that it is not automatically saved to EPROM. That way I can define all function in C# strings and every time connection is started just upload them with no need for EPROM, so I could have more functions.
Thanks again for making so wonderful library. I looked at all libraries out there and I think your's is by far the best.


Reply to this email directly or view it on GitHub #43 (comment).

@borgdrone7
Copy link
Author

Hi,
Yes, Arduino Mega has 8Kb of SRAM and 4Kb of eprom. As for prompt, I figured it out on my own and came here to let you know, and saw your answer :). I am getting one extra newline in output, maybe it is due to my code on client side. Do you send extra newline together with response sometimes or it is always just one to end the response? I am sending "print a0" and sometimes I get "\r" first and then "531\r" and sometimes I get immediately "531\r".

@billroy
Copy link
Owner

billroy commented Mar 14, 2015

It may help to comment out the call to speol() at line 150 in src/bitlash_cmdline.c - this is generated when /r or /n is entered.

The print command normally generates one newline at the end of the output unless you end the print command with a comma.

The printf() function gives you complete control over whether or not there’s a newline at the end.

-br

On Mar 13, 2015, at 4:04 PM, borgdrone7 notifications@github.com wrote:

Hi,
Yes, Arduino Mega has 8Kb of SRAM and 4Kb of eprom. As for prompt, I figured it out on my own and came here to let you know, and saw your answer :). I am getting one extra newline in output, maybe it is due to my code on client side. Do you send extra newline together with response sometimes or it is always just one to end the response? I am sending "print a0" and sometimes I get "\n" first and then "531\n" and sometimes I get immediately "531\n".


Reply to this email directly or view it on GitHub #43 (comment).

@borgdrone7
Copy link
Author

I will try it (speol) thanks.

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

No branches or pull requests

2 participants