mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: Use current day resting heart rate
This commit is contained in:
+8
-3
@@ -380,14 +380,19 @@ public class FitImporter {
|
||||
trainingLoadChronicSamples.add(sample);
|
||||
}
|
||||
} else if (record instanceof FitMonitoringHrData monitoringHrData) {
|
||||
if (monitoringHrData.getRestingHeartRate() == null) {
|
||||
if (monitoringHrData.getRestingHeartRate() == null && monitoringHrData.getCurrentDayRestingHeartRate() == null) {
|
||||
LOG.warn("Resting HR at {} is null", ts);
|
||||
continue;
|
||||
}
|
||||
LOG.trace("Resting HR at {}: {}", ts, monitoringHrData.getRestingHeartRate());
|
||||
LOG.trace("Resting HR at {}: {}, currentDay={}", ts, monitoringHrData.getRestingHeartRate(), monitoringHrData.getCurrentDayRestingHeartRate());
|
||||
final GarminHeartRateRestingSample sample = new GarminHeartRateRestingSample();
|
||||
sample.setTimestamp(ts * 1000L);
|
||||
sample.setHeartRate(monitoringHrData.getRestingHeartRate());
|
||||
if (monitoringHrData.getCurrentDayRestingHeartRate() != null) {
|
||||
// Prioritize the current day value - that matches what the watch displays
|
||||
sample.setHeartRate(monitoringHrData.getCurrentDayRestingHeartRate());
|
||||
} else {
|
||||
sample.setHeartRate(monitoringHrData.getRestingHeartRate());
|
||||
}
|
||||
restingHrSamples.add(sample);
|
||||
} else if (record instanceof FitDeviceStatus deviceStatus) {
|
||||
Integer level = deviceStatus.getBatteryLevel();
|
||||
|
||||
+16
@@ -1,5 +1,6 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -14,4 +15,19 @@ public class FitImporterTest extends TestBase {
|
||||
final FitImporter fitImporter = new FitImporter( null, null);
|
||||
fitImporter.importFile(new File("/storage/SKIN_TEMP.fit"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("helper test for development, remove this while debugging")
|
||||
public void localTestFolder() throws Exception {
|
||||
final File dir = new File("/storage/MONITOR/2026/");
|
||||
final File[] files = dir.listFiles();
|
||||
Assert.assertNotNull(files);
|
||||
for (File file : files) {
|
||||
if (!file.getName().endsWith(".fit")) {
|
||||
continue;
|
||||
}
|
||||
final FitImporter fitImporter = new FitImporter( null, null);
|
||||
fitImporter.importFile(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user