I gave it a try with a Core M5 basic but I did not get the inside of the battery turn green, orange or red. It stayed black. The issue is that the m5f file does not contain all of the blockly commands, rect1, rect2... up to rect 6 are missing and must be added. The python program contains the corresponding commands but they don't seem to be sufficient..
The increase brightness button works, the decrease brightness seems to effective, screens becomes completely black.
Overall my feeling is that the code is too complex to just report the battery charge level.
And as you say, the indication lacks of precision : 100 % 75% 50% and 25%