application layer with: button, LED, pot, tempSense
Fork of LoRaWAN-demo-72-bootcamp by
Use with sx1272 shield with grove peripherals connected:
D8 D9: Button | RX TX | A3 A4: TempSense |
D6 D7: | SCL SDA : LED | A1 A2: Pot |
Button
Sends to different payloads: short press (under 1 sec)
long press: held down > 1 sec.
serial console keys
115200bps, 8N1
Enter key not used
Keys '0' to '3': cayenne channel number
'0': pot (rotary sensor)
'1': temperature
'
2': digital out
'3': analog out
Diff: app/SerialDisplay.cpp
- Revision:
- 10:52810ecbd83b
- Parent:
- 0:45496a70a8a5
--- a/app/SerialDisplay.cpp Mon Apr 24 13:31:49 2017 +0000 +++ b/app/SerialDisplay.cpp Tue Jan 30 22:49:12 2018 +0000 @@ -13,7 +13,7 @@ Maintainer: Miguel Luis and Gregory Cristian */ #include "board.h" -#include "vt100.h" + #include "SerialDisplay.h" VT100 vt( USBTX, USBRX ); @@ -124,7 +124,7 @@ SerialPrintCheckBox( state, VT100::GREEN ); } -void SerialDisplayUpdateLedState( uint8_t id, uint8_t state ) +/*void SerialDisplayUpdateLedState( uint8_t id, uint8_t state ) { switch( id ) { @@ -141,7 +141,7 @@ SerialPrintCheckBox( state, VT100::BLUE ); break; } -} +}*/ void SerialDisplayUpdateData( uint8_t line, uint8_t *buffer, uint8_t size ) { @@ -188,7 +188,7 @@ void SerialDisplayUpdateUplinkAcked( bool state ) { - vt.SetCursorPos( 24, 36 ); + vt.SetCursorPos( 22, 36 ); SerialPrintCheckBox( state, VT100::GREEN ); } @@ -197,24 +197,24 @@ // Acked SerialDisplayUpdateUplinkAcked( acked ); // Datarate - vt.SetCursorPos( 25, 33 ); + vt.SetCursorPos( 23, 33 ); vt.printf( "DR%d", datarate ); // Counter - vt.SetCursorPos( 26, 27 ); + vt.SetCursorPos( 24, 27 ); vt.printf( "%10d", counter ); // Port - vt.SetCursorPos( 27, 34 ); + vt.SetCursorPos( 25, 34 ); vt.printf( "%3d", port ); // Data - SerialDisplayUpdateData( 28, buffer, bufferSize ); + SerialDisplayUpdateData( 26, buffer, bufferSize ); // Help message - vt.SetCursorPos( 42, 1 ); + vt.SetCursorPos( 40, 1 ); vt.printf( "To refresh screen please hit 'r' key." ); } void SerialDisplayUpdateDonwlinkRxData( bool state ) { - vt.SetCursorPos( 34, 4 ); + vt.SetCursorPos( 32, 4 ); SerialPrintCheckBox( state, VT100::GREEN ); } @@ -223,29 +223,29 @@ // Rx data SerialDisplayUpdateDonwlinkRxData( rxData ); // RSSI - vt.SetCursorPos( 33, 32 ); + vt.SetCursorPos( 31, 32 ); vt.printf( "%5d", rssi ); // SNR - vt.SetCursorPos( 34, 32 ); + vt.SetCursorPos( 32, 32 ); vt.printf( "%5d", snr ); // Counter - vt.SetCursorPos( 35, 27 ); + vt.SetCursorPos( 33, 27 ); vt.printf( "%10d", counter ); if( rxData == true ) { // Port - vt.SetCursorPos( 36, 34 ); + vt.SetCursorPos( 34, 34 ); vt.printf( "%3d", port ); // Data - SerialDisplayUpdateData( 37, buffer, bufferSize ); + SerialDisplayUpdateData( 35, buffer, bufferSize ); } else { // Port - vt.SetCursorPos( 36, 34 ); + vt.SetCursorPos( 34, 34 ); vt.printf( " " ); // Data - SerialDisplayUpdateData( 37, NULL, 0 ); + SerialDisplayUpdateData( 35, NULL, 0 ); } } @@ -389,10 +389,6 @@ SerialDisplayDrawLine( " ", " [ ]Joining / [ ]Joined " ); // "+------------+----------------------------------------------------------------¦" ); SerialDisplayDrawSeparator( ); - // "¦ LED status ¦ [ ]LED1(Tx) / [ ]LED2(Rx) / [ ]LED3(App) ¦" ); - SerialDisplayDrawLine( " LED status ", " [ ]LED1(Tx) / [ ]LED2(Rx) / [ ]LED3(App) " ); - // "+------------+----------------------------------------------------------------¦" ); - SerialDisplayDrawSeparator( ); // "¦ Uplink ¦ Acked [ ] ¦" ); SerialDisplayDrawLine( " Uplink ", " Acked [ ] " ); // "¦ ¦ Datarate [ ] ¦" );