Ticket Created
over 4 years ago

WERETECH-9599

Toybox.SensorHistory.getOxygenSaturationHistory strange samples

I am getting really strange results reading the Toybox.SensorHistory.getOxygenSaturationHistory. Although it seems to work fine in the simulator, on the Fenix 6X pro I get extreme high e.g.55311017190201917345628160.000000 and extremely low e.g. -14393159110885376.000000 results among results around the 29 which is also very deadly when it would be an accurate spO2 reading. Also the values returned by the iterator may differ between subsequent calls.  Is this a bug in the recently released 3.2 SDK? is anyone else also experiencing this issue? 

  • Yes, this looks to be an issue between the VM and the FW.
  • Thank you for the confirmation. I suppose we have to wait for a firmware update. 
  • I've been adding more to this app, and what I do see, is the max value can have a really bad value, and it seems that all samples are 0 on an actual device, But still checking on that.
  • Not looked at this before and to be honest, I usually don't even have the sensor on, but threw together a really simple app.  It shows the time, current value from Sensor, and the most recent from SensorHistory. On a 945 Sensor shows what I see in the widget, and SensorHistory is 0.000000 but I'm not sure how often a value is saved to history.  I've only been running for 5 minutes. Here's the code as I suspect you may not be looking at the correct thing:
        function onUpdate(dc) {
        	dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
        	dc.clear();
        	dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
        	var clockTime = System.getClockTime();
        	dc.drawText(width/2,20,Gfx.FONT_SMALL,clockTime.hour.format("%d")+":"+clockTime.min.format("%02d")+":"+clockTime.sec.format("%02d"),Gfx.TEXT_JUSTIFY_CENTER);
        	
        	var si=Sensor.getInfo();   	
        	dc.drawText(width/2,50,Gfx.FONT_SMALL,""+si.oxygenSaturation,Gfx.TEXT_JUSTIFY_CENTER);
    
    		var iter=SH.getOxygenSaturationHistory({:period=>30,:order=>SH.ORDER_NEWEST_FIRST});
        	var min=null;
    		var max=null;
    		var cur=null;
    		if(iter!=null) {
    			min=iter.getMin();
    			max=iter.getMax();
    			var sample=iter.next();
    			cur=sample.data;
        	}
        	dc.drawText(width/2,80,Gfx.FONT_SMALL,""+cur,Gfx.TEXT_JUSTIFY_CENTER);
        }
    And her's the sim (I used a va4 in the sim and playing back simulated data): /resized-image/__size/320x240/__key/commentfiles/fb5d84b10a5745448a7a45dafc1faa43-5f0a3292-9daf-48e8-9168-e638f7e86748/pastedimage1598824178196v1.png