@@ -591,14 +591,15 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
591
591
if (pressure < 0xFFF0 ) {
592
592
unsigned int battery = 1u << (pressure >> 12 );
593
593
pressure &= 0x0FFF ;
594
- if (!tank [id ].active ) {
595
- tank [id ].active = 1 ;
596
- tank [id ].beginpressure = pressure ;
594
+ if (pressure ) {
595
+ if (!tank [id ].active ) {
596
+ tank [id ].active = 1 ;
597
+ tank [id ].beginpressure = pressure ;
598
+ tank [id ].endpressure = pressure ;
599
+ }
597
600
tank [id ].endpressure = pressure ;
598
601
tank [id ].battery = 0 ;
599
602
}
600
- tank [id ].endpressure = pressure ;
601
- tank [id ].battery |= battery ;
602
603
}
603
604
}
604
605
}
@@ -610,12 +611,14 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
610
611
unsigned int id = 2 + i ;
611
612
if (pressure < 0xFFF0 ) {
612
613
pressure &= 0x0FFF ;
613
- if (!tank [id ].active ) {
614
- tank [id ].active = 1 ;
615
- tank [id ].beginpressure = pressure ;
614
+ if (pressure ) {
615
+ if (!tank [id ].active ) {
616
+ tank [id ].active = 1 ;
617
+ tank [id ].beginpressure = pressure ;
618
+ tank [id ].endpressure = pressure ;
619
+ }
616
620
tank [id ].endpressure = pressure ;
617
621
}
618
- tank [id ].endpressure = pressure ;
619
622
}
620
623
}
621
624
}
@@ -1233,9 +1236,11 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
1233
1236
unsigned int id = (parser -> aimode == AI_HPCCR ? 4 : 0 ) + i ;
1234
1237
if (pressure < 0xFFF0 ) {
1235
1238
pressure &= 0x0FFF ;
1236
- sample .pressure .tank = parser -> tankidx [id ];
1237
- sample .pressure .value = pressure * 2 * PSI / BAR ;
1238
- if (callback ) callback (DC_SAMPLE_PRESSURE , & sample , userdata );
1239
+ if (pressure ) {
1240
+ sample .pressure .tank = parser -> tankidx [id ];
1241
+ sample .pressure .value = pressure * 2 * PSI / BAR ;
1242
+ if (callback ) callback (DC_SAMPLE_PRESSURE , & sample , userdata );
1243
+ }
1239
1244
}
1240
1245
}
1241
1246
@@ -1259,9 +1264,11 @@ shearwater_predator_parser_samples_foreach (dc_parser_t *abstract, dc_sample_cal
1259
1264
unsigned int id = 2 + i ;
1260
1265
if (pressure < 0xFFF0 ) {
1261
1266
pressure &= 0x0FFF ;
1262
- sample .pressure .tank = parser -> tankidx [id ];
1263
- sample .pressure .value = pressure * 2 * PSI / BAR ;
1264
- if (callback ) callback (DC_SAMPLE_PRESSURE , & sample , userdata );
1267
+ if (pressure ) {
1268
+ sample .pressure .tank = parser -> tankidx [id ];
1269
+ sample .pressure .value = pressure * 2 * PSI / BAR ;
1270
+ if (callback ) callback (DC_SAMPLE_PRESSURE , & sample , userdata );
1271
+ }
1265
1272
}
1266
1273
}
1267
1274
}
0 commit comments