How to handle the Instinct 2 screen?

Hi!

I have a data field and I am struggling to make it work properly on the Instinct 2 screen. For the examples on the images, I just want to disregard the sub screen (on which I'll work latter).

This is the expected result, which seems right on the simulator for the Instinct 3 solar:

The result is also as expected on other devices, such as Enduro 3:

But when I run it on the Instinct 2, this is the result I get:

It is like the screen area is limited to only the superior half and limited by the subscreen.

To draw the lines, the code is as follows:

screenWidth = dc.getWidth();
screenHeight = dc.getHeight();
screenLines = [
            // Horizontal lines
            [0, screenHeight/4, screenWidth, screenHeight/4],
            [0, 2*(screenHeight/4), screenWidth, 2*(screenHeight/4)],
            [0, 3*(screenHeight/4), screenWidth, 3*(screenHeight/4)],
            // Vertical lines
            [screenWidth/2, 2*(screenHeight/8), screenWidth/2, 6*(screenHeight/8)]
        ];

and eventually I use dc.drawLine to draw the lines.

If I print the values of width and height on the terminal, I get 112 x 71, although the reference guide says its screen is 176 x 176. If I hard code these dimensions, the result is still unsatisfactory:

What am I missing here in order to get the same behavior for the Instinct 2 family? Or is it just a simulator issue and works in real life?

TIA.

  • This feels like a simulator bug to me (hopefully not also a bug on the real device). I can see similar behavior with a complex data field created by the new project wizard.

    I tried adding the following code to onLayout:

    System.println("onLayout");
    System.println("dc.height = " + dc.getHeight());
    System.println("dc.width = " + dc.getWidth());

    With the default 1-field layout, the following output is generated for an instinct2 device in the sim:

    onLayout
    dc.height = 71
    dc.width = 112

    The sample code clears the dc with the background colour (from DataField.getBackgroundColor()), but because the dc is smaller than the screen, 3/4 of the screen remains black:

    (This is odd since the data field background colour for Instinct 2 is supposed to be white, so the part of the screen that isn't drawn by the app would be expected to be white as well, but it's probably just another indicator that this is indeed a bug.)

    If I change the layout to 2 fields in the simulator, onLayout is called over and over again, with the following output:

    onLayout
    dc.height = 176
    dc.width = 176
    onLayout
    dc.height = 62
    dc.width = 62
    onLayout
    dc.height = 176
    dc.width = 176
    onLayout
    dc.height = 62
    dc.width = 62
    ...

    This part seems to be an unambiguous bug.

    All of the instinct2* devices seem to be affected. Instinct E and Instinct 3 (MIP) seem to be fine. (That should cover all the devices with a subscreen)

    Ofc Instinct Crossover and Instinct 3 AMOLED also seem to be fine, but they don't have a subscreen.

  • Interesting investigation. This confirms it is not just me getting into this scenario.

    I have deployed my code into production, so let's see if any user comes back with a complaint.

  • Hmm quick update to my investigation above:

    It seems that for layouts other 1 field, onLayout is called continuously in the sim even for devices that aren't broken the same way as instinct2* (e.g. fr955), but at least the dc width/height numbers make sense. If I set the layout to 1 field, onLayout is only called once.

    Not sure what to make of this. For a 2 field layout (for example), I would expect onLayout to be called twice (*), not continuously (perhaps once or twice a second). (* Ofc that's only bc the sim renders the CIQ data field once for every field that's visible on the screen, which is not likely to mirror the real-life usage of the field)

    So I'm not sure whether the continuous onLayout calls would happen on a real device or not. (I would hope not, given that the API doc suggests loading resources in onLayout - I think this is a mistake in any case, since a user *can* add the same CIQ data field to a multi-field layout more than once, in which case onLayout will be called more than once afaik, so you really don't wanna do any one-time setup in onLayout.)

  • In any case I think it might be worth filing a bug report or two in the Connect IQ Bug Reports subforum.

    This is a good find, thanks for posting about it!

  • The actual I2 devices are a bit weird due to the subscreen.  There is really no 1 field layout. You can have 2 fields or more.  The subscreen is a field, and the screen except the subscreen is a field

    Here's a screen shot from the I2.  Calories are shown in the subscreen, while one of my test DFs is shown on the rest of the screen. If I wanted it to look better, I'd look at shifting my text down a bit based on something like the dc size.

    Here's how that same DF looks in the sim with 2 fields.  Note..  on the real I2, I can't configure the subscreen to use a Complrx CIQ DF.  I've not tried a simple one.

    I think you need to find someone with a real I3 with a subscreen to see how things work on the real device.  It could be a bug in the sim.  Maybe someone here has one.

  • In case someone has an I2 and want to test this code, it is available here: apps.garmin.com/.../738acc8f-c8eb-44cf-a929-b6a2ed083947

  • You want to use the dc width and height.  Not the screen width and height.  And I already explained that there is no one field layout on the real device.  You can have two fields, because the subscreen counts as one and included a screen shot from the real I2.

  • There is really no 1 field layout. You can have 2 fields or more.  The subscreen is a field, and the screen except the subscreen is a field

    I see, that explains the following output with my test code, when I select 2 fields in the sim for instinct2:

    onLayout
    dc.height = 176
    dc.width = 176
    onLayout
    dc.height = 62
    dc.width = 62
    ...

    Thanks for that context!

    However, it doesn't explain:

    - why the simulator allows you to select 1 field for instinct2 (that would seem to be a bug)

    - why the simulator doesn't work the same way for Instinct E or MIP Instinct 3

    - why the simulator calls onLayout continuously for any layout with more than 1 field, on all devices. (Does this also happen on a real device? If so, that would also seem to be a bug. At the very least, the documentation should not tell people to load resources or do any other kind of one time setup in onLayout)

  • Since you can set a usable 1 field layout on devices without a subscreen, maybe it should be grayed for devices with a subscreen, but it's also the overall default,  This could just be the way the sim is showing an invalid setting.

    As one of the CIQ folks says "It's a simulator, not an emulator" and there are many things that are different in the sim than on a real device.

    Take a look at the I2s in the sim.  It's pretty much the same, except below the subscreen, 7 pixels on the right are covered by the bezel.