I got my Davis ISS test program working on the MoteinoMega. The problem was the interrupt was
hard coded as zero:
So I changed the program work the same way your library does by
passing the interrupt number based on the MCU type:
I also changed the SPI.setClockDivider to SPI_CLOCK_DIV4 based on
your note that this works better with the mega1284
Also, Dekay has this SPI code in
initialize() functionSPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV4);
You moved it to
select() function. Would you recommend I make this same change and move it to select() function?
Do you think I should also use the code below to prevent mode switching in
setFrequency() function?
uint8_t oldMode = _mode;
if (oldMode == RF69_MODE_TX) {
setMode(RF69_MODE_RX);
}
I don't know if that's a problem with Dekay's library. The Moteino is only receiving data from the Davis ISS, it's not transmitting anything (that I know of) - I don't know if that matters for this mode switching problem.
I see that the RSSI is done a little bit differently in the two libraries. Dekay reads it at the
start of InterruptHandler(), you've got it
at the end. Should I move it to the end?
Here's a link to Diff Checker where you can see the changes I've made so far:
https://www.diffchecker.com/7oyor10h