Merge pull request #54 from torlando-tech/feat/issue-43-sf5
Build and Deploy Firmware / build-and-deploy (push) Canceled after 0s
Test / Pyxis pytest suite (build_scripts + native) (push) Canceled after 0s
Test / microReticulum native unit tests (PlatformIO native17) (push) Canceled after 0s

feat: add SF5 LoRa support
This commit is contained in:
Torlando
2026-08-03 20:20:32 -04:00
committed by GitHub
4 changed files with 25 additions and 7 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ namespace SX1262Pins {
struct SX1262Config {
float frequency = 927.25f; // MHz
float bandwidth = 62.5f; // kHz (valid: 7.8, 10.4, 15.6, 20.8, 31.25, 41.7, 62.5, 125, 250, 500)
uint8_t spreading_factor = 7; // SF7-SF12
uint8_t spreading_factor = 7; // SF5-SF12
uint8_t coding_rate = 5; // 5=4/5, 6=4/6, 7=4/7, 8=4/8
int8_t tx_power = 17; // dBm (2-22)
uint8_t sync_word = 0x12; // Standard LoRa sync word
+5 -5
View File
@@ -612,7 +612,7 @@ void SettingsScreen::create_interfaces_section(lv_obj_t* parent) {
lv_obj_set_style_text_font(sf_label, &lv_font_montserrat_14, 0);
_dropdown_lora_sf = lv_dropdown_create(sfcr_row);
lv_dropdown_set_options(_dropdown_lora_sf, "7\n8\n9\n10\n11\n12");
lv_dropdown_set_options(_dropdown_lora_sf, "5\n6\n7\n8\n9\n10\n11\n12");
lv_obj_set_size(_dropdown_lora_sf, 50, 28);
lv_obj_align(_dropdown_lora_sf, LV_ALIGN_LEFT_MID, 30, 0);
lv_obj_set_style_bg_color(_dropdown_lora_sf, Theme::surfaceInput(), 0);
@@ -1227,8 +1227,8 @@ void SettingsScreen::update_ui_from_settings() {
lv_dropdown_set_selected(_dropdown_lora_bandwidth, idx);
}
if (_dropdown_lora_sf) {
// SF 7-12 maps to index 0-5
lv_dropdown_set_selected(_dropdown_lora_sf, _settings.lora_sf - 7);
// SF 5-12 maps to index 0-7
lv_dropdown_set_selected(_dropdown_lora_sf, _settings.lora_sf - 5);
}
if (_dropdown_lora_cr) {
// CR 5-8 maps to index 0-3
@@ -1348,8 +1348,8 @@ void SettingsScreen::update_settings_from_ui() {
}
}
if (_dropdown_lora_sf) {
// Index 0-5 maps to SF 7-12
_settings.lora_sf = lv_dropdown_get_selected(_dropdown_lora_sf) + 7;
// Index 0-7 maps to SF 5-12
_settings.lora_sf = lv_dropdown_get_selected(_dropdown_lora_sf) + 5;
}
if (_dropdown_lora_cr) {
// Index 0-3 maps to CR 5-8
+1 -1
View File
@@ -45,7 +45,7 @@ struct AppSettings {
bool lora_enabled;
float lora_frequency; // MHz
float lora_bandwidth; // kHz
uint8_t lora_sf; // Spreading factor (7-12)
uint8_t lora_sf; // Spreading factor (5-12)
uint8_t lora_cr; // Coding rate (5-8)
int8_t lora_power; // TX power dBm (2-22)
bool auto_enabled; // Enable AutoInterface (WiFi peer discovery)
@@ -0,0 +1,18 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
SETTINGS_CPP = (ROOT / "lib/tdeck_ui/UI/LXMF/SettingsScreen.cpp").read_text()
SETTINGS_H = (ROOT / "lib/tdeck_ui/UI/LXMF/SettingsScreen.h").read_text()
SX1262_H = (ROOT / "lib/sx1262_interface/SX1262Interface.h").read_text()
def test_lora_settings_expose_the_full_sx1262_sf5_through_sf12_range():
assert 'lv_dropdown_set_options(_dropdown_lora_sf, "5\\n6\\n7\\n8\\n9\\n10\\n11\\n12");' in SETTINGS_CPP
assert "lv_dropdown_set_selected(_dropdown_lora_sf, _settings.lora_sf - 5);" in SETTINGS_CPP
assert "_settings.lora_sf = lv_dropdown_get_selected(_dropdown_lora_sf) + 5;" in SETTINGS_CPP
def test_lora_spreading_factor_documentation_matches_the_supported_range():
assert "Spreading factor (5-12)" in SETTINGS_H
assert "SF5-SF12" in SX1262_H