That is an amazing project, and I thought that I was THE NURD. The software, hardware, 3d printing and maybe some electrical design by one person are inspiring. You even made it fun for your kids, which I could never do. You have inspired me...
Yes, _signed_ integer overflow is not defined in C or C++ at all... Many programs assume it is defined, and usually it works as expected, sometimes it does not (and it can be very confusing). Use unsigned if deliberately overflowing ints.
I'm reasonably sure integer overflow/underflow is still undefined behavior so the compiler is free to make optimizations assuming it will never happen, i.e. if it sees a loop with "x<=0" as an exit condition, but it knows x starts as a positive...
the second while:
while(x>0 && z>0){
should have been (or was originally) :
while(x>y && z>0){
but demonstrates that even a test of positiveness fails.
Problem with optimization settings when testing around max integer. Arduino IDE 2.3.6, T1.6b5. This worked back in 2015 :)
void setup() {
int x,y,z;
Serial.begin(9600);
while (!Serial)
;
x=2;
y=0;
while(x>y){
y=x...
I'm guessing this is a bad solder joint on the large bga (Ball Grid Array) package. The crystal is connected to the worst possible location on the package bga stress wise.
see...