From 04277ccae0ef4cf5a5f31142f4e90a273ac9b529 Mon Sep 17 00:00:00 2001
From: Sam Murray <smurray798@huskers.unl.edu>
Date: Wed, 21 Sep 2022 10:46:50 -0500
Subject: [PATCH] Modified node code to work at proper frequency and SF

---
 CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino b/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
index ecd81f6..d4b5518 100644
--- a/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
+++ b/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
@@ -180,7 +180,7 @@ static void txdone_func (osjob_t* job)
 static void tx_func (osjob_t* job)
 {
   // say hello
-  //tx("Hello, world!", txdone_func);
+  //tx("Hello, world!", 14, txdone_func);
   
   // Construct packet
   constructTxPacket((Lab3Packet_t*)&txPacket);
@@ -221,9 +221,9 @@ void setup()
   
   // this is automatically set to the proper bandwidth in kHz, based on the selected channel
   uint32_t uBandwidth;
-  LMIC.freq = 915000000; // originally was 903900000 in the example
-  uBandwidth = 125;
-  LMIC.datarate = US915_DR_SF7; // DR4
+  LMIC.freq = 000000; // originally was 903900000 in the example
+  uBandwidth = NETWORK_FREQUENCY * 1000000;
+  LMIC.datarate = US915_DR_SF9; // DR4 // originally US915_DR_SF7
   LMIC.txpow = 20;  // originally was 21 in the example
   
   // disable RX IQ inversion
@@ -262,8 +262,6 @@ int getNewTemperatureSample()
 {
   // Returns 0 if new temperature sample is valid, returns -1 if not
   float temperature = TempZero.readInternalTemperature();
-  SerialUSB.print("Temp = ");
-  SerialUSB.println(temperature);
   
   // Is this a valid temperature?
   if ((temperature >= 0.1) && (temperature <= 100.0))
-- 
GitLab