Changeset dd2791f in subsurface


Ignore:
Timestamp:
Jan 21, 2017, 6:07:31 AM (2 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
3fd26a8
Parents:
f7cecf5
git-author:
Joakim Bygdell <j.bygdell@…> (01/16/17 12:52:39)
git-committer:
Dirk Hohndel <dirk@…> (01/21/17 06:07:31)
Message:

Fix tankbar offset at gas switch event

When painting the tankbar the function triggers on change in cylinder index,
as a result the new gascolour are changed at the next sample time point.
On a divecomputer with a reasonable fast sample rate the 2-3s offset are hardly
noticable, especially on a longer dive.
For divecomputers with slow sample rate the 10-30s offset are clearly visible.

This is fixed by start painting the new gascolour at the time point of the switch event rather than the time point of the next sample.

Signed-off-by: Joakim Bygdell <j.bygdell@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • profile-widget/tankitem.cpp

    r7be962b rdd2791f  
    9494        // walk the list and figure out which tanks go where
    9595        struct plot_data *entry = pInfoEntry;
     96        struct plot_data *lastentry = pInfoEntry;
    9697        int cylIdx = entry->cylinderindex;
    9798        int i = -1;
     
    101102        while (++i < pInfoNr) {
    102103                entry = &pInfoEntry[i];
     104                lastentry = &pInfoEntry[i-1];
    103105                if (entry->cylinderindex == cylIdx)
    104106                        continue;
    105                 width = hAxis->posAtValue(entry->sec) - hAxis->posAtValue(startTime);
     107                width = hAxis->posAtValue(lastentry->sec) - hAxis->posAtValue(startTime);
    106108                left = hAxis->posAtValue(startTime);
    107109                createBar(left, width, gas);
    108110                cylIdx = entry->cylinderindex;
    109111                gas = &diveCylinderStore.cylinder[cylIdx].gasmix;
    110                 startTime = entry->sec;
     112                startTime = lastentry->sec;
    111113        }
    112114        width = hAxis->posAtValue(entry->sec) - hAxis->posAtValue(startTime);
Note: See TracChangeset for help on using the changeset viewer.