Traumflug/Teacup_Firmware — pull request #61 by phord (2013-11-19 22:54:45+00:00)
Title: Reduce code complexity and size by iterating axes

Following a TODO tip in the code, I worked through the issues to convert all the X, Y, Z and E axis variables into arrays, usually of "axis[X]", "axis[Y]", "axis[Z]" and "axis[E]". Over several commits I think I have managed to clean these all into working code. But I have not tested it on a printer. I have tested it on the PC simulator, but those tests are still fairly limited.

Originally, it was based on the 'cross' branch since I saw some code duplication erupting there. I rebased it onto experimental now, and cross will need a little cleanup to rebase on top of this. But first it needs a thorough review.

In addition to cleaner code, it also saves us almost 2K flash:

New:

SIZES ATmega... '168 '328(P) '644(P) '1280
FLASH : 15182 bytes 106% 50% 24% 12%
RAM : 995 bytes 98% 49% 25% 13%
EEPROM: 32 bytes 4% 2% 2% 1%

Old:

SIZES ATmega... '168 '328(P) '644(P) '1280
FLASH : 17124 bytes 120% 56% 27% 14%
RAM : 995 bytes 98% 49% 25% 13%
EEPROM: 32 bytes 4% 2% 2% 1%