Restore S300 frame parsing for prefix frames
This commit is contained in:
parent
5df3442523
commit
80167fd9e5
@ -6,11 +6,9 @@ import 'neg8.dart';
|
|||||||
bool isS300PlaceholderFrame(Uint8List frame) {
|
bool isS300PlaceholderFrame(Uint8List frame) {
|
||||||
if (frame.length != 128) return false;
|
if (frame.length != 128) return false;
|
||||||
|
|
||||||
// The S300 Bluetooth stream can interleave a valid-checksum placeholder
|
// Diagnostic signature observed in the S300 Bluetooth stream. Do not use
|
||||||
// frame that is not the SManager live sensor frame. It has a fixed header
|
// this to drop frames globally; current captures show real changing data can
|
||||||
// and zero/overflow values for speed, TPS, injection and ignition, then it
|
// still be carried in frames with this prefix.
|
||||||
// overwrites the dashboard with stale/empty values. Keep this check near the
|
|
||||||
// parser so Bluetooth diagnostics can still receive and count raw frames.
|
|
||||||
return frame[0] == 0x1B &&
|
return frame[0] == 0x1B &&
|
||||||
frame[1] == 0x00 &&
|
frame[1] == 0x00 &&
|
||||||
frame[2] == 0x14 &&
|
frame[2] == 0x14 &&
|
||||||
|
|||||||
@ -15,9 +15,6 @@ final sensorStateProvider = StreamProvider<SensorState>((ref) async* {
|
|||||||
|
|
||||||
await for (final frame in btNotifier.frameStream) {
|
await for (final frame in btNotifier.frameStream) {
|
||||||
if (ecuType == EcuType.s300) {
|
if (ecuType == EcuType.s300) {
|
||||||
if (isS300PlaceholderFrame(frame)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
yield parseS300(frame, validateChecksum: false);
|
yield parseS300(frame, validateChecksum: false);
|
||||||
} else {
|
} else {
|
||||||
yield parseKPro(frame);
|
yield parseKPro(frame);
|
||||||
|
|||||||
@ -161,7 +161,7 @@ void main() {
|
|||||||
expect(state.rpm, equals(1000.0));
|
expect(state.rpm, equals(1000.0));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('detects known S300 placeholder frame', () {
|
test('detects known S300 prefix signature', () {
|
||||||
final frame = Uint8List(128);
|
final frame = Uint8List(128);
|
||||||
final signature = [
|
final signature = [
|
||||||
0x1B,
|
0x1B,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user