From 624fc3306cb46bd676e10becafb0b467ea8f652e Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Thu, 30 Apr 2026 23:03:17 +0200 Subject: [PATCH] tune duty cycling --- zephcore/adapters/radio/LoRaRadioBase.cpp | 5 ++++- zephcore/patches/zephyr/0003-lora-sx126x-native.patch | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/zephcore/adapters/radio/LoRaRadioBase.cpp b/zephcore/adapters/radio/LoRaRadioBase.cpp index 40bf76e..b98aaca 100644 --- a/zephcore/adapters/radio/LoRaRadioBase.cpp +++ b/zephcore/adapters/radio/LoRaRadioBase.cpp @@ -429,7 +429,10 @@ void LoRaRadioBase::startReceive() uint8_t sf = (uint8_t)cfg.datarate; uint32_t bw_hz = bandwidth_to_hz(cfg.bandwidth); float bw_khz = (float)bw_hz / 1000.0f; - uint16_t preamble_len = cfg.preamble_len; + /*uint16_t preamble_len = cfg.preamble_len; + Duty-cycle timing assumption only: keep windows compatible with + * meshes that commonly transmit with a 16-symbol preamble. */ + uint16_t preamble_len = 16; uint16_t min_symbols = (sf >= 7) ? 8 : 12; int16_t sleep_symbols = (int16_t)preamble_len - (int16_t)min_symbols; diff --git a/zephcore/patches/zephyr/0003-lora-sx126x-native.patch b/zephcore/patches/zephyr/0003-lora-sx126x-native.patch index be09f11..4113acb 100644 --- a/zephcore/patches/zephyr/0003-lora-sx126x-native.patch +++ b/zephcore/patches/zephyr/0003-lora-sx126x-native.patch @@ -68,7 +68,7 @@ index 17689720dd2..09982dc2e70 100644 return -EINVAL; } diff --git a/drivers/lora/native/sx126x/sx126x.c b/drivers/lora/native/sx126x/sx126x.c -index 30243ba5dc7..3c8619ac262 100644 +index 30243ba5dc7..c5e346da139 100644 --- a/drivers/lora/native/sx126x/sx126x.c +++ b/drivers/lora/native/sx126x/sx126x.c @@ -10,10 +10,16 @@ @@ -1111,7 +1111,7 @@ index 30243ba5dc7..3c8619ac262 100644 }; #ifdef CONFIG_PM_DEVICE -@@ -1112,6 +1881,7 @@ static int sx126x_pm_action(const struct device *dev, +@@ -1112,6 +1892,7 @@ static int sx126x_pm_action(const struct device *dev, static int sx126x_init(const struct device *dev) { struct sx126x_data *data = dev->data; @@ -1119,7 +1119,7 @@ index 30243ba5dc7..3c8619ac262 100644 int ret; /* Initialize data structures */ -@@ -1121,9 +1891,25 @@ static int sx126x_init(const struct device *dev) +@@ -1121,9 +1902,25 @@ static int sx126x_init(const struct device *dev) k_msgq_init(&data->rx_msgq, (char *)&data->rx_result, sizeof(struct sx126x_rx_result), 1); k_work_init(&data->irq_work, sx126x_irq_work_handler);