mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
git save format: don't save redundant sample information
When we load sample data from a git save-file, we always default to using the state from the previous sample (except for the special case of cylinder pressure where an empty value does not mean "same", but "interpolate", see core/load-git.c: new_sample()). But the corollary to that is that it's always redundant to save sample data that hasn't changed since the previous sample. For some reason, the rbt, bearing and heartrate sample data didn't follow that rule, and instead saved with lots of extra reduncancy. (The alternative would be to clear those samples at load time, and make them act like the pressure data, but it would appear that all these three values may as well just have the normal "if no change, don't save them" semantics). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1e38d9239a
commit
ea31800f61
1 changed files with 11 additions and 3 deletions
|
@ -286,8 +286,10 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
|
|||
old->cns = sample->cns;
|
||||
}
|
||||
|
||||
if (sample->rbt.seconds)
|
||||
if (sample->rbt.seconds != old->rbt.seconds) {
|
||||
put_format(b, " rbt=%u:%02u", FRACTION(sample->rbt.seconds, 60));
|
||||
old->rbt.seconds = sample->rbt.seconds;
|
||||
}
|
||||
|
||||
if (sample->o2sensor[0].mbar != old->o2sensor[0].mbar) {
|
||||
put_milli(b, " sensor1=", sample->o2sensor[0].mbar, "bar");
|
||||
|
@ -308,8 +310,14 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl
|
|||
put_milli(b, " po2=", sample->setpoint.mbar, "bar");
|
||||
old->setpoint = sample->setpoint;
|
||||
}
|
||||
show_index(b, sample->heartbeat, "heartbeat=", "");
|
||||
show_index(b, sample->bearing.degrees, "bearing=", "°");
|
||||
if (sample->heartbeat != old->heartbeat) {
|
||||
show_index(b, sample->heartbeat, "heartbeat=", "");
|
||||
old->heartbeat = sample->heartbeat;
|
||||
}
|
||||
if (sample->bearing.degrees != old->bearing.degrees) {
|
||||
show_index(b, sample->bearing.degrees, "bearing=", "°");
|
||||
old->bearing.degrees = sample->bearing.degrees;
|
||||
}
|
||||
put_format(b, "\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue