You are here

Spiro

Topics: 
Programming

Even more Pebble adventures ! Now that Skylines was thriving in the Pebble appstore, I decided to generate a watchface for the new Pebble Time, so I had something to show off when my Pebble Time will arrive in August. And what better app could I implement than some colorfull spirographs ?

It took quite a while to finish this : as I didn't had my Pebble Time yet, I had no real hardware to test the app, so I had to rely solely on the Pebble emulator on my computer. Eventually, I came up with a first version which I published on the appstore. However, soon, different people remarked that the app was slow and crash prone. Turned out the app used quite some sine/cosine functions which were the cause of all those slowdowns. Hard to believe that my 20 year old HP pocket calculator was more powerfull than a wearable with a modern ARM chipset !

So it was clear I couldn't use sine/cosine functions. Pebble had a workaround in the SDK with sin_lookup functions which use a precalculated table to come up with this. However, this was mostly oriented to create the movement of analogue watches, and the generated values didn't make any sense to me. So I quickly programmed my own co/sine lookup table, and used the default hypotrochoids equations. This worked a lot better & quicker, but this needed also a lot of iterations to come up with a decent spirograph. And in some cases, the spirograph turned into gibberish. More debugging revealed that this was to events coming in when the Pebble was generating the spirograph, like the flick_wrist_to_update option I added to the watchface.

So eventually, I turned to the default Pebble SDK co/sine_lookup functions, and implemented my own hypotrochoids equations with it. This time, all worked well without any glitches. The result is Spiro, a colorfull watchface for the Pebble Time, and the original Pebble (only in B&W off course)..