LoRa Access Point 1.5.2018

Dependencies:   mbed ds3231 SX1276Lib_LoRa_Access_Point

Revision:
11:376bfcdda0d4
Parent:
10:e62222c46ee9
diff -r e62222c46ee9 -r 376bfcdda0d4 RFM95W.cpp
--- a/RFM95W.cpp	Thu Mar 28 09:55:48 2019 +0000
+++ b/RFM95W.cpp	Sat May 08 16:23:46 2021 +0000
@@ -53,7 +53,7 @@
 
 void RFM95W::OnLedTick()
 {
-    if(ledState<6) {
+    if(ledState<4) {
         indicationLed = !indicationLed;
     } else {
         ledState = 0;
@@ -66,7 +66,7 @@
 void RFM95W::SendMessage()
 {
     snprintf((char *)ack, 3, "%c%c%c",GATEWAY_ID, sendBuffer[0], messageNumber);
-    radio.Send( sendBuffer, 15 );
+    radio.Send( sendBuffer, 30 );
 }
 
 void RFM95W::SendAck(uint8_t addr, uint8_t messageNumber)
@@ -133,7 +133,7 @@
         uint8_t msgFrom = payload[1];
         indicationLed=0;
         ledTicker.detach();
-        ledTicker.attach(callback(this,&RFM95W::OnLedTick), LED_BLIK_PERIOD);
+        ledTicker.attach(callback(this,&RFM95W::OnLedTick), 0.05);
         if((size == 3) && (strncmp( ( const char* )payload, ( const char* )ack, 3 ) == 0) ) {
             receivedAck = true;
             wifi.ConfirmReceivedAck(msgFrom);
@@ -154,7 +154,7 @@
         messageNumbers[msgFrom] = payload[2];
         payload[2] = 48;
         memmove(payload, payload+4, size - 4 + 1);      // orezem prve styri bajty
-        snprintf((char *)receivedMessage, BUFF_SIZE, "%d|%d|%d|%d|%s|\r\n", rssi, snr, GATEWAY_ID, msgFrom, payload);
+        snprintf((char *)receivedMessage, BUFF_SIZE, "%s|%d|%d|%d|%d|%s|",actual_time, rssi, snr, GATEWAY_ID, msgFrom, payload);
         writeDataToSD = true;
         wifi.SendMessage((char *)receivedMessage);  
         SDcard.Write((char *)receivedMessage);
@@ -278,7 +278,7 @@
     radio.Write( REG_PACONFIG, paConfig );
 
     pc.printf("________Start aplikacie________\r\n" );
-    timeOnAirSec = (radio.TimeOnAir( MODEM_LORA, 10)/1000.0);              // time on air v ms
+    timeOnAirSec = (radio.TimeOnAir( MODEM_LORA, 25)/1000.0);              // time on air v ms
     pc.printf( "\n\n\r------- Time on air : %f sec. -------\n\r", timeOnAirSec);
     indicationLed = 1;
     InitRandom();
@@ -300,3 +300,9 @@
     }
     srand(seed);
 };
+
+bool RFM95W::ReceivedMessage()
+{
+    if(writeDataToSD) return true;
+    return false;
+};