I know this problem has something to do with the program, but I fixed what I could think of and now I don’t know what else to change. The effect is that after I hit F5 and the assembly deploys, it takes another minute (60~ seconds) to actually start running the program. It wasn’t doing this before. I’ve run a different program on the device and it still took a minute to start up. I tried powering it from a stronger USB port; no change. Even when I just unplug and re-insert the usb cable, the device appears to take a long time to start up. I have the debug led flash at a certain rate to indicate certain activity, including network activity. There was one point where it was so bad, I had to wipe the firmware (including tinybooter) just to get the device back. That problem turned out to be related to setting the time. There was a function I used that I shouldn’t have.
I am running 3 main threads in the program. I’ve put the program main in a loop with a Sleep call of 1000 ms. I don’t recall why; it was just to solve some sort of program I was having a long time ago. Then there is the loop that controls the flashing of the debug led. The loop turns off the led every 100ms. So if somewhere in the program the led is requested to turn on, this thread turns it off again. Then there is the dispatcher. This is a large work thread that receives incoming data, executes them on the robot and responds with the result. All of these loops are continuously running