From 537583e5056b379d80f7989dfda4e8c2e08c3674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Wed, 13 Jul 2022 23:49:31 +0200 Subject: [PATCH] Configure LoRA gateway parameters at startup (#1234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this (and without sending an initial MQTT message to the gateway to configure it) messages are not necessarily received if parameters are different from firmware defaults. This patch helped at least two users: - https://community.home-assistant.io/t/awesome-lora-soil-sensor/304351/23 - https://community.home-assistant.io/t/awesome-lora-soil-sensor/304351/18 Change-Id: Ia65ee5780b56f81fc73662c8779b79083805009b Co-authored-by: Grégoire Seux --- main/ZgatewayLORA.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main/ZgatewayLORA.ino b/main/ZgatewayLORA.ino index c9c722d..7f61ba3 100644 --- a/main/ZgatewayLORA.ino +++ b/main/ZgatewayLORA.ino @@ -49,6 +49,12 @@ void setupLORA() { Log.notice(F("LORA_SS: %d" CR), LORA_SS); Log.notice(F("LORA_RST: %d" CR), LORA_RST); Log.notice(F("LORA_DI0: %d" CR), LORA_DI0); + LoRa.setTxPower(LORA_TX_POWER); + LoRa.setSpreadingFactor(LORA_SPREADING_FACTOR); + LoRa.setSignalBandwidth(LORA_SIGNAL_BANDWIDTH); + LoRa.setCodingRate4(LORA_CODING_RATE); + LoRa.setPreambleLength(LORA_PREAMBLE_LENGTH); + LoRa.setSyncWord(LORA_SYNC_WORD); Log.trace(F("ZgatewayLORA setup done" CR)); }