This fixes a bug with the oscilloscope I've been trying to fix for months. It turned out to be caused by two separate things, making it hard to nail down.
When building with -O0, the ADC1_Interrupt* functions were not being inlined, which caused significant call overhead. I've added a warning in the ISR documentation explaining this. An alternative solution would be to #define the functions instead of making them static inlines.
The legacy firmware uses a nested if clause to collect samples from different channels, which is super ugly so I replaced it with a for loop. Turns out the for loop is also much slower, so I had to change it back to the nested if. Bleh.
Also, while triaging this I noticed that the LED toggling actually slows down the oscilloscope by a measurable amount. It's very very little, but not nothing. Maybe don't toggle it during sample collection? Note to self: Discuss during next meeting,
This fixes a bug with the oscilloscope I've been trying to fix for months. It turned out to be caused by two separate things, making it hard to nail down.
-O0
, theADC1_Interrupt*
functions were not being inlined, which caused significant call overhead. I've added a warning in the ISR documentation explaining this. An alternative solution would be to#define
the functions instead of making themstatic inline
s.Also, while triaging this I noticed that the LED toggling actually slows down the oscilloscope by a measurable amount. It's very very little, but not nothing. Maybe don't toggle it during sample collection? Note to self: Discuss during next meeting,