using the way of the arduino map function

This commit is contained in:
Robert Schauklies 2026-01-14 23:31:36 +01:00
parent 443da0edcf
commit 1a5c58c31c
2 changed files with 40 additions and 12 deletions

View file

@ -1 +1,17 @@
pub mod afroesc;
pub mod afroesc;
pub enum EscState {
Starting,
Running,
Stopping,
Stop
}
//taken from: https://docs.arduino.cc/language-reference/en/functions/math/map/
//used for the ramp up of the spincoater
pub fn arduino_map(x:i32, in_min:i32, in_max:i32, out_min:i32, out_max:i32) -> i32 {
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}