This is example code that can get you started with building your own IR vision robot that communicates over LoRa
Dependencies: Adafruit-MotorShield Adafruit-PWM-Servo-Driver Adafruit_GFX BufferedSerial MAX17055_EZconfig NEO-6m-GPS SX1276GenericLib USBDeviceHT max32630fthr max77650_charger_sample
Fork of MAX326xxFTHR_LoRa_Example_test by
Diff: SX1276GenericPingPong/GenericPingPong.cpp
- Revision:
- 42:911770814147
- Parent:
- 36:09e8b51fc91d
diff -r 1381a49e019e -r 911770814147 SX1276GenericPingPong/GenericPingPong.cpp --- a/SX1276GenericPingPong/GenericPingPong.cpp Wed Aug 01 08:32:21 2018 +0000 +++ b/SX1276GenericPingPong/GenericPingPong.cpp Wed Aug 15 04:06:09 2018 +0000 @@ -240,7 +240,7 @@ { if( BufferSizeRx > 0 ) { - /*This checks if the ID of the received transaction is matching that of + /* This checks if the ID of the received transaction is matching that of * the slave device's ID. This is Defined in the GenericPingPong.h */ if( memcmp(&BufferRx[rx_idx_signature], PongMsg, sizeof(PongMsg)) == 0 ) @@ -297,7 +297,6 @@ case RX_TIMEOUT: if( isMaster == true ) { -// fillPayloadWithGlobalBufs(BufferTx); wait_ms( 10 ); Radio->Send( BufferTx, BufferSizeTx ); } @@ -333,7 +332,6 @@ BufferTx[i] = i - sizeof(PongMsg); } */ -// fillPayloadWithGlobalBufs(BufferTx); wait_ms( 10 ); Radio->Send( BufferTx, BufferSizeTx ); } @@ -369,9 +367,9 @@ else memcpy( BufferRx, payload, BufferSizeRx ); State = RX; - - // Call function that deconstructs payload - // fillGlobalBufsWithPayload(payload); + + // Reset the RxTimeoutCount + RxTimeoutCount = 0; if (DEBUG_MESSAGE) { dprintf("> OnRxDone: RssiValue=%d dBm, SnrValue=%d", rssi, snr); @@ -396,6 +394,9 @@ State = RX_TIMEOUT; if (DEBUG_MESSAGE) dprintf("> OnRxTimeout"); + + // Increment how many times a transmission times out\ + RxTimeoutCount = RxTimeoutCount + 1; } void OnRxError(void *radio, void *userThisPtr, void *userData) @@ -404,6 +405,14 @@ State = RX_ERROR; if (DEBUG_MESSAGE) dprintf("> OnRxError"); + + // Increment how many times a transmission times out\ + RxTimeoutCount = RxTimeoutCount + 1; +} + +int numOfRxTimeouts() +{ + return RxTimeoutCount; } #endif