8PM here, so I’m assuming DHL won’t be delivering today, which means it will have taken 2 days for my PCBs to get from China to the depot 100 miles away, and 5 days to get from the depot to me. They were supposed to have been delivered yesterday.
I now have low-battery lockout in the code. At 2.8V it’ll blink twice (200mS off/200mS on) and then stay steady on. At 2.7V it turns off. I haven’t started on temperature monitoring code; figured I’d wait until my LED PCBs arrive and I can look at real-time heat instead of trying to simulate signals with a pot. That way I can look at thermal capacitance as a factor for action delays in the control loop.
Went ahead and updated the code with constant definitions for all relevant constants (number of modes, battery cutoff values) and port pin definitions to make it easier to change things around in the future. Even internal addressing related to port pins in signal multiplexers and ADC sources pull from the defines so if I need to change port assignments it’s literally a one-line edit for the whole program. That’s probably pretty standard for you guys but not as straightforward when coding in assembler.
Maintenance routines for battery monitoring added significantly to the program size. Now we’re up to 270 2-byte instructions. I know there are at least 6 unnecessary instructions (defining a 4th mode), and I haven’t tested for bank bit optimization in the compiler. Splitting ADC routines off as a function will save a further 10 or so instructions, with further savings once temperature sensing is added. All in all I’m pretty pleased. Now if only those PCBs would show up…