"compiled" functions to draw curves on OLED quickly ? ( bezier, quadratic, .. ) #1283
Replies: 3 comments
-
Posted at 2019-01-27 by Robin Sun 2019.01.27 Hi @stephaneAG
I happened to be running a chunk of
As an observation only as I don't have a scope to validate, from the FAQ page: There is an example that indicates as fast as 333 microseconds, but to perform any useful task most likely would require a function wrapper. Hope that provides some insight, but get the input from others also. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-01-28 by @gfwilliams Hi, Yes, there's a 4 argument limit. I believe you could always just pass in an array? Either direct to compiled JS, or as an array of bytes to compiled C. And yes, Espruino will reliably handle less than 1ms in an interval, but JS code execution speed will probably hit you around that point. Also http://www.espruino.com/Compilation says under 'doesn't work': One thing to note is that when writing inline C you can't use float/double math - so you'll have to do it all in integers. However if you can do that then you should be ok, and you can call a function with more than 4 arguments from C. It's just when calling C from JS that you're limited to 4 arguments. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-02-01 by stephaneAG @robin thx ! -> same conclusion for the 4 args max, & thks for the 333 us /30 ms reminder ;)
-> I'll have another take on this as soon as I make further progress in some other projects ;) thanks a lot :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2019-01-27 by stephaneAG
Hi there !
I'm currently looking for ways to optimise the way curves are drawn on an OLED screen ( & later rounded polygons ;) ).
By lessenning the number of "steps" used for a curve, I'm getting close to "instantaneous refresh", but I bet there's some way to use "compiled" flag to get even faster calls ( which 'll get handy when drawing more than one curve, for example two rounded polys ).
I tried rewriting the following functions, but always ended up with either an error ( "ObjectExpression is not implemented yet" or "ArrayExpression is not implemented yet" ).
When trying "E.compiledC()", it seems there's a limit on the maximum number of args for a function ( 4 arguments if I got it right from the below test code, if more I got a "Error Parsing signature at argument number " )
Any hint on getting this as fast as can be ? ( I plan to using the above two "tricks" - "compiled" & "E.compiledC" - and also to later drive some strips of APA102 in a POV manner, and this before moving onto creating a "firmware Extension" ( .. ) )
Thanks in advance ! ;)
Curves helpers
no-that-fast curve drawing
Max 4 arguments limit ? ( and yes, I put 'int' instead of 'float' to test out .. )
Chunks of code from last unsuccessful try
I see if I can find time to learn & try writing my own C extensions today ( right after some test on OLED screen SSD1306: it seems passing a bitrate of 800000 works, but I'm not sure if the difference 'll be visible since I'm not sure of the "resolution*" of 'setInterval/setTimeout' on Espruino).
*Putting it another way, does Espruino handle <1ms as setInterval/setTimeout arg ?
( & If so, how to get such small delay in a reliable manner ? )
This being said, good weekend everyone ;)
++
Beta Was this translation helpful? Give feedback.
All reactions