fenix 6 * firmware 8.10 have a Unexplainable BUG.

here is the watch face https://apps.garmin.com/en-US/apps/239c24d8-d893-481f-9626-da6507e880f0

A error occured only on fenix 6 * with firmware 8.10  after changing settings . The ERA log shows that error occues here 

var value=Toybox.SensorHistory.getTemperatureHistory().next().data;
value+=Application.getApp().getProperty("offset")

if(System.getDeviceSettings().temperatureUnits==System.UNIT_STATUTE)
{
    value=value*1.8+32;  // <--------Unhandled exception
}

I have test this, but sill reported the same problem after changing settings .

var value=Toybox.SensorHistory.getTemperatureHistory().next().data;

if(null == value)
{
    return;
}
try
{
    value = value * 1.0 + 0.0;  // no error
}
catch(e)
{
    return;
}
value+=Application.getApp().getProperty("offset")
try
{
    if(System.getDeviceSettings().temperatureUnits == System.UNIT_STATUTE)
    {
        value = value * 1.8 + 32;     // <--------Unhandled exception , even in try , cause crash
    }
}
catch(e)
{
    return;
}

I don't know why , I doubt if it's a bug of the firmware 8.10

  • finally get to know how it happens , that float settings are returned as strings!!!

  • See the New Developer FAQ Wiki where it talks about how some settings may come across as the wrong type (Numbers are discussed there).  A simple wrapper function solves this.  I always use one for settings to check the type.  This isn't due to new FW as this first came up in 2015-2016 when settings were introduced.

    My app uses app settings, and it sometimes crashes after changing the settings, but the rest of the time it works fine. What can cause this?

    In the past, there have been issues where the client used to manage app settings, like Garmin Express or Garmin Connect Mobile, has returned a setting value with an unexpected type, so it's good practice to check a setting value to ensure it's the expected type. For example, this code will check for a null value and convert the value to a Number as long as it is not null. Otherwise, a default value is returned: