Skip to content

Wrong constant values #219

Description

@pierreluctg

Some ics constant are not correct exposed in the Python layer.

The following code is currently failing.

import ics

assert ics.SPY_STATUS2_ETHERNET_T1S_ETHERNET == 0x80000000
assert ics.SPY_STATUS2_LIN_NO_SLAVE_DATA == 0x80000000
assert ics.SPY_STATUS2_MOST_CHANGED_PAR == 0x80000000
assert ics.SPY_STATUS_EXTENDED == 0x80000000

assert ics.ETHERNET_SETTINGS10G_FLAG_COMM_IN_USE == 0x80000000

Header file in source

#define SPY_STATUS2_ETHERNET_T1S_ETHERNET 0x80000000

#define SPY_STATUS2_LIN_NO_SLAVE_DATA 0x80000000 // LIN no slave data

#define SPY_STATUS2_MOST_CHANGED_PAR 0x80000000 // first byte in ack reflects what changed.

#define SPY_STATUS_EXTENDED 0x80000000 // Extended - if this bit is set than decode StatusBitField3 in AckBytes

#define ETHERNET_SETTINGS10G_FLAG_COMM_IN_USE 0x80000000

Potential source of the issue

In my opinion this line is the source of this issue:

print("\tresult += PyModule_AddIntMacro(module, %s);" % sline[1], file=f)

This line could potentially change to

print('\tresult += PyModule_AddObjectRef(module, "{0}", PyLong_FromLongLong({0}));'.format(sline[1]), file=f)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions