Much time was spent on the code this week trying to understand how the MCP chip handles interrupts. While interrupts were sometimes generated, we found that the pin reported by the MCP didn’t always match the pin that had generated the interrupt. This meant that our code was trying to clear an interrupt that didn’t exist rather than the pin that had triggered the interrupt. Since the MCP will not trigger another interrupt until the first one is cleared, our buttons didn’t work anymore.
We checked our code again. We checked the library again. We added diagnostics statements, ran the code through a debugger (live debugging). There was no practical explanation for the wrong pins being flagged by the MCP.
We altered our code again to check for pin state differences rather than to use interrupt. Then, finally, on Saturday, we hooked buttons, switches, sensors, potentiometers and power suppy onto our boards. We started the laptop, configured the flight simulation software and hooked up the virtual reality headset. After some troubleshooting to force the PC to recognise all our inputs (especially the potentiometers), we finally had a working simulator: we are able to “fly” our glider using the MPU6050, use our buttons to start the flight, add height, enable thermal helpers, etc. It worked! So we disabled the coordinated rudder and started flying with tthe MPU6050 and the rudder. More success!
We will need to do a little bit of tuning once the sensors are installed in the glider but we’ve done it!
After enjoying our flying for a while, we decided to move on to the lighting controller. While 2 of us soldered the boards for the lighting, the other 2 focussed on the firmware. By the end of the day we had finished the soldering and had software that compiled. A little bit of testing and we’ll be ready to install the controls in the glider and fly. A major milestone is definitely in sight.
Sadly, with an incoming severe storm, we decided to postpone introducing the 2nd group of younger explorers to the simulator. (With hindisght, this turned out to be a wise decision as we lost power twice during the day which would have made it impossible to work.)