PrintLine() causing my DaisyPod to crash

I’m using PrintLine() for a serial output and I continue to get unexpected crashes. Some lines print fine while others cause a crash. For example, I have a struct that has a method to add a MIDI event to a buffer. This is the method:

void AddOnset(Onset onset) {
      int step = onset.onset_time.step;
      *this->onset_buffer[step] = onset;
      hw.seed.PrintLine("Onset Added at step %d", this->onset_buffer[step]->onset_time.step);
      // hw.seed.PrintLine("This PrintLine causes a crash");
}

The first PrintLine() call in the method works as expected. However, if I add a second PrintLine() call, my DaisyPod crashes. What would cause a simple PrintLine() call to crash my program? The method AddOnset() is triggered from operations within my AudioCallback function. Could that be what’s giving me issues?

The same thing happens in other parts of my code as well. For example if I try to called PrintLine() twice after a button press on the Pod.

Update:

I’ve refactored my code so that previous operations occur outside of the AudioCallback. Now I’m able to call PrintLine() with no issue.

2 Likes