The space savers included:
- Declaring const arrays static const.
- Having two two different pull functions, the full stack pull calls the other pull rather than having duplicate code. It might be better to have these call the library function memmove rather than having assignments. They could also be done more tightly in assembly code via two entry points into the one function.
Things to try include:
- Changing the key to byte mapping to some less human readable.
- Using a function table to dispatch instead of a switch. This would benefit from a reorganisation of the command codes so the dispatched functions start for 0x00 and are contiguous.
- I think buttoncast can be done with the tables by renumbering the KC use 0x00 - 0x0F and some bit operations. A straight log2 of the key scan could be the key code but changes elsewhere (checking for digits using ranges) would need modification. There might be a smarter way.
- I suspect switch statements are expensive. E.g. moving the atan code into its own case increases code size but it should be a saving since it has no relationship with the other code surrounding where it is now.
- The asinh and acosh code could be merged.
- Avoid calling both log10 and log.
Pauli