adds the necessary plumbing for #9
This commit is contained in:
parent
8048d48f18
commit
1b748dfef0
3 changed files with 13 additions and 4 deletions
|
|
@ -240,6 +240,7 @@ fn main() -> ! {
|
||||||
let set_point = target_rpm;
|
let set_point = target_rpm;
|
||||||
coat_timer.start();
|
coat_timer.start();
|
||||||
let mut current_rpm = 0;
|
let mut current_rpm = 0;
|
||||||
|
//first round!
|
||||||
while !coat_timer.is_interrupt_set() {
|
while !coat_timer.is_interrupt_set() {
|
||||||
dshot_esc.process();
|
dshot_esc.process();
|
||||||
//let control_val = dc_driver::
|
//let control_val = dc_driver::
|
||||||
|
|
@ -274,19 +275,25 @@ fn main() -> ! {
|
||||||
rprintln!("control:{},rpm:{}", control, current_rpm);
|
rprintln!("control:{},rpm:{}", control, current_rpm);
|
||||||
//first we send the RPM!
|
//first we send the RPM!
|
||||||
if display.write_ready() {
|
if display.write_ready() {
|
||||||
let running_rpm = format!("rpm.val={}", current_rpm);
|
let running_rpm = format!("rpm1.val={}", current_rpm);
|
||||||
display.send_command(running_rpm.to_string().as_bytes());
|
display.send_command(running_rpm.to_string().as_bytes());
|
||||||
}
|
|
||||||
if display.write_ready() {
|
|
||||||
let counter = format!("counter.val={}", 1234);
|
let counter = format!("counter.val={}", 1234);
|
||||||
display.send_command(counter.to_string().as_bytes());
|
display.send_command(counter.to_string().as_bytes());
|
||||||
}
|
}
|
||||||
|
if display.read_ready(){
|
||||||
|
match display.read_command() {
|
||||||
|
Ok(Command::DoDryRun) =>{
|
||||||
|
break;
|
||||||
|
},
|
||||||
|
_ => {//we don't care about the rest}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rprintln!("COATING done!");
|
rprintln!("COATING done!");
|
||||||
rprintln!("RPM_READ_FAILS {}", rpm_fail_ctr);
|
rprintln!("RPM_READ_FAILS {}", rpm_fail_ctr);
|
||||||
started = false;
|
started = false;
|
||||||
display.send_command(b"page page0");
|
display.send_command(b"page page3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ pub enum Command {
|
||||||
CommandSuccess,
|
CommandSuccess,
|
||||||
SetRpm2(u32),
|
SetRpm2(u32),
|
||||||
SetTimer2(u32),
|
SetTimer2(u32),
|
||||||
|
DoDryRun,
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ErrCommand {
|
pub enum ErrCommand {
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ impl<'a> Nextion<'a> {
|
||||||
let time = u32::from_le_bytes(buf[1..5].try_into().expect("failed to parse rpm!"));
|
let time = u32::from_le_bytes(buf[1..5].try_into().expect("failed to parse rpm!"));
|
||||||
Ok(Command::SetTimer2(time))
|
Ok(Command::SetTimer2(time))
|
||||||
}
|
}
|
||||||
|
08 => Ok(Command::DoDryRun),
|
||||||
00 => Ok(Command::CommandSuccess),
|
00 => Ok(Command::CommandSuccess),
|
||||||
_ => Err(ErrCommand::NoValidCmd),
|
_ => Err(ErrCommand::NoValidCmd),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue