Wireless interface using LoRa technology
Dependencies: AlohaTransceiver RingBuffer SX1276Lib_inAir SerialInterfaceProtocol mbed L3PDU
Diff: main.cpp
- Revision:
- 30:7b9994fe26cf
- Parent:
- 27:9196cb5859f7
--- a/main.cpp Sun Sep 04 03:29:53 2016 +0000 +++ b/main.cpp Tue Sep 06 03:11:26 2016 +0000 @@ -484,7 +484,8 @@ { case 0x0: // temperature sensor { - uint8_t temp = getTemperature(); + float_bytes_32 temp; + temp.fp32 = getTemperature(); // create a response DataBlockPacket response; @@ -501,11 +502,14 @@ // set source type (temperature) response.setSourceType(0x0); - // set payload type (signed integer) - response.setPayloadType(0x9); + // set payload type (floating point number) + response.setPayloadType(0xa); // copy temperature (use first byte) - response.setData(0, temp); + for (uint8_t i = 0; i < 4; i++) + { + response.setData(i, temp.bytes[i]); + } // calculate crc response.generateCrc();