Switch arrays

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
chaswk
Posts: 1
http://meble-kuchenne.info.pl
Joined: Mon May 10, 2021 9:09 pm

Switch arrays

Post by chaswk »

When using a switch array or push-button switch array in the simulation mode for Flow Code 9, I am unable to get the switch array to toggle on and off when clicking it with a mouse on the dashboard panel. The work around I am using is the digital pin view and manually toggling the pins in that to change the switch state and things work as expected. When I send the code to the board everything works as expected. Has anyone seen this issue? I am wondering if this is an issue with the high def monitors we are using and/or I am missing some setting in the 2d and 3d dashboard panel that does not allow this toggle.

WingNut
Posts: 254
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 33 times
Been thanked: 23 times

Re: Switch arrays

Post by WingNut »

Make sure your simulation speed is set high enough otherwise you will have to press nd hold until the simulation gets to the part where the button is tested

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 469 times

Re: Switch arrays

Post by medelec35 »

hello.
The switch arrays are working for me as I have just tested them.
Do the switches work when held in, but stop working when released?
If so, you can change the switch from the default momentary to latching via the properties.
Right-Click on the switch array on the dashboard panel and select properties.
Change Operation from momentary to latching.
When running a simulation, if the switch is not working for you when the switch is clicked then can you either upload your project on this thread or PM me if you wish your project to remain private.
You will need to select Full Editor & Preview to upload your project.
Martin

Steve-Matrix
Matrix Staff
Posts: 1234
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Switch arrays

Post by Steve-Matrix »

A high definition monitor is unlikely to be the cause of this issue. Is Flowcode itself the latest version (v9.3) and are your library files up-to-date?

rowlan4g
Posts: 3
Joined: Tue Mar 08, 2022 1:39 pm
Been thanked: 3 times

Re: Switch arrays

Post by rowlan4g »

I appear to be having the same issue with my software.

When clicking on or toggling switch icons in the 2D or 3D panels during a debug simulation, the buttons don't appear to respond to being pressed. This is a change in functionality, as it worked fine last academic year. (Yes, I've just found this fault in the middle of teaching a lesson. :/ ) Some updates have been applied over the summer by our IT department, the current installed version is 9.3.0.35, build dated April 28 2022.

Further details:
> This happens with a selection of push, slide, rocker, and toggle switches from the component library: every one that I've tried has this issue.
> I've tried clicking on a latching button, or clicking and holding when the button is set up as momentary. There is no visual change to the button icon, either. (I seem to recall this happening last year.)
>Using ReadState macros to obtain the state of the switch (as opposed to an Input block)
> Changing the polarity of the switch from Active High to Active Low results in the program detecting (and responding to) the opposite logical value, but it still doesn't detect any presses of the simulated switch.
> As above, manually toggling values in the Digital Pins window is recognised correctly by the program.
>When using Ghost ICD with a BL0055 board, Flowcode responds to the presses of physical (Eblock) switches correctly. If simulating a BL0145 Eblock's switches in the Dashboard, the simulator fails to respond (as above).

A sample program is attached, though it's not particularly complex or interesting.

If you have any ideas of further checks/tests that may help identify the cause, please let me know.
Attachments
BL0055-Ghost-Test1.fcfx
(8.97 KiB) Downloaded 37 times

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: Switch arrays

Post by BenR »

Hello,

In your project the switch seems to be connected to pin A0 which doesn't exist on the target microcontroller. Please can you check your component properties, specifically the pin connections and hopefully that wil solve the problem.

Looks like maybe the Arduino pins have been renamed and hence the existing property values have been lost. The LED component had the same problem.

Here is your project with the connection properties fixed.
BL0055-Ghost-Test1.fcfx
(8.96 KiB) Downloaded 37 times

rowlan4g
Posts: 3
Joined: Tue Mar 08, 2022 1:39 pm
Been thanked: 3 times

Re: Switch arrays

Post by rowlan4g »

Hello,

Thank you for the reply.

The error on the pin allocation for the switch was an unintentional mistake on my part. I'd been playing around with an illuminated switch just before my earlier message, but when hurriedly replacing it with a basic switch, I forgot to set it to pin 7 ($PORTD.7). The earlier tests were most certainly done with the correct pin assigned.

The file you've sent back has the switch assigned to $D7 and the LED assigned to pin $D13, which my installation of Flowcode seems to misinterpret in the context of an Arduino Uno. On trying to compile or simulate it, I'm given an error that "one or more of the pins of component led_5mm_clip are not connected". Setting it to $pin13, or $PORTB.5 resolves that issue, though, as I mentioned, it's not directly related to my original issue. ($D7 also needs to be changed to $pin7 or $PORTD.7 to clear a subsequent error.)

After dealing with that misconfiguration, the original issue is still present: pressing the push button during a debug simulation isn't recognised by the simulation of the flowchart, and no visual feedback is seen on the 2D panel either.

I've attached a second copy of the file with the (corrected) port assignments that worked for me.
Attachments
BL0055-Ghost-Test2.fcfx
(8.97 KiB) Downloaded 37 times

rowlan4g
Posts: 3
Joined: Tue Mar 08, 2022 1:39 pm
Been thanked: 3 times

Re: Switch arrays

Post by rowlan4g »

Hello again,

With further experimentation today, I've found that there were some outstanding library updates for our Flowcode installation (as seen via Help/Library Updates). Among these, there was an update to switch.fcpx, from revision 1 to revision 2.

Applying this update (and restarting Flowcode) resolved the above error: the simulated button gave a visual depress indicator as before, and the new state was recognised correctly in the program. I tested this on several machines before and after applying the update, and the fix behaved identically each time.)

I've no idea how/why our IT department applied some updates but not all (or perhaps some came more recently). Either way, I now know how to resolve this on our machines.

Hopefully any other readers will be able to resolve this issue by checking that their Library for switch.fcpx is fully up to date.

(Thanks for taking a look at the issue and digging around in the meantime.)

Post Reply