The forerunner 45 (fr45) comes 6 preinstalled watch faces. Is the code available for these? If so, where?
The forerunner 45 (fr45) comes 6 preinstalled watch faces. Is the code available for these? If so, where?
No it's not. They are written in native code in the watch firmware and not CIQ.
The fr45 is really CIQ 1.4.0. and other devices are already on CIQ 4.x (the venu2 for example). The size of CIQ watch faces (that's the only app type you can use on a fr45) is smaller than other devices…
If I recall correctly, the MIPS-based devices will update every second while it's "awake" (about 10 seconds after you raise it to glance at the screen), and once a minute when it's not awake. you can override…
No it's not. They are written in native code in the watch firmware and not CIQ.
Ah, thanks. Is the native code written in C? A lot of the examples (including CIQ examples) I've seen seem to be for later API versions. Filtering the docs within an API range would be handy. I'm having a few problems. There seems to be a limitation that the custom watch faces will only update once per minute. I tried to approximate/visualize the battery change to within 0.01% using the rate in seconds since a full charge. However, I stored this variable in the watchface view file and that gets reset every time you change screens. What's the proper way to more persistently store that information or get a more accurate battery reading? It seems that the GPS altitude reading is generally quite far off (+- 100 feet) since the GPS only turns on while doing an activity but then you don't see the main watch face. My impression is that Activity.getActivityInfo() data is only available when an activity is occurring since it's not displaying it when I think it should. I've also tried the more direct sensor call approach with: Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]); but that requires 3.2.0. I want to display all of the data I can as accurately as I can and I'm having trouble getting things to click. Is there a list handy with all of the data that could be displayed? I've noticed that unicode up to \u011F seems available, are there other characters available too? Perhaps the icons in the default apps are pngs and not font symbols? I'd think that I might have access to some of those. Is there any information on the power draw of various functions (Ex: drawing a circle, line, text, ...)?
I'm also thinking that perhaps 1.4.0 (listed here https://developer.garmin.com/connect-iq/compatible-devices/) might not be a true ceiling for fr45 and that there might be some functionality that is available to it?
The fr45 is really CIQ 1.4.0. and other devices are already on CIQ 4.x (the venu2 for example). The size of CIQ watch faces (that's the only app type you can use on a fr45) is smaller than other devices at 48k.
In the API doc you can see what you and use by looking at the "Since" line. If it's "Since 1.x.x". you can use it on the fr45, but if it's "Since 2.x" (or greater) you can't..
Start with something simple, like just displaying the date and time
If I recall correctly, the MIPS-based devices will update every second while it's "awake" (about 10 seconds after you raise it to glance at the screen), and once a minute when it's not awake. you can override the onEnterSleep and onExitSleep methods of WatchUi.Watchface in your app to listen and execute code on these events. onUpdate() is used for updates when the watch is awake, and there is an "onPartialUpdate" method that you can override to update just PARTS of the screen (using a screen clip rectangle) every second even when the watch is "asleep," but the FR45 doesn't support that as it was added in 2.3.0.
Application.Storage is what you'll want to use for persistent storage across watchface viewings. Load during initialize() or onStart(), and store them in onStop(). But again, the FR45 doesn't support that since it was introduced in later CIQ, so for devices older than 2.3.0, you'll need to use setProperty() and getProperty(), but I would recommend you have some code branching on that one to check if the watch supports Application.Storage instead, as there are some huge downsides to using the deprecated getProperty/setProperty functions on devices.
As you mention, getActivityInfo() is only good when there is a activity/workout in-progress. For the all-day stats, you'll want to use ActivityMonitor.Info or other subclasses of ActivityMonitor.
Actually, for HR, you don't enable the HR sensor, and you can get the current HR in a watch face with Activit.getActivityInfo(),currentHeartRate, even if you aren't recording an activity. You'll get the HR from the internal OHR sensor
onUpdate is to update the watch face, if you are in low power or not. When you're not in low power, you can display seconds is really the only thing that needs to be different.
This is my basic code for onEnterSleep() and onExitSleep() where all I do is set a boolen that I then check in onUpdate to see if I should show seconds or not
if(!lowPower) {
//display seconds
}
//! The user has just looked at their watch. Timers and animations may be started here. function onExitSleep() { lowPower=false; Ui.requestUpdate(); } //! Terminate any active timers and prepare for slow updates. function onEnterSleep() { lowPower=true; Ui.requestUpdate(); }
Yeah, I had tried that. The following doesn't work for me. hr is always null for me. When I enter an activity and then exit out that seems to cause an issue which causes my battery meter to not work. If I restart Position.getInfo().altitude returns max int until I enter an activity and then it becomes a bit more accurate. Thanks for the tips on Ui.requestUpdate(), that's a neat feature.
var info = Activity.getActivityInfo();
var hr = info.currentHeartRate;
var hr_string = "---bmp";
if( hr != null ){
hr_string = hr.format("%d")+"bmp";
}
View.findDrawableById("HeartRate").setText( hr_string );
Oh, I was messy and put it after View.onUpdate(dc) which would obviously cause issues. Having confirmation that Activity also gets the heartrate normally was a big help. I thought maybe I needed to find a different function. But instead I just have to refactor and get back to a reasonable setup. Thank you.
are you testing in the sim or on a real watch while you are wearing it?
In the sim, you need to provide it HR data, so in the sim do Simulation>fit data>simulate data.
If you have a fr45, you can download this watch face and see how HR will work:
https://apps.garmin.com/en-US/apps/2c632834-3bb2-4dfa-b008-4f6d48dda0cb
Yeah, I worded it badly above, said onUpdate() is every minutes when "sleeping" and once per second for a bit after glancing to wake it up. Buy on devices 2.30 or above you can draw every second by using onPartialUpdate(). So you could clip just the area around your time display and update ONLY that text field every second all the time. I use it on all my faces (older devices will just ignore the onPartialUpdate() calls, so it's safe to define for all devices).
The AMOLED devices are their own different bag of worms, requiring checking the :requiresBurnInProtection device attribute and tracking the sleep state.