garmin: only record gasmixes for cylinders that aren't enabled

This actually takes the gas status information into account, and doesn't
show gas mixes that are disabled.

All the Garmin Descent data now looks reasonable, but we're not
generating any events (so no warnings, but also no gas change events
etc).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2018-08-31 12:25:43 -07:00
parent 6a6e60c9bb
commit 22a96bf395

View File

@ -150,8 +150,10 @@ static void flush_pending_record(struct garmin_parser_t *garmin)
record->pending = 0;
if (!garmin->callback) {
if (pending & RECORD_GASMIX) {
// 0 - disabled, 1 - enabled, 2 - backup
int enabled = record->gas_status > 0;
int index = record->index;
if (index < MAXGASES) {
if (enabled && index < MAXGASES) {
garmin->cache.gasmix[index] = record->gasmix;
garmin->cache.GASMIX_COUNT = index+1;
}