Most recent activity
-
Thanks @fanoush, shows how well I know Javascript! Much appreciated, I hope I can now fight it to a standstill.
-
Thanks, @Gordon. i'm afraid I'm still struggling: another line in my program contains:
if (dest==2 && y>1 && y<5) {...
which gives the same error. I've tried adding parentheses as in your suggestion, eventually ending up with abominations like
if (((dest==2)==true) && (((y>1)==true) && ((y<5))==true)) {...
but all these variants gave the same error. Frustratingly, just including the offending line in a simple test program works perfectly so the problem must be due to something elsewhere in the code. I will try to sort it out.
I'm afraid I've been doing exactly what you and @fanoush warn against, sticking "compiled" on the entire draw loop. This runs at 5 frames per second versus about 1.5 for raw or vanilla. So while I don't want ignore your advice , I'm loathe to give up the extra speed - it will be interesting to see what JIT delivers when I can get that working.
My use of the watch is entirely focused on interesting watch faces - I have very few other apps installed so RAM usage and startup speed aren't really issues. I would like to contribute something to the community, however, so when I have this face working properly I hope to publish it.
-
-
-
Thanks @fanoush.
The error from "compiled" stops it working and the code is just uploaded as source.
I have other problems with "jit": it seems not to like '&&' both on the line in question and elsewhere in my code:
JIT SyntaxError: Got && expected EOF at line 3 col 28 g.setBgColor((bngl && E.getBattery()<10)?63488:(g.th... ^
The following test gives me the same error:
function test() { "jit"; print((true && false)?'y':'n'); } test();
I do have many maths options in a loop: I'm making a version of https://www.youtube.com/watch?v=IA4UsV04bnM
and am rotating 128 lines - there's a couple of screenshots below. I've tried to optimise the code anyway by precomputing the rotated lines, using Int8Arrays and Float32Arrays etc. What's left in the loop is therefore pretty simple arithmetic, indexing into the arrays and comparisons but quite a lot of them. Without compiling I get roughly 1 loop per sec, with I get between two and three per sec so a really good improvement. -
I'm trying to compile a watch face that includes the following code to change the background colour as a simple low battery warning:
g.setBgColor((bngl && E.getBattery()<10)?63488:(g.theme.bg))
When compiled this gives:
WARNING: Function marked with "compiled" uploaded in source form
[ COMPILER MESSAGE ] : Error: Infer(unforced) kept changing stuffIf the line is commented out the warning doesn't appear and the compiled version runs.
What causes the error and is there a way around it? Thanks in advance.
-
Thanks a lot, @fanoush, just what I wanted.
Thanks, both. The comparisons are working in line with @fanoush's guidance and I'd already bound calls to Math.xxx, I will bind g.xxx as well - I will get there eventually!