mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 17:45:50 +01:00
Removed interpolation of data samples. Added intensity column for activity chart.
This commit is contained in:
parent
22a15c631c
commit
b8c5a44709
@ -264,6 +264,7 @@ public class GBDaoGenerator {
|
||||
addCommonActivitySampleProperties("AbstractActivitySample", activitySample, user, device);
|
||||
activitySample.addIntProperty(SAMPLE_STEPS).notNull().codeBeforeGetterAndSetter(OVERRIDE);
|
||||
activitySample.addIntProperty(SAMPLE_RAW_KIND).notNull().codeBeforeGetterAndSetter(OVERRIDE);
|
||||
activitySample.addIntProperty(SAMPLE_RAW_INTENSITY).notNull().codeBeforeGetterAndSetter(OVERRIDE);
|
||||
return activitySample;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class No1F1SampleProvider extends AbstractSampleProvider<No1F1ActivitySam
|
||||
|
||||
@Override
|
||||
public float normalizeIntensity(int rawIntensity) {
|
||||
return rawIntensity / (float) 100.0;
|
||||
return rawIntensity / (float) 8000.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -69,35 +69,4 @@ public class No1F1SampleProvider extends AbstractSampleProvider<No1F1ActivitySam
|
||||
protected Property getDeviceIdentifierSampleProperty() {
|
||||
return No1F1ActivitySampleDao.Properties.DeviceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<No1F1ActivitySample> getAllActivitySamples(int timestamp_from, int timestamp_to) {
|
||||
List<No1F1ActivitySample> samples = super.getGBActivitySamples(timestamp_from - 3599, timestamp_to, ActivityKind.TYPE_ALL);
|
||||
List<No1F1ActivitySample> outSamples = new ArrayList<>();
|
||||
|
||||
for (No1F1ActivitySample sample : samples) {
|
||||
int timestamp = sample.getTimestamp();
|
||||
int steps = sample.getSteps() / 60;
|
||||
int leftover_steps = sample.getSteps() % 60;
|
||||
for (int i = 0; i < 60; i++) {
|
||||
if (i == 59)
|
||||
steps = steps + leftover_steps; // simplest way to not lose steps from rounding error
|
||||
if (timestamp >= timestamp_from && timestamp <= timestamp_to) {
|
||||
No1F1ActivitySample newSample = new No1F1ActivitySample(
|
||||
timestamp,
|
||||
sample.getDeviceId(),
|
||||
sample.getUserId(),
|
||||
steps,
|
||||
sample.getRawKind()
|
||||
);
|
||||
newSample.setProvider(this);
|
||||
outSamples.add(newSample);
|
||||
}
|
||||
timestamp += 60;
|
||||
}
|
||||
}
|
||||
|
||||
detachFromSession();
|
||||
return outSamples;
|
||||
}
|
||||
}
|
||||
|
@ -465,6 +465,7 @@ public class No1F1Support extends AbstractBTLEDeviceSupport {
|
||||
samples.get(i).setDeviceId(deviceId);
|
||||
samples.get(i).setUserId(userId);
|
||||
samples.get(i).setRawKind(ActivityKind.TYPE_ACTIVITY);
|
||||
samples.get(i).setRawIntensity(samples.get(i).getSteps());
|
||||
provider.addGBActivitySample(samples.get(i));
|
||||
}
|
||||
samples.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user