Complete
over 3 years ago

VVA4-5274

Fixed

Obscurity flags wrong on Venu device but OK in simulator

I'm writing a complex data field for a user. He reported that the font size I'd chosen was too big for the middle positions of the 4-fields layout.

It turns out that getObscurityFlags() returns 5 (OBSCURE_LEFT | OBSCURE_RIGHT) when it should return OBSCURE_LEFT for the left hand position or OBSCURE_RIGHT for the right hand position.

This can be demonstrated by making a complex datafield app using the  Eclipse wizard, calling getObscurityFlags() in onUpdate() and displaying the result.

My workaround is to check the field width to see if it's one of the middle fields of the 4-fields layout or the middle one of the 3-fields layout (where OBSCURE_LEFT | OBSCURE_RIGHT is correct) but you can't tell the left field from the right one.

getObscurityFlags() returns the expected result in the simulator.

Parents
  • Hi,

    I can confirm that getObscurityFlags are... JUST PLAIN WRONG on Fenix 6x also.

    Code to test:

    using Toybox.WatchUi;
    using Toybox.Graphics as G;
    class TestObscurityFlagsView extends WatchUi.DataField {
        var inLayout;
        var inUpdate;
        // Set the label of the data field here.
        function initialize() {
            DataField.initialize();
        }
        function onLayout(dc) {
            // Docs say "Use of this method is only valid during the call to onUpdate()." 
            // But the standard Garmin example depends on using it here, and the _POINT_
            // of having an onLayout where you can't do layout kinda sucks.
            inLayout = getObscurityFlags(); 
        }
        function compute(info) {
            // But this should always be accurate.
            inUpdate = getObscurityFlags();
        }
        function onUpdate(dc) {
            var bg = getBackgroundColor(), fg = 0xffffff - bg;
            var tx = dc.getWidth() / 2, ty = dc.getHeight() / 2;
            dc.setColor(fg,bg);
            dc.clear();
            dc.drawText(tx, ty, G.FONT_LARGE, "L"+inLayout+" U"+inUpdate, G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER);
        }
    }

    Gets UTTERLY UNRELIABLE values as per the screenshots attached.

    In simple terms; with the current firmware, it is not possible to use getObscurityFlags to layout shape dependent data fields at all, whatsoever, under any circumstances.

    THIS IS A MAJOR AND VERY NASTY BUG FOR ANY AND ALL GRAPHICAL FIELDS (Like my entire range of data field dials.)

    Despite modifying all of a range of dials to check obscurity flags in onUpdate rather than onLayout, I am still seeing deeply unreliable behaviour where display changes between activities due to unreliable getObscurityFlags values.

    This should be L7 U7 and L13 U13. Three out of four wrong.

    This should be L7 U7 and L6 U6. Four out of four wrong.

Comment
  • Hi,

    I can confirm that getObscurityFlags are... JUST PLAIN WRONG on Fenix 6x also.

    Code to test:

    using Toybox.WatchUi;
    using Toybox.Graphics as G;
    class TestObscurityFlagsView extends WatchUi.DataField {
        var inLayout;
        var inUpdate;
        // Set the label of the data field here.
        function initialize() {
            DataField.initialize();
        }
        function onLayout(dc) {
            // Docs say "Use of this method is only valid during the call to onUpdate()." 
            // But the standard Garmin example depends on using it here, and the _POINT_
            // of having an onLayout where you can't do layout kinda sucks.
            inLayout = getObscurityFlags(); 
        }
        function compute(info) {
            // But this should always be accurate.
            inUpdate = getObscurityFlags();
        }
        function onUpdate(dc) {
            var bg = getBackgroundColor(), fg = 0xffffff - bg;
            var tx = dc.getWidth() / 2, ty = dc.getHeight() / 2;
            dc.setColor(fg,bg);
            dc.clear();
            dc.drawText(tx, ty, G.FONT_LARGE, "L"+inLayout+" U"+inUpdate, G.TEXT_JUSTIFY_CENTER | G.TEXT_JUSTIFY_VCENTER);
        }
    }

    Gets UTTERLY UNRELIABLE values as per the screenshots attached.

    In simple terms; with the current firmware, it is not possible to use getObscurityFlags to layout shape dependent data fields at all, whatsoever, under any circumstances.

    THIS IS A MAJOR AND VERY NASTY BUG FOR ANY AND ALL GRAPHICAL FIELDS (Like my entire range of data field dials.)

    Despite modifying all of a range of dials to check obscurity flags in onUpdate rather than onLayout, I am still seeing deeply unreliable behaviour where display changes between activities due to unreliable getObscurityFlags values.

    This should be L7 U7 and L13 U13. Three out of four wrong.

    This should be L7 U7 and L6 U6. Four out of four wrong.

Children