/* Find the waveform temperature range index for a given temperature in °C. If no range in the waveform data fits the given temperature, return the closest one. Returns -1 if the waveform does not contain any temperature range.  */
int waveform_temp_range_index(const EpdWaveform *waveform, int temperature)
/* Find the waveform temperature range index for a given temperature in °C. If no range in the waveform data fits the given temperature, return the closest one. Returns -1 if the waveform does not contain any temperature range.  */
int waveform_temp_range_index(const EpdWaveform *waveform, int temperature)
{
        return -1;
    }
    while (idx < waveform->num_temp_ranges - 1
            && waveform->temp_intervals[idx].min < temperature) {
        idx++;
    }
    return idx;
}