Assign switch array to pins, is it possible?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Ras
Posts: 37
Joined: Sun Mar 30, 2014 9:27 pm
Has thanked: 10 times
Been thanked: 10 times
Contact:

Assign switch array to pins, is it possible?

Post by Ras »

This same question or issue was mentioned in another thread which suggested using the Switch Array Base to allow one to remap the switches to different pins on the same port... tried it and it does not present this option.
By default the array starts on PORTA.0 but I want it mapped to a different pin.

Is this possible? Is this feature available? How do I get to edit it?

User avatar
SteveM
Posts: 55
Joined: Tue Mar 25, 2014 2:09 pm
Has thanked: 28 times
Been thanked: 65 times
Contact:

Re: Assign switch array to pins, is it possible?

Post by SteveM »

Hi Ras,
Assuming you are using the latest version 6.0.7, then 'Switch Array Base' is the right component - for earlier 6.0.x versions, there was only one version of this component, just called 'Switch Array'. The 'Base' version of the switch array may not be visible in the 'Inputs' menu at the top of you screen - to reveal it, click the 'Search' icon, and then search for 'Array', and you will see it. If you use this component a lot, you can R-click and choose 'Add to favourites', and then it will appear in the 'Favourites' menu every time you open Flowcode.

Once you have the component, here's how to set each pin individually.

- First, select the Switch Array on your panel and open the Component Properties panel - either from the R-click context menu of the component, or the main 'View' menu.
- Click the drop-list for the 'Port' property - you need to select the last item in the list 'Custom Pins'.
- This will reveal the hidden properties for each individual switch (the list grows and shrinks if you change the number of LEDs in the array).
- You can now choose individual pins for each 'Switch...' property.
- Choose an option in the 'Show Labels' property to show the pin numbers next to the switchesl - thesel automatically update if you change the pin settings.

If you don't like the style of the switches on the 'Array Base'...

- Find one of the other switches that you prefer from the 'Inputs' component menu and drag it onto the panel - make a note of its 'Handle' name at the top of the properties panel.
- Select the 'Array Base' again to see its properties.
- Open the 'Target Switch' property, and in the list, choose the switch that you just dragged on.
- The new switch will now disappear, but all the switches in the array will change to look and behave like that one.

BTW, all of these instructions work exactly the same for the 'LED Array Base' component!

Best regards,
Steve.

P.S.) The 'custom' options are not available for the other array components - 'Switch Array (Slide), Switch Array (Push) or LED Array (PCB). These types of array were made for our school customers - they wanted the components to be more simple for their younger students. This is also why some 'advanced' components are 'hidden' when you first install Flowcode.

Ras
Posts: 37
Joined: Sun Mar 30, 2014 9:27 pm
Has thanked: 10 times
Been thanked: 10 times
Contact:

Re: Assign switch array to pins, is it possible?

Post by Ras »

All works as described except for:
If you don't like the style of the switches on the 'Array Base'...

- Find one of the other switches that you prefer from the 'Inputs' component menu and drag it onto the panel - make a note of its 'Handle' name at the top of the properties panel.
- Select the 'Array Base' again to see its properties.
- Open the 'Target Switch' property, and in the list, choose the switch that you just dragged on.
- The new switch will now disappear, but all the switches in the array will change to look and behave like that one.
The problem is that the new shape switch does disappear in the sense that I could not see it but when compiling FC generates an error stating that some pins are not connected. Only by selecting into the area I found that the component is still there and I needed to delete it to resolve the error on compile.

[edit] The above seemed to work but after saving project and closing FC then restarting it, the shape of my switch array reverted to its default LED one, so it appears that you can not delete the component used to shape the switch array and have to live up with the error mentioned (I am attaching a JPG to show what FC says)... or connect the "invisible" component as well.


Also, is there a way to zoom to selected area in the dashboard?
I zoomed to 100% and now all graphical objects are very small. I could not find a way to re-size all or zoom to area selected so I had to resort to manually re-sizing each component which is really silly, must be that I do not know yet of a better way... Is there one?
Attachments
CompNC.jpg
CompNC.jpg (17.56 KiB) Viewed 5253 times

User avatar
SteveM
Posts: 55
Joined: Tue Mar 25, 2014 2:09 pm
Has thanked: 28 times
Been thanked: 65 times
Contact:

Re: Assign switch array to pins, is it possible?

Post by SteveM »

Hi Ras,

Re: Switch array
Apologies for the errors - you should not be seeing the 'pin unconnected' message.
As you say, the chosen 'switch shape' does need to be in the panel (but hidden), so that the component can see the 3D shapes and make copies for the array. The flowchart WILL still compile with the 'hidden' switch/LED, as the unconnected pin is intentional, and the macros for the 'hidden' component are never called by the array - compilation should complete successfully if you just dismiss the warning. (Of course, if this is not the case for your choice of PC or target chip, please let us know!)
This was the best way that we could find to make arrays of 'cloned' components with customisable graphics that would retain compatibility with old v5 projects. However, we are aware that it is not ideal, and is something that we will be looking into during the next phase of v6 development (the unnecessary warning message at least should be suppressed! - I'll try to get that fixed for the next update).

Re: Zooming
On both panels, you can zoom the display by spinning your mouse wheel while holding down the CTRL key. You can also R-click on a component and select 'look at' to centre the view on the chosen component. However, a 'draw a box around' zoom or 'magnifying glass' tool would be a very nice feature - I often use a 'track ball' on my graphics PC that has no mouse wheel! - so I will add that to our 'suggestions' box.

Best Regards,
Steve.

Ras
Posts: 37
Joined: Sun Mar 30, 2014 9:27 pm
Has thanked: 10 times
Been thanked: 10 times
Contact:

Re: Assign switch array to pins, is it possible?

Post by Ras »

Another follow up on this topic... this happens after I shape and size the switch array so it looks like the mage at the top of my attachment. The I save and exit FC and restart FC (like in "calling it a day and coming back next day")

Well, as you can see the shape stays but the size does not, it is either way smaller or way bigger (I am only showing the bigger). I can change this by selecting the switch array component, access Properties/Position and editing the World Size / Height but the fact is that it should remember the size it was saved with, right?
SwitchArrayShapeNotHolding.jpg
SwitchArrayShapeNotHolding.jpg (25.72 KiB) Viewed 5222 times
Also, I though that I "resolved" the error reported by actually connecting to some pin the "invisible switch" used for shaping. This is not saved either, so on restart it is disconnected and will trigger the error once again...

All things are related and probably once one is fixed the others will fall in place as well. Hope this helps pin-point where the bug is hiding.

User avatar
SteveM
Posts: 55
Joined: Tue Mar 25, 2014 2:09 pm
Has thanked: 28 times
Been thanked: 65 times
Contact:

Re: Assign switch array to pins, is it possible?

Post by SteveM »

Ras wrote:it should remember the size it was saved with, right?
Oh yes - it certainly should! Thanks for the report.

Best regards,
Steve.

Post Reply