From 784f76b823ff03b7afb56f5b6965c5c11e1fd414 Mon Sep 17 00:00:00 2001
From: Sam Murray <smurray798@huskers.unl.edu>
Date: Thu, 22 Sep 2022 14:05:11 -0500
Subject: [PATCH] Fixed frequency and bandwidth bugs. They were being set up
 incorrectly (my goof there...)

---
 CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino b/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
index d4b5518..2edda14 100644
--- a/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
+++ b/CSCE838-Lab4-Node/CSCE838-Lab4-Node.ino
@@ -19,7 +19,7 @@
 
 /** Defines **/
 #define NODE_ID  1
-#define NETWORK_FREQUENCY 914
+#define NETWORK_FREQUENCY 915
 
 // clock parameters
 #define CPU_HZ 48000000
@@ -180,17 +180,18 @@ static void txdone_func (osjob_t* job)
 static void tx_func (osjob_t* job)
 {
   // say hello
-  //tx("Hello, world!", 14, txdone_func);
+  tx("Hello, world!", 14, txdone_func);
+  SerialUSB.println("Hello world");
   
   // Construct packet
   constructTxPacket((Lab3Packet_t*)&txPacket);
 
   // Send the packet
-  tx((Lab3Packet_t*)&txPacket, sizeof(txPacket), txdone_func);
+  //tx((Lab3Packet_t*)&txPacket, sizeof(txPacket), txdone_func);
 
   // Print the packet
-  printPacket((Lab3Packet_t*)&txPacket);
-  IsErrorDetect((Lab3Packet_t*)&txPacket);
+  //printPacket((Lab3Packet_t*)&txPacket);
+  //IsErrorDetect((Lab3Packet_t*)&txPacket);
 
   // Set up the next packet's packet ID
   txPacket.PacketID++;
@@ -221,8 +222,8 @@ void setup()
   
   // this is automatically set to the proper bandwidth in kHz, based on the selected channel
   uint32_t uBandwidth;
-  LMIC.freq = 000000; // originally was 903900000 in the example
-  uBandwidth = NETWORK_FREQUENCY * 1000000;
+  LMIC.freq = NETWORK_FREQUENCY * 1000000;; // originally was 903900000 in the example
+  uBandwidth = 125;
   LMIC.datarate = US915_DR_SF9; // DR4 // originally US915_DR_SF7
   LMIC.txpow = 20;  // originally was 21 in the example
   
@@ -461,4 +462,4 @@ void TC4_Handler()
     getNewTemperatureSample();
     // five second block counter
   }
-}
\ No newline at end of file
+}
-- 
GitLab