From f7f933ba5f86fd1ed47ec33b7357a25f3945a991 Mon Sep 17 00:00:00 2001
From: CARNEIRO--GILLET Alexandre
 <alexandre.carneiro-gillet@imt-atlantique.net>
Date: Sat, 19 Apr 2025 21:24:26 +0200
Subject: [PATCH] =?UTF-8?q?updates=20de=20la=20derni=C3=A8re=20fois,=20chg?=
 =?UTF-8?q?ts=20sur=20la=20r=C3=A9cep=20lora=20et=20tests?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 GW-custom/uPyLoRaWAN/config.py   | 16 +++++++++++++++-
 GW-custom/uPyLoRaWAN/main.py     | 11 +----------
 GW-custom/uPyLoRaWAN/pymakr.conf |  9 +++++++--
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/GW-custom/uPyLoRaWAN/config.py b/GW-custom/uPyLoRaWAN/config.py
index 379c64a..fd6f75e 100644
--- a/GW-custom/uPyLoRaWAN/config.py
+++ b/GW-custom/uPyLoRaWAN/config.py
@@ -37,6 +37,7 @@ device_config = {
 }
 """
 
+"""
 #M5Stack & LoRA868 Module
 device_config = {
     'miso':19,
@@ -47,6 +48,19 @@ device_config = {
     'reset':36,
     'led':12, 
 }
+"""
+
+# Configuration des broches pour le module LoRa E5 avec un ESP32
+device_config = {
+    'miso': 19,      # Pin MISO (Master In Slave Out)
+    'mosi': 27,      # Pin MOSI (Master Out Slave In)
+    'ss': 18,        # Pin SS (Chip Select)
+    'sck': 5,        # Pin SCK (Clock)
+    'dio_0': 26,     # Pin DIO0 (utilisé pour le mode interruption ou pour la détection de la fin de transmission)
+    'reset': 14,     # Pin RESET (si tu veux contrôler le reset du module)
+    'led': 2,        # Pin LED (si tu veux utiliser une LED pour indiquer l'état de l'appareil)
+}
+
 
 app_config = {
     'loop': 200,
@@ -57,7 +71,7 @@ lora_parameters = {
     'frequency': 868E6, 
     'tx_power_level': 2, 
     'signal_bandwidth': 125E3,    
-    'spreading_factor': 8, 
+    'spreading_factor': 12, 
     'coding_rate': 5, 
     'preamble_length': 8,
     'implicit_header': False, 
diff --git a/GW-custom/uPyLoRaWAN/main.py b/GW-custom/uPyLoRaWAN/main.py
index 9d33e78..58effad 100644
--- a/GW-custom/uPyLoRaWAN/main.py
+++ b/GW-custom/uPyLoRaWAN/main.py
@@ -9,7 +9,7 @@ from examples import LoRaReceiver, LoRaSender
 from machine import SPI, Pin
 from sx127x import SX127x
 
-device_spi = SPI(baudrate = 10000000, 
+device_spi = SPI(baudrate = 115200, 
         polarity = 0, phase = 0, bits = 8, firstbit = SPI.MSB,
         sck = Pin(device_config['sck'], Pin.OUT, Pin.PULL_DOWN),
         mosi = Pin(device_config['mosi'], Pin.OUT, Pin.PULL_UP),
@@ -20,17 +20,8 @@ lora = SX127x(device_spi, pins=device_config, parameters=lora_parameters)
 #example = 'sender'
 example = 'receiver'
 
-led = Pin(2, Pin.OUT)  # Assuming GPIO2 is used for the LED
 
-def blink_led():
-    led.on()
-    time.sleep(0.5)
-    led.off()
-    time.sleep(0.5)
 
-
-# Start a thread to blink the LED
-_thread.start_new_thread(lambda: [blink_led() for _ in iter(int, 1)], ())
 if __name__ == '__main__':
     if example == 'sender':
         LoRaSender.send(lora)
diff --git a/GW-custom/uPyLoRaWAN/pymakr.conf b/GW-custom/uPyLoRaWAN/pymakr.conf
index 83adfeb..039cf29 100644
--- a/GW-custom/uPyLoRaWAN/pymakr.conf
+++ b/GW-custom/uPyLoRaWAN/pymakr.conf
@@ -4,7 +4,7 @@
     "password": "python",
     "open_on_start": true,
     "safe_boot_on_upload": false,
-    "sync_file_types":"py",
+    "sync_file_types": "py",
     "py_ignore": [
         "pymakr.conf",
         ".vscode",
@@ -15,7 +15,12 @@
         "venv",
         ".python-version",
         ".micropy/",
-        "micropy.json"
+        "micropy.json",
+        "LICENSE",
+        "dev-requirements.txt",
+        "requirements.txt",
+        "README.md",
+        "uPySensors"
     ],
     "fast_upload": false
 }
\ No newline at end of file
-- 
GitLab