Hi,
I found on the internet a small program and I want to modify it to display the value of the barometer difference between current pressure and the last 3 hours.
Does anyone have an idea what I need to change.?
Thanks a lot
if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getPressureHistory)) {
var last1=null, last2=null;
var itr = Toybox.SensorHistory.getPressureHistory({});
var sample = itr.next();
while (sample != null) {
if (sample.data != null) {
last1 = sample.data;
break;
}
sample = itr.next();
}
sample = itr.next();
while (sample != null) {
if (sample.data != null) {
last2 = sample.data;
break;
}
sample = itr.next();
}
if (last1 != null && last2 != null) {
return last1<last2 ? "decrease" : last1>last2 ? "increase" : "same";
}
}
return null;