Hi Aaron
Also related, what is the difference between the "temporary" parameter block and the "swap" block???
Surely the temp block is not used unless the swap block is being used?
So shouldn't a lot more of the code in the parameter block handling, be dependent on USE_PAR_SWAP_BLOCK?
There are in fact two subjects here. The first think to realise is that there are parameters and temporary parameters. This is not a requirement but just how the demo project does it. The reason is to show how it is possible to make parameter changes of a temporary nature (some may be immediately used and some displayed but not yet be committed to use - like most IP changes). It allows changes to be made and checked before actually committing then, and also the changes to be reverted (i.e. canceled). A reference project needed this and that is where the base came from - if not needed it can all be done with one set of parameters.
The second is the saving in FLASH so that the values are permanent. Here there are temporary and validated blocks, but this is only the case when the uParameterSystem is configured to use a swap block. If there is no swap block there is only a single valid set at any time. There are then two advantages of the swap block:
1) It is possible to make changes which are then really used (also after a reset or power down), but it is also possible to return to the previous set of parameters. The demo uses this technique to allow new IP settings to be tested for a period of 3 minutes. If these are not 'validated' the temporary set will be deleted so that the original set becomes used again., The main reason is to ensure that no IP settings are changed which perminently leave a device unreachable (eg. when they are changed incorrectly) - the tutorial also describes this in some detail.
Again it is am application demonstration (although often used like this) and it is free to do it any other way.
2) A swap block ensures that even if the power to the board were removed in the instant that new parameters are being programmed it is not possible to lose previous ones. When not working with a swap block there will always be a short period of time where old parameters are deleted and, if power happens to fail in this instance, the new ones are also not available. The result is that all setting revert back to factory settings.
If this is not a big deal there is no reason to use a swap block. However in many cases it could be a problem when parameters are lost and so that is why the swap block option is available and also usually used.
This should explain that the temporary parameters are not directly related to the swap block. Some projects may want a temporary set but not a swap block; others may want a swap block but not temporary parameters, etc.
Regards
Mark