@@ -608,6 +608,9 @@ impl Default for FskModParams {
608
608
/// LoRa spreading factor.
609
609
///
610
610
/// Argument of [`LoRaModParams::set_sf`].
611
+ ///
612
+ /// Higher spreading factors improve receiver sensitivity, but reduce bit rate
613
+ /// and increase power consumption.
611
614
#[ derive( Debug , PartialEq , Eq , Clone , Copy , PartialOrd , Ord ) ]
612
615
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
613
616
#[ repr( u8 ) ]
@@ -715,19 +718,34 @@ impl PartialOrd for LoRaBandwidth {
715
718
/// LoRa forward error correction coding rate.
716
719
///
717
720
/// Argument of [`LoRaModParams::set_cr`].
721
+ ///
722
+ /// A higher coding rate provides better immunity to interference at the expense
723
+ /// of longer transmission time.
724
+ /// In normal conditions [`CodingRate::Cr45`] provides the best trade off.
725
+ /// In case of strong interference, a higher coding rate may be used.
718
726
#[ derive( Debug , PartialEq , Eq , Clone , Copy , PartialOrd , Ord ) ]
719
727
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
720
728
#[ repr( u8 ) ]
721
729
pub enum CodingRate {
722
730
/// No forward error correction coding rate 4/4
731
+ ///
732
+ /// Overhead ratio of 1
723
733
Cr44 = 0x00 ,
724
734
/// Forward error correction coding rate 4/5
735
+ ///
736
+ /// Overhead ratio of 1.25
725
737
Cr45 = 0x1 ,
726
738
/// Forward error correction coding rate 4/6
739
+ ///
740
+ /// Overhead ratio of 1.5
727
741
Cr46 = 0x2 ,
728
742
/// Forward error correction coding rate 4/7
743
+ ///
744
+ /// Overhead ratio of 1.75
729
745
Cr47 = 0x3 ,
730
746
/// Forward error correction coding rate 4/8
747
+ ///
748
+ /// Overhead ratio of 2
731
749
Cr48 = 0x4 ,
732
750
}
733
751
@@ -798,6 +816,8 @@ impl LoRaModParams {
798
816
799
817
/// Set the forward error correction coding rate.
800
818
///
819
+ /// See [`CodingRate`] for more information.
820
+ ///
801
821
/// # Example
802
822
///
803
823
/// ```
@@ -814,6 +834,25 @@ impl LoRaModParams {
814
834
815
835
/// Set low data rate optimization enable.
816
836
///
837
+ /// For low data rates (typically high SF or low BW) and very long payloads
838
+ /// (may last several seconds), the low data rate optimization (LDRO) can be
839
+ /// enabled.
840
+ /// This reduces the number of bits per symbol to the given SF minus 2,
841
+ /// to allow the receiver to have a better tracking of the LoRa receive
842
+ /// signal.
843
+ /// Depending on the payload length, the low data rate optimization is
844
+ /// usually recommended when the LoRa symbol time is equal or above
845
+ /// 16.38 ms.
846
+ /// When using LoRa modulation, the total frequency drift over the packet
847
+ /// time must be kept lower than Freq_drift_max:
848
+ ///
849
+ /// Freq_drift_max = BW / (3 × 2SF)
850
+ ///
851
+ /// When possible, enabling the low data rate optimization, relaxes the
852
+ /// total frequency drift over the packet time by 16:
853
+ ///
854
+ /// Freq_drift_optimise_max = 16 × Freq_drift_max
855
+ ///
817
856
/// # Example
818
857
///
819
858
/// ```
0 commit comments