So I'm building a custom RC transmitter and receiver; with the nrf24 as the wireless coms device. At the moment I'm trying to control an RC car. Issue is that sometimes the car just hangs and stops responding to the input from the transmitter. I'm not sure if the issue is with the tx or the rx; but I found that sometimes restarting the transmitter once or a few times sorts the issue; but sometimes I found that I need to restart both the tx and rx for it to work again. I'm looking through my code to find the culprit; but with no luck so far. Here are the project repos and schematics:
The code is long and won't fit in code tags; hence why I posted the links to the repos which contain all the code. Please check them out and let me know what you think. Cheers.
I apologize if I am being ambiguous. Please tell me what you want me to elaborate on and I will .
To explain what's going on in the repo; I'm using platformIO. So all the code is in the 'src' and 'lib' folders. The main.cpp file contains the setup and loop functions.
I would be very surprised if anyone bothers look up your "repo", especially since this is the Arduino forum, where vanishingly few people care about or use PlatformIO.
Your project is complex, so don't expect others to debug your project.
If it works, then the wires and components are fine. Freezes solved by reboots are, in general, code issues (dead-locks). Since you are using a State Machine, probably that the code is stuck in some unwanted state transition (maybe never leaves that state, or infinite state cycle between two states, or something).
I see that you are using SD card: make a logging mechanism, log your State Machine transitions and when it freezes, just used the sdcard log file to see where it stopped (or maybe you'll just see tons of infinite state changes without an actual outcome). Then, inspect your code and try to understand if the logic meant there fits with what the code actually does.