This week I went back and got delayed auto-shift working with the FPGA buttons.
This mechanic defines how held buttons should behave. When a button is held down it initially has a long pause, then it has a fast repeat rate for as long as the button is held down. I initially implemented this behavior as a long delay, then check at the end of the delay if the key signal was still asserted and transition into a short delay state. Then at the end of each delay period, check if the key was asserted or not. If it was, stay in the short delay state, if not go back to the long delay state. This works when buttons behave well and do not have any jitter. Because this implementation worked very poorly, we believe the FPGA keyswitches are have some jitter. I suspect this implementation doesn’t work because even when the keyswitches on the FPGA are held down, the button itself is not a stable asserted signal. This causes the check after each delay to be uncertain.
What I’ve done to address this problem is introduce a third buffer state that monitors the line for an assert. This way, the assert can come within the buffer time to cause the input to trigger the short cool-down rather than needing the input to assert on the cycle after the cool-down ends. Experimenting with the buffer period, it seems that this buffer can be very short, it works well when it is as short as 3 cycles.
I’m excited to integrate this with Alton since he has the controllers working as well, we should be able to have the full single-player experience working within a few days.
Looking forward to next week, I plan to spend some time finally trying to debug the “pixel rain” behavior that we have had from the very beginning when we started working on tile rendering. This issue has persisted ever since. I’m planning to try and isolate the issue within the next week if its just cable noise or something to do with the values being generated on the FPGA. Because I’ve seen this disappear and reappear between different set-ups I suspect it is the former.
If time allows I’m also going to spend some time trying to get a nicer rendering than just colored squares which I mentioned last week. I did not have time to get to that since the ethics assignment also took some time this week.