Hi, How about we clean up powermanagement.c a little further?
After looking through the code, I have some suggestions: 1) There seems to be some low-level battery voltage logging in powermanagement.c when DEBUG_FILE is defined. Do we still needs this or can we remove it and just use battery bench instead? 2) There's a couple of functions that are only used for the simulator. Can't we move those to stubs.c (possibly expand stubs.c into sub-system specific files if it gets too big)? 3) There's a huge chunk of code (charging_algorithm_big_step) that only gets used when CHARGING_CONTROL is defined. This seems to be some kind of -dV/dt charging algorithm. Can't we move this to a separate file? We could (for example) move specific charging algorithms into separate files and put their state machines into a charging_state() function that is called from the main power thread. 4) If CHARGING_CONTROL really just means a -dV/dt charging algorithm, shouldn't we rename it like that? Kind regards, Bertrik