Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Robert Schauklies
14a61d2f84 magic fafo constant found 2026-03-14 18:23:11 +01:00
Robert Schauklies
0e97a15fab just testing with the magic value 2026-03-14 18:07:23 +01:00
2 changed files with 7 additions and 5 deletions

View file

@ -16,6 +16,7 @@ fn calculate_crc(frame: u16) -> u16 {
IFlight XING-E Pro 2207 2750KV
*/
const XING_EPRO_22_POLES: u32 = 4;
const XING_EPRO_22_MAGNETS: u32 = 14;
#[allow(dead_code)]
#[allow(non_camel_case_types)]
@ -322,8 +323,9 @@ impl<'a> DShot<'a> {
let period_ms: u32 = (mantissa << exp).into();
let erpm = (60 * 1_000_000) / period_ms;
let rpm = erpm/XING_EPRO_22_POLES;
self.rpm.set(Some(rpm))
let rpm = erpm/(XING_EPRO_22_MAGNETS/2);
// let rpm = erpm/7;
self.rpm.set(Some((rpm as f32) as _))
}
}
}

View file

@ -126,8 +126,8 @@ fn main() -> ! {
//PID-Controller
let loop_time = Duration::from_micros(10);
let cfg = pid::PidConfigBuilder::default()
.kp(3.0)
.ki(1.0).output_limits(100.00, 2040.00)
.kp(2.0)
.ki(0.1).output_limits(100.00, 2040.00)
.sample_time(loop_time)
.filter_tc(0.1)
.build()
@ -137,7 +137,7 @@ fn main() -> ! {
let set_point = DEFAULT_TARGET_RPM;
dshot_esc.arm();
let mut rpm = 0;
let mut control: f32 = 200.0;
let mut control: f32 = 600.0;
// let timestamp = Instant::now();
loop {
dshot_esc.process();