On the TTN side, the Join Request is accepted, so the keys and all should be okay. But somehow either the gateway is not transmitting the Join Accept though it has been told to do so (see the gateway’s logs; any chance there’s a lot of network latency?), or the device is not receiving or not handling it.
So, look in the gateway’s logs. Also, I’d focus on the following:
The nans seem to indicate the sensor did not return any reading. That doesn’t look good and could very well be related to wiring or pin mapping, or to using a wrong library for your sensor. Both might also affect the working of the LoRa chip.
Assuming you meant 3.1.0, then as per the 3.1.0 code:
…the index 20 is EV_JOIN_TXCOMPLETE. So, that should be handled just fine by the example code you’re using:
I’d guess you’re using a different library than you think you are. (Or are not using the 3.1.0 example. Next time, please link to the code you’re using.)
Given that join accepts are being generated by the network, it’s likely that the node is either not activating the receiver at the precisely correct time, or not activating them at all.
Receive window timing has historically been very hard to get right in LMiC particularly when trying to make it portable, and less common platforms like the ATmega32u4 are going to make it trickier still. The main development platforms for that repo are the Feather M0 and their custom BSP for their STM32L073 board, those are most likely to work right.