I built the Makelangelo, a robot that draws murals. The firmware is for a RUMBA board, which is arduino compatible - think a Mega 2560 and a RAMPS shield on a single PCB. The firmware is heavily based on Marlin 3D printer firmware. It supports several different kinematic systems like arms, corexy, polargraphs, etc. The polargraph is the subject today.
in release version 7.15.3 people noticed something strange - when the Makelangelo v5 is told to go home (send G28 at 57600 baud with newline) the robot (polargraph.ino, robot_findHome()) will touch both limit switches (expected) drive back to home position (fine) and then it should print "Done". Only it gets to "Do-" and reboots.
The same does not happen in 7.15.0. I took a copy of 7.15.0 and started adding features in one at a time to see if I could isolate the feature that caused the reboot. As best I can tell,
if MACHINE_HARDWARE_VERSION == 5
MENU_ACTION("Find home", LCD_find_home);
in lcd.ino line ~160 is the culprit. Which is 2#$*(! odd, because that code is not being called at the time the error occurs. The method LCD_find_home() calls on robot_findHome() but the call stack does not include LCD_find_home(). Commenting out the lines above and recompiling makes the bug go away.
My best guess is that there is a much older off by one error somewhere, and compiling the code in juuuust the right way causes that off by one to poke the wrong bit of ram and BOOM reboot.
Having torn out what's left of my hair looking for it, I'm at a loss. I need fresh eyes to look over my shoulder and say "put the red seven on the black eight", to spot the thing that's right in front of me that I'm missing.
Can you see it? Would you please tell me? I'm out of ideas.
Edit: a word. Edit 2: link was to software when it should have been to firmware. Oops.