Drive more smoothly
This commit is contained in:
parent
3eb9321b27
commit
bf82cfe6dc
12
src/main.rs
12
src/main.rs
|
@ -70,11 +70,9 @@ mod app {
|
|||
nb::block!(can.enable_non_blocking()).unwrap();
|
||||
|
||||
let (can_tx, can_rx, _) = can.split();
|
||||
|
||||
let can_tx_queue = BinaryHeap::new();
|
||||
|
||||
let delay = ctx.device.TIM2.delay_us(&clocks);
|
||||
|
||||
let mut gpioc = ctx.device.GPIOC.split();
|
||||
let led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
||||
|
||||
|
@ -109,21 +107,21 @@ mod app {
|
|||
|
||||
loop {
|
||||
for sign in [1, -1] {
|
||||
for speed in (0..=30)
|
||||
.chain((0..10).map(|_| 30))
|
||||
.chain((0..=30).map(|i| 30 - i))
|
||||
for speed in (0..=120)
|
||||
.chain((0..40).map(|_| 120))
|
||||
.chain((0..=120).map(|i| 120 - i))
|
||||
{
|
||||
tx_queue.lock(|mut tx_queue| {
|
||||
enqueue_frame(
|
||||
&mut tx_queue,
|
||||
Frame::new_data(
|
||||
StandardId::new(0x1FF).unwrap(),
|
||||
speed2array(speed * 1000 * sign),
|
||||
speed2array(speed * 250 * sign),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
cx.local.delay.delay(100.millis());
|
||||
cx.local.delay.delay(25.millis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user