We finally have the first iteration of a counter
This commit is contained in:
parent
808b44b1f4
commit
94f28e0034
1 changed files with 16 additions and 6 deletions
|
|
@ -43,12 +43,16 @@ use crate::dc_driver::dshot;
|
|||
use crate::peripherals::ErrCommand;
|
||||
use esp_hal::rmt::RxChannelConfig;
|
||||
use esp_hal::rmt::RxChannelCreator;
|
||||
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use esp_hal::timer::OneShotTimer;
|
||||
use esp_hal::timer::Timer;
|
||||
#[panic_handler]
|
||||
fn panic(panic: &core::panic::PanicInfo) -> ! {
|
||||
rprintln!("{}",panic.message());
|
||||
let trace = Backtrace::capture();
|
||||
loop {
|
||||
// rprintln!("{}",panic.location().unwrap())
|
||||
rprintln!("{}",panic.location().unwrap())
|
||||
}
|
||||
}
|
||||
use alloc::format;
|
||||
|
|
@ -138,8 +142,13 @@ fn main() -> ! {
|
|||
dshot_esc.arm();
|
||||
let mut rpm = 0;
|
||||
let mut control: f32 = 200.0;
|
||||
// let timestamp = Instant::now();
|
||||
loop {
|
||||
let mut timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||
let timer0 = timg0.timer0;
|
||||
// let now =timer.now();
|
||||
//we need the explicit type here!
|
||||
timer0.load_value(esp_hal::time::Duration::from_secs(10));
|
||||
timer0.start();
|
||||
while !timer0.is_interrupt_set() {
|
||||
dshot_esc.process();
|
||||
//let control_val = dc_driver::
|
||||
//this bad boy needs floats, this will be fun :)
|
||||
|
|
@ -150,7 +159,7 @@ fn main() -> ! {
|
|||
x
|
||||
}
|
||||
None => {
|
||||
rprintln!("NO RPM!");
|
||||
// rprintln!("NO RPM!");
|
||||
rpm
|
||||
}
|
||||
};
|
||||
|
|
@ -160,9 +169,10 @@ fn main() -> ! {
|
|||
let timestamp = esp_hal::time::Instant::now().duration_since_epoch().as_millis();
|
||||
(control, ctx) = controller.compute(ctx, rpm as _, set_point as _, Millis(timestamp), None);
|
||||
let dumped_context = ctx.last_time().expect("LAST TIME!");
|
||||
rprintln!("control:{},rpm:{}", control,rpm);
|
||||
// rprintln!("control:{},rpm:{}", control,rpm);
|
||||
}
|
||||
|
||||
rprintln!("Coating done!");
|
||||
dshot_esc.set_throttle(0);
|
||||
// rprintln!("RMT SENT!");
|
||||
// let mut esc = AfroEsc::new(&mut pwm_pin);;
|
||||
// esc.set_timestamp(1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue