Compare commits
2 commits
main
...
rob/magic_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14a61d2f84 | ||
|
|
0e97a15fab |
2 changed files with 7 additions and 5 deletions
|
|
@ -16,6 +16,7 @@ fn calculate_crc(frame: u16) -> u16 {
|
||||||
IFlight XING-E Pro 2207 2750KV
|
IFlight XING-E Pro 2207 2750KV
|
||||||
*/
|
*/
|
||||||
const XING_EPRO_22_POLES: u32 = 4;
|
const XING_EPRO_22_POLES: u32 = 4;
|
||||||
|
const XING_EPRO_22_MAGNETS: u32 = 14;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
|
@ -322,8 +323,9 @@ impl<'a> DShot<'a> {
|
||||||
let period_ms: u32 = (mantissa << exp).into();
|
let period_ms: u32 = (mantissa << exp).into();
|
||||||
let erpm = (60 * 1_000_000) / period_ms;
|
let erpm = (60 * 1_000_000) / period_ms;
|
||||||
|
|
||||||
let rpm = erpm/XING_EPRO_22_POLES;
|
let rpm = erpm/(XING_EPRO_22_MAGNETS/2);
|
||||||
self.rpm.set(Some(rpm))
|
// let rpm = erpm/7;
|
||||||
|
self.rpm.set(Some((rpm as f32) as _))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,8 @@ fn main() -> ! {
|
||||||
//PID-Controller
|
//PID-Controller
|
||||||
let loop_time = Duration::from_micros(10);
|
let loop_time = Duration::from_micros(10);
|
||||||
let cfg = pid::PidConfigBuilder::default()
|
let cfg = pid::PidConfigBuilder::default()
|
||||||
.kp(3.0)
|
.kp(2.0)
|
||||||
.ki(1.0).output_limits(100.00, 2040.00)
|
.ki(0.1).output_limits(100.00, 2040.00)
|
||||||
.sample_time(loop_time)
|
.sample_time(loop_time)
|
||||||
.filter_tc(0.1)
|
.filter_tc(0.1)
|
||||||
.build()
|
.build()
|
||||||
|
|
@ -137,7 +137,7 @@ fn main() -> ! {
|
||||||
let set_point = DEFAULT_TARGET_RPM;
|
let set_point = DEFAULT_TARGET_RPM;
|
||||||
dshot_esc.arm();
|
dshot_esc.arm();
|
||||||
let mut rpm = 0;
|
let mut rpm = 0;
|
||||||
let mut control: f32 = 200.0;
|
let mut control: f32 = 600.0;
|
||||||
// let timestamp = Instant::now();
|
// let timestamp = Instant::now();
|
||||||
loop {
|
loop {
|
||||||
dshot_esc.process();
|
dshot_esc.process();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue