Fix Wrong Priorization (higher prio -> higher number)
This commit is contained in:
+8
-9
@@ -170,7 +170,7 @@ mod app {
|
|||||||
|
|
||||||
info!("----------Setup TIM----------");
|
info!("----------Setup TIM----------");
|
||||||
|
|
||||||
let freq = 10.kHz();
|
let freq = 1.kHz();
|
||||||
info!("TIM3:");
|
info!("TIM3:");
|
||||||
info!("\tfreq: {} kHz", freq.to_kHz());
|
info!("\tfreq: {} kHz", freq.to_kHz());
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ mod app {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(binds = USART1, local = [parser], shared = [serial, target], priority = 2)]
|
#[task(binds = USART1, local = [parser], shared = [serial, target], priority = 1)]
|
||||||
fn uart_target(mut ctx: uart_target::Context) {
|
fn uart_target(mut ctx: uart_target::Context) {
|
||||||
let parser = ctx.local.parser;
|
let parser = ctx.local.parser;
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ mod app {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(binds = TIM3, local = [timer3, adc1, adc_i, adc_q, adc_te21, avgbuffer_i, avgbuffer_q, avgbuffer_te21], shared = [target, serial])]
|
#[task(binds = TIM3, local = [timer3, adc1, adc_i, adc_q, adc_te21, avgbuffer_i, avgbuffer_q, avgbuffer_te21], shared = [target, serial], priority = 2)]
|
||||||
fn adc_print(mut ctx: adc_print::Context) {
|
fn adc_print(mut ctx: adc_print::Context) {
|
||||||
// Clear interrupt flag
|
// Clear interrupt flag
|
||||||
ctx.local.timer3.clear_irq();
|
ctx.local.timer3.clear_irq();
|
||||||
@@ -309,17 +309,16 @@ mod app {
|
|||||||
ctx.shared.serial.lock(|serial| {
|
ctx.shared.serial.lock(|serial| {
|
||||||
let _ = writeln!(
|
let _ = writeln!(
|
||||||
serial,
|
serial,
|
||||||
"I: {},\tQ: {},\tTE11: {},\tTE21: {}\r",
|
"I: {:.3},\tQ: {:.3},\tTE11: {:.3},\tTE21: {:.3}\r",
|
||||||
ctx.local.avgbuffer_i.average() as f32 * VDDA / u16::MAX as f32,
|
ctx.local.avgbuffer_i.average() as f32 * VDDA / u16::MAX as f32,
|
||||||
ctx.local.avgbuffer_q.average() as f32 * VDDA / u16::MAX as f32,
|
ctx.local.avgbuffer_q.average() as f32 * VDDA / u16::MAX as f32,
|
||||||
TE11_AVG.load(Ordering::SeqCst) as f32 * VDDA / u16::MAX as f32,
|
TE11_AVG.load(Ordering::Relaxed) as f32 * VDDA / u16::MAX as f32,
|
||||||
ctx.local.avgbuffer_te21.average() as f32 * VDDA / u16::MAX as f32,
|
ctx.local.avgbuffer_te21.average() as f32 * VDDA / u16::MAX as f32,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[task(binds = TIM2, local = [timer2, p, i, d, input, adc2, dac, freq], shared = [target, serial], priority = 1)]
|
#[task(binds = TIM2, local = [timer2, p, i, d, input, adc2, dac, freq, avgbuffer_te11], shared = [target, config], priority = 3)]
|
||||||
#[task(binds = TIM2, local = [timer2, p, i, d, input, adc2, dac, freq, avgbuffer_te11], shared = [target, config], priority = 1)]
|
|
||||||
fn pid(mut ctx: pid::Context) {
|
fn pid(mut ctx: pid::Context) {
|
||||||
// Clear interrupt flag
|
// Clear interrupt flag
|
||||||
ctx.local.timer2.clear_irq();
|
ctx.local.timer2.clear_irq();
|
||||||
@@ -330,9 +329,9 @@ mod app {
|
|||||||
|
|
||||||
let input: u32 = ctx.local.adc2.read(ctx.local.input).unwrap();
|
let input: u32 = ctx.local.adc2.read(ctx.local.input).unwrap();
|
||||||
avgbuffer.push(input);
|
avgbuffer.push(input);
|
||||||
// let input: f32 = input as f32;
|
|
||||||
let input: u32 = avgbuffer.average();
|
let input: u32 = avgbuffer.average();
|
||||||
TE11_AVG.store(input, Ordering::SeqCst);
|
TE11_AVG.store(input, Ordering::Relaxed);
|
||||||
|
|
||||||
let input: f32 = (input >> 4) as f32;
|
let input: f32 = (input >> 4) as f32;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,14 +3,14 @@ use core::str::{self, FromStr};
|
|||||||
|
|
||||||
pub struct Parser {
|
pub struct Parser {
|
||||||
pub curr: u32,
|
pub curr: u32,
|
||||||
pub buffer: [u8; 100],
|
pub buffer: [u8; 1000],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parser {
|
impl Parser {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
curr: 0,
|
curr: 0,
|
||||||
buffer: [0_u8; 100],
|
buffer: [0_u8; 1000],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user