From 083cc9b0e4d69473a5886946c8c3208c874a59f8 Mon Sep 17 00:00:00 2001 From: sensorsiot Date: Sun, 22 May 2022 09:15:04 +0200 Subject: [PATCH] Added SF definition in sketch 1 and 4 and corrected esp_now_peer_info_t peerInfo; --- Examples/1_LoRa_Sensor/fdrs_sensor.h | 2 ++ Examples/4_UART_Gateway/4_UART_Gateway.ino | 1 + Examples/4_UART_Gateway/fdrs_config.h | 1 + Examples/4_UART_Gateway/fdrs_functions.h | 4 +++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Examples/1_LoRa_Sensor/fdrs_sensor.h b/Examples/1_LoRa_Sensor/fdrs_sensor.h index 7c9b973..876e436 100644 --- a/Examples/1_LoRa_Sensor/fdrs_sensor.h +++ b/Examples/1_LoRa_Sensor/fdrs_sensor.h @@ -30,6 +30,7 @@ #define WIFI_PASS myPASSWORD #define MQTT_ADDR MQTT_BROKER #define BAND myBAND +#define SF mySF #else #define WIFI_NET "Your SSID" #define WIFI_PASS "Password" @@ -154,6 +155,7 @@ void beginFDRS() { if (!LoRa.begin(BAND)) { while (1); } + LoRa.setSpreadingFactor(SF); DBG(" LoRa Initialized."); #endif } diff --git a/Examples/4_UART_Gateway/4_UART_Gateway.ino b/Examples/4_UART_Gateway/4_UART_Gateway.ino index 9acd2e3..01fb703 100644 --- a/Examples/4_UART_Gateway/4_UART_Gateway.ino +++ b/Examples/4_UART_Gateway/4_UART_Gateway.ino @@ -69,6 +69,7 @@ void setup() { if (!LoRa.begin(BAND)) { while (1); } + LoRa.setSpreadingFactor(SF); DBG(" LoRa initialized."); #endif // UART_IF.println(sizeof(DataReading)); diff --git a/Examples/4_UART_Gateway/fdrs_config.h b/Examples/4_UART_Gateway/fdrs_config.h index 75ad250..189c88d 100644 --- a/Examples/4_UART_Gateway/fdrs_config.h +++ b/Examples/4_UART_Gateway/fdrs_config.h @@ -44,6 +44,7 @@ #define WIFI_PASS myPASSWORD #define MQTT_ADDR MQTT_BROKER #define BAND myBAND +#define SF mySF #else #define WIFI_NET "Your SSID" #define WIFI_PASS "Password" diff --git a/Examples/4_UART_Gateway/fdrs_functions.h b/Examples/4_UART_Gateway/fdrs_functions.h index 44770bf..fd89f89 100644 --- a/Examples/4_UART_Gateway/fdrs_functions.h +++ b/Examples/4_UART_Gateway/fdrs_functions.h @@ -6,7 +6,9 @@ const uint8_t espnow_size = 250 / sizeof(DataReading); const uint8_t lora_size = 256 / sizeof(DataReading); const uint8_t mac_prefix[] = {MAC_PREFIX}; - esp_now_peer_info_t peerInfo; +#if defined(ESP32) +esp_now_peer_info_t peerInfo; +#endif uint8_t broadcast_mac[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t selfAddress[] = {MAC_PREFIX, UNIT_MAC};