I surrender. I swear I've been working on this project since April and I

I surrender. I swear I’ve been working on this project since April and I need to call in reinforcements. I’m struggling with seemingly the simplest problem. I need my alarms to increment my palettes up one each time they run. I"m using what I thought was the normal means of doing that:

gCurrentPaletteNumber = addmod8( gCurrentPaletteNumber, 1, gGradientPaletteCount);
gTargetPalette = gGradientPalettes[ gCurrentPaletteNumber ];

It works the first sunrise, the first sunset, the next day’s sunrise and then fails on the following sunset showing all white. I set the serial to output the palette number and it starts on palette 2, then 3, then 4, then 5. However, on 5, it’s all white.

Would one of you mind taking pitty on me and lending a helping hand? My daughter’s aquarium has been without a light now since April. : )

How is addmod8 defined?

I thought that was a built-in math function? Does it need to be defined?

Oh right, sorry, I didn’t see that. I looked at your code, but I did not see anything obviously wrong with it. Is there more you can print out? Maybe run it on a much shorter timescale, so you can see the problem sooner.

Thanks for giving it a look, I really appreciate it. The way I’m using alarms right now (daily) is making troubleshooting take a long time. I’m going to swam them out for repeating hourly alarms or something so I can shorten the time frame, as you suggested. Also, I’ll see what else I can get it to spit out over serial to help troubleshoot. Thanks again!