casainho said:
1. I think you agree that for current project, that is to run TSDZ2 with feature rich LCDs like 850C and SW102 Bluetooth, runtime variables initialized are not need.
I agree that the project should focus on those displays.
Do you think we should use EEPROM in the motor controller? Should we have functions and instructions for reading to and from EEPROM?
Should we initialize the runtime variables from EEPROM? Because that is what we are doing today. We are already initializing variables and having instructions to do that. Why not just initialize directly and remove many instructions and save space?
But also, this is not done for space optimizations as the difference this makes is negligible. It should be done because there is no reason to use the EEPROM in the first place and there is no reason to have the code be more complicated with unnecessary steps.
This is what happens today:
1. Initialize the EEPROM
2. Look for the key, if there is no key we write the default values in every address that corresponds to every variable, (a lot of instructions)
3. Take the struct of configuration variables and load it with the values from the EEPROM, so read each and every address and load those values to each and every configuration variable, (a lot of instructions! Takes up space but that is not the point I am trying to make)
3. The configuration variables can then be used as they are initialized to the default values or values saved in the EEPROM. But other values are never saved in the EEPROM so we are always loading default the values.
This is what should happen:
1. Initialize the variable to some default value (or even skip the initialization to save space with variables that are not actually necessary to initialize when not using a display)
casainho said:
2. Also you should agree (because it is math and not something subjective) that runtime variables initialized use programming memory.
I have never said otherwise. See my answer for question number 1. We are doing more unnecessary steps that do take up more place than if we were to simply initialize the variable. This is not subjective.
casainho said:
3. Because there is the risk of not having the needed programming memory for next new features, and considering 1. and 2., runtime variables initialized should not be used.
I really think this is some kind of misunderstanding because:
- This difference in space is minuscule
- It should remove unnecessary steps and actually make more space available