Mild cleanups
This commit is contained in:
parent
9bce7f0416
commit
808b44b1f4
1 changed files with 2 additions and 2 deletions
|
|
@ -311,7 +311,7 @@ impl<'a> DShot<'a> {
|
||||||
// Decode to a 16 bit value.
|
// Decode to a 16 bit value.
|
||||||
if let Some(frame) = decode_bidi_telemetry(&buf[..len]) {
|
if let Some(frame) = decode_bidi_telemetry(&buf[..len]) {
|
||||||
// Check CRC.
|
// Check CRC.
|
||||||
let mut data = frame >> 4;
|
let data = frame >> 4;
|
||||||
let crc = calculate_crc(data);
|
let crc = calculate_crc(data);
|
||||||
if data != 0xfff && crc == (frame&0b1111) {
|
if data != 0xfff && crc == (frame&0b1111) {
|
||||||
// Fucking got it.
|
// Fucking got it.
|
||||||
|
|
@ -322,7 +322,7 @@ 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_POLES;
|
||||||
self.rpm.set(Some(rpm))
|
self.rpm.set(Some(rpm))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue