Mild cleanups

This commit is contained in:
Serge Bazanski 2026-02-28 23:12:05 +01:00
parent 9bce7f0416
commit 808b44b1f4

View file

@ -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))
} }
} }