No warnings ! Starts csma-like behaviour

This commit is contained in:
2025-10-05 14:49:04 +02:00
parent acc8641cb3
commit 96689cc3a6
18 changed files with 769 additions and 968 deletions

9
src/math.rs Normal file
View File

@ -0,0 +1,9 @@
use std::ops::{Add, Mul, Sub, Div};
// Useful math used throughout
pub fn map<T>(input: T, in_min: T, in_max: T, out_min: T, out_max: T) -> T
where
T: Clone + Add<Output = T> + Mul<Output = T> + Sub<Output = T> + Div<Output = T>,
{
((input - in_min.clone()) / (in_max - in_min)) * (out_max - out_min.clone()) + out_min
}