![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Wireless interface using LoRa technology
Dependencies: AlohaTransceiver RingBuffer SX1276Lib SerialInterfaceProtocol mbed L3PDU
Diff: main.cpp
- Revision:
- 28:0c59edd704a0
- Parent:
- 25:faa87315c44f
- Child:
- 29:020355bfe3a6
--- a/main.cpp Sun Sep 04 03:29:00 2016 +0000 +++ b/main.cpp Tue Sep 06 03:09:59 2016 +0000 @@ -553,7 +553,7 @@ { case 0x0: // temperature sensor { - uint8_t payload[3]; + uint8_t payload[9]; // copy sensor type payload[0] = 0x0; // assume 0x00 is temperature sensor @@ -563,15 +563,29 @@ // copy address of source node payload[2] = dataBlockPacket.getData(0); + for (uint8_t i = 0; i < 4; i++) + { + payload[i + 2] = dataBlockPacket.getData(i + 1); + } + + // copy snr + payload[6] = (uint8_t) aloha.getSnr(); + + // copy rssi + int_string_16 rssi; + rssi.int16 = aloha.getRssi(); + + payload[7] = rssi.bytes[0]; + payload[8] = rssi.bytes[1]; // make response - SIP.respond(0xf0, payload, 3); + SIP.respond(0xf0, payload, 9); break; } case 0x1: // door sensor { - uint8_t payload[3]; + uint8_t payload[6]; // copy sensor type payload[0] = 0x1; @@ -582,8 +596,18 @@ // copy address of source node payload[2] = dataBlockPacket.getData(0); + // copy snr + payload[3] = (uint8_t) aloha.getSnr(); + + // copy rssi + int_string_16 rssi; + rssi.int16 = aloha.getRssi(); + + payload[4] = rssi.bytes[0]; + payload[5] = rssi.bytes[1]; + // make response - SIP.respond(0xf0, payload, 3); + SIP.respond(0xf0, payload, 6); break; }