Replies: 7 comments 16 replies
-
This discussion might be more relevant to the Mobiflight-FirmwareSorce repository; I posted it here to avoid scattering, please advise if it should be moved. |
Beta Was this translation helpful? Give feedback.
-
Interesting idea! Enabling sharing of these lines seems like a straightforward way to free up more pins for use by other devices. Could the solution be as simple as just allowing users to select already-used pins in the dropdowns in the desktop app? I think some slight firmware changes would be required too, but not much. It would also resolve this user experience issue: #573 The downside to a simple solution like this is potential new user error, accidentally using the same pin for more than one LED for example (which is why I assume the current experience exists, to guard against that). |
Beta Was this translation helpful? Give feedback.
-
Hello guys - i don't understand the benefit of re-using one CLK line over having the total freedom of assigning pins to their respective IC/Driver. In my opinion this sounds like restricting the user convenience with an optimization that is not really needed so much. Convince me of the benefits, i am open to listen carefully to your reasoning. |
Beta Was this translation helpful? Give feedback.
-
After some time has passed - and many improvements have been added to the system - I think this discussion is still current and should be revived. The solution I have in mind would be very easy to implement, below is a quick summary. (Edit) IMPORTANT: this solution refers to the options with control lines freely chosen by the user; the above "fixed pins / hardware peripherals" option would not be exploited (although still open for a later change if required).
The only real non-trivial aspect in this solution (actually, all there is to it) is the correct identification of what pins can be defined as sharable and presented to the user in the GUI, but after some thought this would be all it takes. I would appreciate your comments; I'd be glad to go further with the implementation provided that I have confirm that the proposal is favorably considered. |
Beta Was this translation helpful? Give feedback.
-
yes, that's correct - i was immediately reminded of the discussion i had with @GioCC - i still believe that the majority of the users doesn't think in SPI Controller and attaching different devices to it. My assumption: I want to add a device, and it will show as one device. I think I/O expansion probably is a topic for intermediate users. So maybe we can make other assumptions about their level of understanding. However, I still prefer a flat list of devices at the moment instead of starting to nest nodes, which should be then probably the proper way of visualizing the "sharing" of the same lines. Another reason for not doing it prominently in the UI also was that we wanted to keep the API simple for adding a device. I didn't want to make Mobiflight Connector aware of the fact that the firmware internally created a MultiplexerBus(? might be a different name) and the Multiplexer. I wanted to hide this detail inside the firmware. Therefore for every multiplexer Connector sends the same message including the repeated pin settings. Very simpel. What we definitely could do is, similar to the approach we have now for the multiplexer (where we show the reused settings from the first multiplexer), to offer the user the option to reuse the pins from another SPI device or define new pins. |
Beta Was this translation helpful? Give feedback.
-
for some reason the comment i wrote yesterday is not visible here in the conversation: @GioCC i think we are still checking whether a pin is already in use before attaching a new device - only the displays don't do that iirc. |
Beta Was this translation helpful? Give feedback.
-
what is the benefit of using the specific pins over using arbitrary pins? does it require less computational resources? |
Beta Was this translation helpful? Give feedback.
-
What does it mean
Currently, the driver lines for an I/O block in Mobiflight can be assigned freely to (almost) any yet unused Arduino pins.
This has several drawbacks:
How this can be changed
Several types of serial peripherals (Shift registers, LED drivers, Display drivers...) use the very same set of signals (basically three: Data, Clock, Latch/Select)*.
Only one of these three signals needs to be different and specific for each component; the remaining two can be handled in common, without interference.
Using common lines in MobiFlight is a point worth seriously considering; the firmware is already I would say almost 95% compatible, the only relevant change would be to modify the configurator in order to enforce correct pin assignment in a user friendly fashion.
* Their working logic is not necessarily identical between components, but it is for all most common components, and all currently used ones.
Choice of common lines / individual line
Normally, the Latch/Select signal is the one that is singled out; however, if compatibility with the SimVim/RealSimControl system is desired (which uses exactly this type of common line handling), the peripheral-specific signal would necessarily have to be the CLK line.
Also note that compatibility with SV/RSC would also require all display drivers and output shifters to share common Data and Latch lines (input shifters are not supported there because MPXs with direct inputs are deemed sufficient in their place).
Choice of the assignment of common pins
The pin assignment for the two common lines could either be chosen by the user or fixed.
The first option doesn't really make much sense, and besides, the chosen pins should be marked as "shared" and treated in a somehow different manner with no real benefit.
If these lines were assigned to pre-determined, fixed pins, however, they could be assigned to the pins corresponding to the hardware interfaces of the Arduino; this would open the possibility of using said hardware interfaces (or still software drivers, or even both) whenever possible.
This would bring a gain in speed and possibly in ease of handling.
For further optimization, pins used for a certain category of peripherals (e.g. SPI, MPXs) could be released if no peripheral of that category is used.
Beta Was this translation helpful? Give feedback.
All reactions