Would Garmin devices be able to run Javascript or NodeJS

Hi,

Not sure about which part of the forum I had to post it but if you think about a better category, please let me know.

So I was wondering why Garmin uses MonkeyC, apart from pure choice. I understand it would require to rebuild most of the softwares and firmwares but hypothetically ?

Would the devices be able to run JS or Node ? With some restrictions in the language maybe ? Like MonkeyC has restrictions as well.

Would it be too heavy ? Any other issues ? Pros and cons ?

What are your thoughts ?

(Would be so easy to build apps, data fields or watchfaces)

Cheers

Top Replies

All Replies

  • Here's an old thread that discusses it.

    https://forums.garmin.com/developer/connect-iq/f/discussion/7039/why-monkey-c

    I'm not sure if it being its own language is that much of a barrier.

    That the devices are slow and what's allowed is very limited is more of a barrier.

    Note that Garmin had to shoehorn an app system into an existing (and limited) architecture.

  • Yes exactly, but they could limit what is allowed for any languages. MonkeyC is a restricted Java, they could use a restricted JS or Node, for limiting the memory and keeping the long battery life !

    thx for the link ;)

  • The Javascript interpreter might use too much resources. The video in the link said that it would. 

  • Oh I totally get that a normal Js interpreter would use too much resources...

    That's why it would have to be a restricted version of JS, that updates the screen only every second for example.

  • Here's a subset that is 16Kb: https://github.com/coder-mike/microvium

    When IQ was introduced, the resources the devices had were very limited.

    That Garmin didn't take the obvious course of using an existing language is a strong suggestion that that course wasn't viable. (Garmin said it wasn't viable in the video.)

    Again, I think the limitations on the devices are much more of a barrier to developers than the language.

  • Only MonkeyC can be used to develop CIQ apps for Garmin device.  A simple device app or widget that updates the screen every second is trivial, and for a watch face, the every second/every minute update is called by the system, while in a data field, it's automatic every second if the DF is visible,

    Have you looked at the samples in the SDK, or done a "New Project" in VSC to use one of the base templates?

  • Thx for the link with Microvium. Interesting !

    So if it's 16Kb, why don't they use it since they wanted something smaller than 64Kb ?

  • Yes I did, but first it didn't compile, I had to change plenty of things without documentation.

    Plenty of infos missing in the doc (and undrinkable doc as we both discussed in a previous post a few days ago). For example :

    - Not that easy to understand how to separate code between OnUpdate and OnPartialUpdate

    - Impossible to rotate or curve text without creating a custom font... Also Garmin doesn't have a tiny font by default (the smallest is ridiculously big and not antialiased, very ugly)

    - no infos about which colors are available for each device. After some research, I found out there are 64 for the FR255. Though the list is nowhere to be found on Garmin's Doc. So I found some list for a 64 palette. But still not displaying the right color

    I stop here because it wasn't the point of my post.

  • Yes I did, but first it didn't compile, I had to change plenty of things without documentation.

    Never has a problem with samples, started with them 10 about years ago.  What errors are you seeing?

    Not that easy to understand how to separate code between OnUpdate and OnPartialUpdate

    For using onPartialUpdate, see this thread (you'll also see it in the analog sample) 

    https://forums.garmin.com/developer/connect-iq/f/discussion/5156/1hz-watch-faces---q-a

    Impossible to rotate or curve text without creating a custom font.

    And here's a watch face that shows a bunch of things, including onPartialUpdate, complications, a background service and vector fonts (curved text on some devices)


    https://forums.garmin.com/developer/connect-iq/f/discussion/349473/simple-example-wf-that-shows-a-bunch-of-things

    - no infos about which colors are available for each device

    See https://developer.garmin.com/connect-iq/compatible-devices/ and for more details including the color palettes, https://developer.garmin.com/connect-iq/reference-guides/devices-reference/#devicereference

  • I'm on holidays and trying to write all that on mobile, and let's be honest, they didn't think about that. But thank you for the links.

    Anyway, I went through the few samples given with the SDK. Only 1 was for analog, written long ago apparently, and I had to change a few things to even make it compile. Not gonna explain here, but not that straightforward. Of course I ended up making it.

    regarding the font and OnPartialUpdate, I will look at it but won't be able to compile for a couple of days.

    Your "1Hz" example is 7 years old. Is it really still the way we build a watchface ? I mean the SDK must have changed.

    As for the palette, as I said in my previous post, that page is too heavy and keeps crashing my mobile browser (check the source of that page and try to find me a page online which is that long ;)

    Anyway, I went on that page some time ago, it didn't make the colors appear properly.