-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate the nameBuffer for freeing up additional RAM #207
Comments
I repeat here the comment I made on Discord about the choice of the ID. |
For outputs, the config order is now more conveniently used as ID because it allows immediate addressing; otherwise, an additional (very quick) array scan could be made in the firmware with little effort. |
I am still not convinced that the pin number should be used. Also I would not change the output devices (one exception, see below). If changed an array of a given size for transforming is required which must be precessed. The array could be a fixed size (how big?) or must be also dynamically intialized (into the device buffer?). This would mean additional effort. There is one exception I am wondering since month. The (LED) outputs are set directly by it's pin number and not via the "device ID". I havn't found a reason for this, and for a change the connector has to be changed and it is not anymore backwards compatible. Therefore I hadn't argued to change this. But now it would be a good opportunity to harmonize it with the other output devices. |
Pardon my bluntness, but I fail to see any actual advantages mentioned for any of your objections. Some of them seem to be on the lines of "seems better", but exactly why? The only actual point would regard the array to be added for output devices, which however I did not propose; in fact, as I mentioned, a very quick search would do the job. No array at all would be required. I can only point out one more time that the solution I propose does not come at the cost of any additional effort; we would be doing the same kind of work anyway. |
During the last days a played around with a Nano (which is a small Uno) and figured out, that we are really really short on RAM. Only "less" additions could be done before the Nano showed a strange behaviour (crashes at different "locations" of the firmware). And deactivating not needed devices will not clear up sooo much RAM (what I already did during testing). |
As we have aggreed on sending the deviceID instead of the name two weeks ago I have prepared the required changes for all input devices except the input multiplexer. The config.cpp is also already adapted (incl. the required changes for the multiplexer). Or is there another way to do it in a better way or what you prefer? Thanks and regards Ralf |
Yes, gladly.
I'd generally say it would be good to have one single PR to address the issue in its entirety, but it also makes sense to split the two since you have your part ready before mine. Let's proceed as you suggested. |
As discussed on Discord already the nameBuffer could be eliminated and instead of the name from an input device an "identifier" would be send. The connector have to know about the identifier and the relation to the input device name, therefore the user will not seen any differences. The benefit is that the nameBuffer stored in the RAM is not required anymore and additional RAM is available. Furthermore the serial traffic is reduced as the names could be "long" and instead just an identifier is transferred.
The identifier could be the x.th device from the same type which gets initialised. This information is already available from number of intialised decices, e.g. for the buttons
buttonsRegistered
inbuttons[buttonsRegistered] = new (allocateMemory(sizeof(MFButton))) MFButton(pin, name);
. Instead of saving the namebuttonsRegistered
would be saved and on an event transferred.During processing the config there is always the same order of initialising input devices so there is also always the same
indentifier
.Reading the config from the connector happens also in the same order, therefore the connector has a fix relation between the
identifier
(x.te device) and the name which is transferred during reading the config.The same applies to all other input devices.
For backwards capability the connector has to check the firmware version and depending on this the connector has to expect names or identifiers.
The text was updated successfully, but these errors were encountered: