mikaelpatel / Arduino-Shell

RPN Postscript/Forth Command Shell for Arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Timeout calculation

dpharris opened this issue · comments

I see a new t(timeout) token. I need this in my app!
This works: 13O 0{1000,0t{{13L0}{13H1}e}i T}w
Or: 13O {1000,0t{13X}iT}w
I have been using:
if(MIllis()>next) { .... next+=period; } // this is slightly faster, and gives consistent period

[[ roll-over is a problem, and more of a problem with Shell, since M is only a word.
The math should be something like:
if( (uint16_t)(M-next)>0x3FFF ) ... when using uint16_t (I think)
Or
if( (int16_t)(M-next)>0 ) ... if using signed arithmetic (I think)
]]

Don't really understand this issue. Did you find a bug in the current code or was this a comment.
The proposed rewrites do not work. Actually non of them. The first has a initialization problem. Did you test any of these and is there an actual performance gain in the interpreter (the overhead before coming to the operation code implementation is high)?

Ignore me. Your math works perfectly. Thanks!

I think you are on to something but I could not get it to work with all the mapping from uint32_t to unsigned, etc. Might get back to this later on. The current version is not "pretty" but it works.

"t" for "?timeout" is renamed to "E" for "?expired". This is mainly motivated by uppercase used to Arduino extensions of the virtual machine. Please see commit ba8a5ce.