Fix HRV RMSSD calculation window size

Reduced RMSSD calculation window from 120 to 30 samples. The larger
window was including heart rate transitions (rest to exercise), causing
artificially high RMSSD values during exercise. A 30-sample window
(~20-30 seconds) provides more accurate real-time HRV measurements.
This commit is contained in:
Claude
2026-01-27 09:16:00 +00:00
parent c24b2c3a87
commit fd3611298e

View File

@@ -195,9 +195,11 @@ void bluetoothdevice::skinTemperature(double skinTemperature) { SkinTemperature.
void bluetoothdevice::heatStrainIndex(double heatStrainIndex) { HeatStrainIndex.setValue(heatStrainIndex); }
void bluetoothdevice::rrIntervalReceived(double rrInterval) {
// RR-interval is in milliseconds
// Add to buffer for RMSSD calculation (keep max 120 samples, approximately 2 minutes of data)
// Add to buffer for RMSSD calculation (keep max 30 samples for real-time HRV display)
// Using 30 samples (~20-30 seconds of data) gives more responsive and accurate HRV
// than using longer windows which can include heart rate transitions
rrIntervals.append(rrInterval);
while (rrIntervals.size() > 120) {
while (rrIntervals.size() > 30) {
rrIntervals.removeFirst();
}