Skip to content

Commit 66b6fff

Browse files
authored
Cleanup comments. (#6)
1 parent 7282444 commit 66b6fff

File tree

9 files changed

+10
-59
lines changed

9 files changed

+10
-59
lines changed

justfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ lint:
1313

1414
ex:
1515
cargo run --example=local_std
16+
17+
pedantic:
18+
cargo clippy -- -W clippy::pedantic
19+
20+
audit:
21+
cargo audit

src/packets/baro_altitude.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
//!
2-
//! uint16_t altitude_packed; // Altitude above start (calibration) point
3-
//! // See description below.
4-
//! int8_t vertical_speed_packed; // vertical speed. See description below.
5-
61
use crate::packets::CrsfPacket;
72
use crate::packets::PacketType;
83
use crate::CrsfParsingError;

src/packets/battery.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ use crate::packets::CrsfPacket;
22
use crate::packets::PacketType;
33
use crate::CrsfParsingError;
44

5-
// int16_t voltage; // Voltage (LSB = 10 µV)
6-
// int16_t current; // Current (LSB = 10 µA)
7-
// uint24_t capacity_used; // Capacity used (mAh)
8-
// uint8_t remaining; // Battery remaining (percent)
9-
105
#[derive(Clone, Debug, PartialEq)]
116
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
127
pub struct Battery {

src/packets/esp_now.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// uint8_t VAL1; // Used for Seat Position of the Pilot
2-
// uint8_t VAL2; // Used for the Current Pilots Lap
3-
// char VAL3[15]; // 15 characters for the lap time current/split
4-
// char VAL4[15]; // 15 characters for the lap time current/split
5-
// char FREE_TEXT[20]; // Free text of 20 character at the bottom of the screen
6-
//
71
use crate::packets::CrsfPacket;
82
use crate::packets::PacketType;
93
use crate::CrsfParsingError;

src/packets/gps_extended.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
// uint8_t fix_type; // Current GPS fix quality
2-
// int16_t n_speed; // Northward (north = positive) Speed [cm/sec]
3-
// int16_t e_speed; // Eastward (east = positive) Speed [cm/sec]
4-
// int16_t v_speed; // Vertical (up = positive) Speed [cm/sec]
5-
// int16_t h_speed_acc; // Horizontal Speed accuracy cm/sec
6-
// int16_t track_acc; // Heading accuracy in degrees scaled with 1e-1 degrees times 10)
7-
// int16_t alt_ellipsoid; // Meters Height above GPS Ellipsoid (not MSL)
8-
// int16_t h_acc; // horizontal accuracy in cm
9-
// int16_t v_acc; // vertical accuracy in cm
10-
// uint8_t reserved;
11-
// uint8_t hDOP; // Horizontal dilution of precision,Dimensionless in nits of.1.
12-
// uint8_t vDOP; // vertical dilution of precision, Dimensionless in nits of .1.
131
use crate::packets::CrsfPacket;
142
use crate::packets::PacketType;
153
use crate::CrsfParsingError;

src/packets/gps_time.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
//! GpsTime Packet
2-
//!
3-
//! int16_t year;
4-
//! uint8_t month;
5-
//! uint8_t day;
6-
//! uint8_t hour;
7-
//! uint8_t minute;
8-
//! uint8_t second;
9-
//! uint16_t millisecond;
10-
//!
111
use crate::packets::CrsfPacket;
122
use crate::packets::PacketType;
133
use crate::CrsfParsingError;

src/packets/link_statistics_rx.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
//! uint8_t rssi_db; // RSSI (dBm * -1)
2-
//! uint8_t rssi_percent; // RSSI in percent
3-
//! uint8_t link_quality; // Package success rate / Link quality (%)
4-
//! int8_t snr; // SNR (dB)
5-
//! uint8_t rf_power_db; // rf power in dBm
61
use crate::packets::CrsfPacket;
72
use crate::packets::PacketType;
83
use crate::CrsfParsingError;

src/packets/vtx_telemetry.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
//!
2-
//! uint8_t up_rssi_ant1; // Uplink RSSI Antenna 1 (dBm * -1)
3-
//! uint8_t up_rssi_ant2; // Uplink RSSI Antenna 2 (dBm * -1)
4-
//! uint8_t up_link_quality; // Uplink Package success rate / Link quality (%)
5-
//! int8_t up_snr; // Uplink SNR (dB)
6-
//! uint8_t active_antenna; // number of currently best antenna
7-
//! uint8_t rf_profile; // enum {4fps = 0 , 50fps, 150fps}
8-
//! uint8_t up_rf_power; // enum {0mW = 0, 10mW, 25mW, 100mW,
9-
//! // 500mW, 1000mW, 2000mW, 250mW, 50mW}
10-
//! uint8_t down_rssi; // Downlink RSSI (dBm * -1)
11-
//! uint8_t down_link_quality; // Downlink Package success rate / Link quality (%)
12-
//! int8_t down_snr; // Downlink SNR (dB)
131
use crate::packets::CrsfPacket;
142
use crate::packets::PacketType;
153
use crate::CrsfParsingError;
@@ -49,9 +37,7 @@ impl CrsfPacket for VtxTelemetry {
4937
}
5038

5139
fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError> {
52-
if data.len() != Self::MIN_PAYLOAD_SIZE {
53-
Err(CrsfParsingError::InvalidPayloadLength)
54-
} else {
40+
if data.len() == Self::MIN_PAYLOAD_SIZE {
5541
Ok(Self {
5642
up_rssi_ant1: data[0],
5743
up_rssi_ant2: data[1],
@@ -64,6 +50,8 @@ impl CrsfPacket for VtxTelemetry {
6450
down_link_quality: data[8],
6551
down_snr: data[9] as i8,
6652
})
53+
} else {
54+
Err(CrsfParsingError::InvalidPayloadLength)
6755
}
6856
}
6957
}

src/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl CrsfParser {
126126

127127
pub fn reset(&mut self) {
128128
self.position = 0;
129-
self.state = State::AwaitingSync
129+
self.state = State::AwaitingSync;
130130
}
131131
}
132132

0 commit comments

Comments
 (0)