Skip to content
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

Fix boolean writing #13

Merged
merged 1 commit into from
Feb 26, 2016
Merged

Conversation

johanfforsberg
Copy link

Writing boolean tags is broken so that whatever value specified, it will always be interpreted as True. This fix allows "0" or "false" to write false, and any other number or "true" to write true. Not sure what should be allowed exactly.

@pjkundert pjkundert merged commit 17932fe into pjkundert:master Feb 26, 2016
@pjkundert
Copy link
Owner

Thanks! Fixed; rolled version 3.9.2

@rikirolly
Copy link

I am trying to write a BOOL tag on Omron NX1P2 PLC.
When I read the tag declared as BOOL on the PLC I get an INT list of 2 elements with the first element representing the corresponding BOOL value.
I cannot write the tag instead and this is my trial:
via = proxy( shelf[identifier].ip_address )
with via:
value = True
params = via.parameter_substitution('mytag = (BOOL)' + str(value))
tag_value, = via.write(params, checking=True)

any suggestion?
Thanks a lot

@GraninDB
Copy link

GraninDB commented Oct 3, 2020

Hello!
try to replace

class BOOL( TYPE ):
    tag_type                    = 0x00c1
    struct_format               = 'B'

with

class BOOL( TYPE ):
    tag_type                    = 0x00c1
    struct_format               = '<H'

in parser.py
i was able to write BOOL from ONRON NJ series

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants