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