Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: lorawan-SP/app/main.cpp
- Revision:
- 1:c6548df8c4e0
- Parent:
- 0:3fc4a1072bca
- Child:
- 2:e3ff1ae9ee16
diff -r 3fc4a1072bca -r c6548df8c4e0 lorawan-SP/app/main.cpp --- a/lorawan-SP/app/main.cpp Thu Mar 28 09:26:33 2019 +0000 +++ b/lorawan-SP/app/main.cpp Sat Apr 06 11:31:39 2019 +0000 @@ -19,6 +19,8 @@ #include "LoRaMac.h" #include "Commissioning.h" #include "SerialDisplay.h" +#include "str_to_num.h" +#include "capteur.h" @@ -53,7 +55,7 @@ * * \remark Please note that when ADR is enabled the end-device should be static */ -#define LORAWAN_ADR_ON 1 +#define LORAWAN_ADR_ON 0 #if defined( USE_BAND_868 ) @@ -91,7 +93,7 @@ * User application data buffer size */ #if ( LORAWAN_CONFIRMED_MSG_ON == 1 ) -#define LORAWAN_APP_DATA_SIZE 15 +#define LORAWAN_APP_DATA_SIZE 11 #else #define LORAWAN_APP_DATA_SIZE 1 @@ -290,6 +292,8 @@ } // Sensors +static capteur capt (PB_9, PB_8); +static str_to_num stn; @@ -302,24 +306,37 @@ { case 15: { + uint8_t PH; + int16_t Temp; + int16_t OXY; + int16_t COND; + PH = stn.PH_uint(capt.return_pH()); + Temp = stn.Temp_int(capt.return_temp()); + OXY = stn.Oxy_int(capt.return_DO()); + COND = stn.Cond_int(capt.return_EC()); - AppData[0] = 1; + if( IsTxConfirmed == true ) { - AppData[2] = (uint8_t) 10; - AppData[3] = (uint8_t) 10; - AppData[4] = (uint8_t) 10; - AppData[5] = (uint8_t) 10; - AppData[6] = (uint8_t) 10; - AppData[7] = (uint8_t) 10; - AppData[8] = (uint8_t) 10; - AppData[9] = (uint8_t) 10; - AppData[10] = (uint8_t) 10; - AppData[11] = (uint8_t) 10; - AppData[12] = (uint8_t) 10; - AppData[13] = (uint8_t) 10; - AppData[14] = (uint8_t) 10; + + AppData[0] = (uint8_t) 0x1D; + AppData[1] = (uint8_t) PH; + + AppData[2] = (uint8_t) 0x1E; + AppData[3] = (uint8_t) OXY; + AppData[4] = (uint8_t) OXY>>8; + + + AppData[5] = (uint8_t) 0x1F; + AppData[7] = (uint8_t) COND; + AppData[6] = (uint8_t) COND>>8; + + + AppData[8] = (uint8_t) 0x01; + AppData[9] = (uint8_t) Temp>>8; + AppData[10] = (uint8_t) Temp; + } } break; @@ -781,6 +798,7 @@ while( 1 ) { + SerialRxProcess( ); if( IsNetworkJoinedStatusUpdate == true ) {