Custom interval fields

Sure. I added a new public interval field “Average Core Temp” and added that to your interval fields. You should see it in the “Fields” list. The script looks like this:

temp = streams.get("core_temperature").data
tot = 0
c = 0
for (let i = interval.start_index; i < interval.end_index; i++) {
  let v = temp[i]
  if (v) {
    tot += v
    ++c
  }
}

c ? tot/c : null

I also added “Max Core Temp” if that is what you are after:

temp = streams.get("core_temperature").data
max = 0
for (let i = interval.start_index; i < interval.end_index; i++) {
  let v = temp[i]
  if (v > max) max = v
}

max > 0 ? max : null
3 Likes