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.
Dependencies: mbed LoRaWAN-lib SX1272Libjlc
Fork of LoRaWAN-demo-72_tjm by
Diff: app/main.cpp
- Revision:
- 4:35c4373393c3
- Parent:
- 3:b93a0cb03083
- Child:
- 5:52c7f77b14c9
diff -r b93a0cb03083 -r 35c4373393c3 app/main.cpp
--- a/app/main.cpp Wed Mar 09 16:16:05 2016 +0000
+++ b/app/main.cpp Wed Mar 09 20:31:37 2016 +0000
@@ -75,7 +75,8 @@
* User application data buffer size
*/
#if ( LORAWAN_CONFIRMED_MSG_ON == 1 )
-#define LORAWAN_APP_DATA_SIZE 6
+//#define LORAWAN_APP_DATA_SIZE 6
+#define LORAWAN_APP_DATA_SIZE 12
#else
#define LORAWAN_APP_DATA_SIZE 1
@@ -139,6 +140,8 @@
#define LED_YEL PTA2
DigitalOut led1(LED_RED);
DigitalOut led2(LED_YEL);
+//DigitalIn powerOn(PTC1); /* SW2 */
+//DigitalIn killStatus(PTB17); /* SW3 */
/*!
* Specifies the state of the application LED
@@ -283,12 +286,33 @@
/*!
* \brief Prepares the payload of the frame
*/
+int randVoltage;
static void PrepareTxFrame( uint8_t port )
{
+ char str[30];
+
switch( port )
{
case 15:
{
+ switch(randVoltage%3)
+ {
+ case 0:
+ sprintf(str,"Voltage %2.2f",2.30 + (randVoltage%10 * .1));
+ break;
+
+ case 1:
+ sprintf(str,"KillStatus %d",(randVoltage & 0x04)?1:0);
+ break;
+
+ case 2:
+ sprintf(str,"PowerOn %d",(randVoltage & 0x08)?1:0);
+ break;
+ }
+ randVoltage++;
+ memcpy(AppData,str,strlen(str));
+ AppDataSize = strlen(str);
+ #if 0
AppData[0] = AppLedStateOn;
if( IsTxConfirmed == true )
{
@@ -298,6 +322,7 @@
AppData[4] = LoRaMacDownlinkStatus.Rssi;
AppData[5] = LoRaMacDownlinkStatus.Snr;
}
+ #endif
}
break;
case 224:
@@ -708,7 +733,7 @@
while( 1 )
{
- SerialRxProcess( );
+ SerialRxProcess( );
if( IsNetworkJoinedStatusUpdate == true )
{
IsNetworkJoinedStatusUpdate = false;
@@ -720,7 +745,7 @@
{
Led1StateChanged = false;
SerialDisplayUpdateLedState( 1, Led1State );
- led1 = !Led1State;
+ led1 = !Led1State;
}
if( Led2StateChanged == true )
{
