Complete
over 3 years ago

Closing out ticket since this is the same as issue WERETECH-9599.

getOxygenSaturationHistory() issue

Hi.

I m trying to use the Oxygen Saturation Sensor History. i m using code below:

var strValue = "";
var spo2 = null;
if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getOxygenSaturationHistory)) {
	var spo2H = Toybox.SensorHistory.getOxygenSaturationHistory({});
	var sample = spo2H != null ? spo2H.next() : null;
	if (sample != null && sample.data != null) { spo2 = [sample.data, Utils.momentToString(sample.when,0,true)]; }
}
if(spo2 != null){ strValue = spo2[0].format("%d") + "%" + spo2[1]; }

It seems to not work correctly, as i some times i obtain no value even if i just made mesure.

Other times, even if the moment value of last mesure is correct, the value is wrong and change even if no new mesure provided.

Overmore, as soon as i try to define period using duration i got an error specialy when the period used doesn't contain mesure.

Please note that all is working fine on simulator but not on watch.

Can you please open a ticket.