safety commit

This commit is contained in:
Robert Schauklies 2026-01-11 00:14:58 +01:00
parent 36ab15255f
commit 443da0edcf
3 changed files with 14 additions and 7 deletions

View file

@ -26,19 +26,19 @@ impl AfroEsc<'_>{
esc
}
pub fn set_timestamp(&mut self,value:u16){
&self.pwm_pin.set_timestamp(value);
self.pwm_pin.set_timestamp(value);
}
//range is from 1121 till 1421
pub fn set_duty_percent(&mut self,value:u16){
if value > 100 {
// failsafe!
&self.pwm_pin.set_timestamp(1055);
self.pwm_pin.set_timestamp(1055);
}
let new_timestamp = MIN_THROTTLE+value*GAP;
&self.pwm_pin.set_timestamp(new_timestamp);
self.pwm_pin.set_timestamp(new_timestamp);
}
pub fn set_arming_sequence(&mut self){
&self.set_timestamp(1055);
self.set_timestamp(1055);
}
}

View file

@ -111,6 +111,7 @@ fn main() -> ! {
display.send_command(b"page page0");
let mut rpm = DEFAULT_TARGET_RPM;
let mut timer = DEFAULT_SPIN_TIME;
let mut started = false;
loop {
if display.read_ready() {
match display.read_command() {
@ -118,10 +119,13 @@ fn main() -> ! {
rprintln!("COMMAND SUCCESSFULLY executed");
}
Ok(Command::Start) => {
rprintln!("START")
rprintln!("START");
started = true;
},
Ok(Command::Stop) => {
rprintln!("STOP")
rprintln!("STOP");
started = false;
// spincoater.stop();
},
Ok(Command::SetRpm(x)) => {
rprintln!("SET_RPM with {}", x);
@ -145,6 +149,10 @@ fn main() -> ! {
}
// display.send_command(b"page page0");
}
if started {
// spincoater.armed();
rprintln!("STARTING!")
}
//display.send_command(b"page page0");
//uart0.write(b"page page0\xff\xff\xff");
}

View file

@ -1,5 +1,4 @@
use esp_hal::uart::RxError;
#[no_std]
use esp_hal::uart::{Uart};
use esp_hal::{Blocking };
use rtt_target::rprintln;