Marco Zecchini / Mbed 2 deprecated Smartage

Dependencies:   BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2

Fork of STM32L0_LoRa by Helmut Tschemernjak

Files at this revision

API Documentation at this revision

Comitter:
marcozecchini
Date:
Tue May 22 21:29:24 2018 +0000
Parent:
20:1557c9d9c183
Child:
22:2c1359292de1
Commit message:
Working version

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
smartage/smartage.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 17 11:02:34 2018 +0000
+++ b/main.cpp	Tue May 22 21:29:24 2018 +0000
@@ -31,7 +31,6 @@
         
         char message[8];//Message to be sent
         sprintf(message, "%d", distance);
-        dump("Check: ", (uint8_t*)message, 8);
          
         SendAndBack((uint8_t*)message);
     }
--- a/main.h	Thu May 17 11:02:34 2018 +0000
+++ b/main.h	Tue May 22 21:29:24 2018 +0000
@@ -18,7 +18,7 @@
 #ifdef FEATURE_USBSERIAL
 extern USBSerialBuffered *usb;
 #endif
-void long_to_uint8(unsigned int distance, uint8_t* message);
+void get_distance(uint8_t* message);
 extern bool _useDprintf;
 extern void InitSerial(int timeout, DigitalOut *led);  
 extern void dump(const char *title, const void *data, int len, bool dwords = false);
--- a/smartage/smartage.cpp	Thu May 17 11:02:34 2018 +0000
+++ b/smartage/smartage.cpp	Tue May 22 21:29:24 2018 +0000
@@ -233,10 +233,15 @@
             *led3 = 1;
             memcpy(Buffer, str, sizeof(str));
             // We fill the buffer with numbers for the payload 
-            for( i = sizeof(str); i < BufferSize; i++ )
+            Buffer[sizeof(str)]='G';
+            Buffer[sizeof(str)+1]='C';
+            Buffer[sizeof(str)+2]='-';
+            Buffer[sizeof(str)+3]='1';
+            for( i = sizeof(str)+4; i < BufferSize; i++ )
             {
-                Buffer[i] = i - sizeof(str);
+                Buffer[i] = i - sizeof(str)+4;
             }
+            dump("Check: ", Buffer, BufferSize);
             wait_ms( 10 ); 
             Radio->Send( Buffer, BufferSize );
             trasmission_routine += 1;
@@ -261,6 +266,7 @@
     dprintf("> Finished!");
     //destroy led led3 e Buffer e radio
     delete(led);
+    delete(led3);
     delete(Buffer);
     delete(Radio);
 }
@@ -281,7 +287,7 @@
     State = RX;
     if (DEBUG_MESSAGE)
         dprintf("> OnRxDone: RssiValue=%d dBm, SnrValue=%d", rssi, snr);
-    dump("Data:", payload, size);
+    //dump("Data:", payload, size);
 }
 
 void OnTxTimeout(void *radio, void *userThisPtr, void *userData)