LoRa Access Point 1.5.2018

Dependencies:   mbed ds3231 SX1276Lib_LoRa_Access_Point

Revision:
5:19b34c4d27a1
Parent:
4:e20eb5efd859
Child:
8:5d99fbf255d6
--- a/RFM95W.h	Mon Apr 30 17:09:34 2018 +0000
+++ b/RFM95W.h	Mon Apr 30 22:41:48 2018 +0000
@@ -6,12 +6,9 @@
 #include "ESP8266.h"
 #include "Board.h"
 
-#define GATEWAY_ID 1    // Moja adresa (id)
+#define GATEWAY_ID 1    // Adresa Access pointu
 
 ////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/* Set this flag to '1' to display debug messages on the console */
-#define DEBUG_MESSAGE   0
 
 /* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
 #define USE_MODEM_LORA  1
@@ -21,36 +18,36 @@
 #define TX_OUTPUT_POWER                                 20        // 20 dBm
 
 #if USE_MODEM_LORA == 1
-                            // Max range, slow data rate = BW=125, CR=4/5, SF=12
-    #define LORA_BANDWIDTH                              1         // [0: 125 kHz,
-                                                                  //  1: 250 kHz,
-                                                                  //  2: 500 kHz,
-                                                                  //  3: Reserved]
-    #define LORA_SPREADING_FACTOR                       12        // [SF7..SF12]
-    #define LORA_CODINGRATE                             1         // [1: 4/5,
-                                                                  //  2: 4/6,
-                                                                  //  3: 4/7,
-                                                                  //  4: 4/8]
-    #define LORA_PREAMBLE_LENGTH                        8         // Same for Tx and Rx
-    #define LORA_SYMBOL_TIMEOUT                         5         // Symbols
-    #define LORA_FIX_LENGTH_PAYLOAD_ON                  false
-    #define LORA_FHSS_ENABLED                           false
-    #define LORA_NB_SYMB_HOP                            4
-    #define LORA_IQ_INVERSION_ON                        false
-    #define LORA_CRC_ENABLED                            true
+// Max range, slow data rate = BW=125, CR=4/5, SF=12
+#define LORA_BANDWIDTH                              1           // [0: 125 kHz,
+                                                                //  1: 250 kHz,
+                                                                //  2: 500 kHz,
+                                                                //  3: Reserved]
+#define LORA_SPREADING_FACTOR                       12          // [SF7..SF12]
+#define LORA_CODINGRATE                             1           // [1: 4/5,
+                                                                //  2: 4/6,
+                                                                //  3: 4/7,
+                                                                //  4: 4/8]
+#define LORA_PREAMBLE_LENGTH                        8           // Same for Tx and Rx
+#define LORA_SYMBOL_TIMEOUT                         5           // Symbols
+#define LORA_FIX_LENGTH_PAYLOAD_ON                  false
+#define LORA_FHSS_ENABLED                           false
+#define LORA_NB_SYMB_HOP                            4
+#define LORA_IQ_INVERSION_ON                        false
+#define LORA_CRC_ENABLED                            true
 
 #elif USE_MODEM_FSK == 1
 
-    #define FSK_FDEV                                    25000     // Hz
-    #define FSK_DATARATE                                19200     // bps
-    #define FSK_BANDWIDTH                               50000     // Hz
-    #define FSK_AFC_BANDWIDTH                           83333     // Hz
-    #define FSK_PREAMBLE_LENGTH                         5         // Same for Tx and Rx
-    #define FSK_FIX_LENGTH_PAYLOAD_ON                   false
-    #define FSK_CRC_ENABLED                             true
+#define FSK_FDEV                                    25000     // Hz
+#define FSK_DATARATE                                19200     // bps
+#define FSK_BANDWIDTH                               50000     // Hz
+#define FSK_AFC_BANDWIDTH                           83333     // Hz
+#define FSK_PREAMBLE_LENGTH                         5         // Same for Tx and Rx
+#define FSK_FIX_LENGTH_PAYLOAD_ON                   false
+#define FSK_CRC_ENABLED                             true
 
 #else
-    #error "Please define a modem in the compiler options."
+#error "Please define a modem in the compiler options."
 #endif
 
 #define RX_TIMEOUT_VALUE                                2500000     // in us                          // 3500000
@@ -58,7 +55,6 @@
 #define MAX_DEVICES                                     255
 #define MAX_RESENDS                                     4
 //------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
 
 class RFM95W
 {
@@ -66,7 +62,7 @@
     RadioEvents_t radioEvents;                /**< Radio events function pointer   */
     SX1276MB1xAS radio;                       /**< Radiovy modul   */
     DigitalOut indicationLed;                 /**< Indikacna led   */
-    AnalogIn noise;                       
+    AnalogIn noise;
     Ticker ledTicker;
     Ticker sendTicker;
     Ticker ackTicker;
@@ -81,7 +77,7 @@
     volatile bool receivedAck;
     volatile bool sendingAck;
     volatile uint8_t sendCounter;
-    
+
     float CalculateRandomTime();
     void InitRandom();
     void OnLedTick();
@@ -97,7 +93,7 @@
     void OnTxTimeout( void );
     void OnRxTimeout( void );
     void OnRxError( void );
-    void OnCadDone( bool channelActivityDetected );  
+    void OnCadDone( bool channelActivityDetected );
     void SendValue(uint8_t addr, float value);
     void SendValue(uint8_t addr, int value);
     void SendMessage(char* message);