commit 68d65ebf2faa018388e10fa7d63eb307bbc436c2
parent 63022bcfd22f19f49b04cfc1bd7e0d922f887551
Author: Daniel Barlow <dan@telent.net>
Date: Sun, 7 Dec 2025 17:38:13 +0000
ecu response; check it's long enough to be a table
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ecu.rs b/src/ecu.rs
@@ -138,7 +138,11 @@ impl Ecu<'_> {
pub async fn fetch_table<'a>(&mut self, n: u8, buf: &'a mut [u8]) -> &'a [u8] {
let r = self.run_command(&mut [0x72, 0x07, 0x72, n, 0, 0x14, 0x0], buf).await;
- &r[5..]
+ if r.len() > 5 {
+ &r[5..]
+ } else {
+ &[]
+ }
}
pub async fn poll(&mut self, callback: impl AsyncFn(Measure)) {