tangled
alpha
login
or
join now
sachy.dev
/
strike-sensor
0
fork
atom
Repo for designs & driver for a TA7642 powered lightning detector
0
fork
atom
overview
issues
pulls
pipelines
Add voltage average to detection update
sachy.dev
1 month ago
589b83a1
8113ef61
1/1
test.yml
success
16s
+7
-3
1 changed file
expand all
collapse all
unified
split
embassy-strike-driver
src
lib.rs
+7
-3
embassy-strike-driver/src/lib.rs
···
93
93
},
94
94
Detection {
95
95
timestamp: i64,
96
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
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
448
-
assert_eq!(detector.state.max_duty.get(), 98);
449
449
-
assert_eq!(detector.state.duty.get(), 80);
450
450
-
assert_eq!(detector.adc.sample_average(&mut buf).await, 1120);
450
450
+
assert_eq!(detector.state.max_duty.get(), 108);
451
451
+
assert_eq!(detector.state.duty.get(), 90);
452
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
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
564
+
average: detector.state.avg.get(),
561
565
samples: &samples,
562
566
peaks: expected_peaks.as_slice()
563
567
}