Repo for designs & driver for a TA7642 powered lightning detector

Add voltage average to detection update

+7 -3
+7 -3
embassy-strike-driver/src/lib.rs
··· 93 93 }, 94 94 Detection { 95 95 timestamp: i64, 96 + average: u16, 96 97 samples: &'a [u16], 97 98 peaks: &'a [(usize, u16)], 98 99 }, ··· 216 217 217 218 update(DetectorUpdate::Detection { 218 219 timestamp, 220 + average: self.state.avg.get(), 219 221 samples, 220 222 peaks: peaks.as_slice(), 221 223 }); ··· 445 447 446 448 tune_detector_manually(&mut detector, &mut buf, driver).await; 447 449 448 - assert_eq!(detector.state.max_duty.get(), 98); 449 - assert_eq!(detector.state.duty.get(), 80); 450 - assert_eq!(detector.adc.sample_average(&mut buf).await, 1120); 450 + assert_eq!(detector.state.max_duty.get(), 108); 451 + assert_eq!(detector.state.duty.get(), 90); 452 + assert_eq!(detector.adc.sample_average(&mut buf).await, 1260); 451 453 } 452 454 453 455 #[pollster::test] ··· 533 535 update, 534 536 DetectorUpdate::Detection { 535 537 timestamp: 0, 538 + average: detector.state.avg.get(), 536 539 samples: &samples, 537 540 peaks: expected_peaks.as_slice() 538 541 } ··· 558 561 update, 559 562 DetectorUpdate::Detection { 560 563 timestamp: 0, 564 + average: detector.state.avg.get(), 561 565 samples: &samples, 562 566 peaks: expected_peaks.as_slice() 563 567 }