From ee71bb69d3c9fb0745969cce9aac9b89306f3e12 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sun, 29 Mar 2026 21:21:38 -0600 Subject: [PATCH] fix: add explicit SF=7 and CR=5 match arms in radio converters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to_sf() relied on the catch-all _ => _7 to handle SF=7, and to_cr() relied on _ => _4_5 for CR=5. Both work by accident but are misleading — a reader would think SF=7 and CR=5 are unhandled. Make them explicit. --- src/radio/task.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/radio/task.rs b/src/radio/task.rs index 3d9bb999..86cf7727 100644 --- a/src/radio/task.rs +++ b/src/radio/task.rs @@ -289,22 +289,24 @@ fn to_sf(sf: u8) -> lora_phy::mod_params::SpreadingFactor { match sf { 5 => _5, 6 => _6, + 7 => _7, 8 => _8, 9 => _9, 10 => _10, 11 => _11, 12 => _12, - _ => _7, // validated earlier, but safe default + _ => _7, // validated to 5-12 earlier; unreachable but safe } } fn to_cr(cr: u8) -> lora_phy::mod_params::CodingRate { use lora_phy::mod_params::CodingRate::*; match cr { + 5 => _4_5, 6 => _4_6, 7 => _4_7, 8 => _4_8, - _ => _4_5, // validated earlier, but safe default + _ => _4_5, // validated to 5-8 earlier; unreachable but safe } }