LeoDJ / P2Pro-Viewer

A viewer and API for the InfiRay P2 Pro thermal camera module
MIT License
171 stars 22 forks source link

Possibly remove dependence on Zadig installer on Windows #12

Open nanoparticle opened 1 year ago

nanoparticle commented 1 year ago

Hi, I just found your project, and it looks pretty cool so I thought I'd give a couple of suggestions:

class DeviceInfoType(enum.IntEnum):
    def __new__(cls, value: int, length: int):
        obj = int.__new__(cls, value)
        obj._value_ = value
        return obj

    def __init__(self, value: int, length: int):
        self.length = length

    DEV_INFO_CHIP_ID = (0, 8)
    DEV_INFO_FW_COMPILE_DATE = (1, 8)
    DEV_INFO_DEV_QUALIFICATION = (2, 8)
    DEV_INFO_IR_INFO = (3, 26)
    DEV_INFO_PROJECT_INFO = (4, 4)
    DEV_INFO_FW_BUILD_VERSION_INFO = (5, 50)
    DEV_INFO_GET_PN = (6, 48)
    DEV_INFO_GET_SN = (7, 16)
    DEV_INFO_GET_SENSOR_ID = (8, 4)

You can still use the enum member as before to retrieve the index as an int, but now if you call DeviceInfoType.DEV_INFO_GET_PN.length, it will retrieve the length instead.

Hope this helps!