nickovs / kld7

A Python driver for the K-LD7 radar module
9 stars 2 forks source link

MIAN Parameter value under 0 #1

Closed federicoprimomo closed 1 year ago

federicoprimomo commented 2 years ago

I get an error when I try to set the MIAN to a value under 0, example -90. I got the error struct.error: argument out of range

nickovs commented 2 years ago

Thanks for the report. It looks like it probably fails for MAAN and ANTH too. I believe the bug is in line 234 of device.py which should have a lower-case i instead of an upper case I as the pack type.

If you have the ability to test this change to make sure that the fix works it would be most helpful, since I don't have access to a K-DL7 module at the moment.

sandeepgaetec commented 2 years ago

What is the transceiver chipset used in this module. Can you share the internal schematic if available with you

ajk1982 commented 2 years ago

@nickovs I have tested the change and the fix works

Sycamore-street commented 1 year ago

@nickovs I also got an error while feeding (legal) negative values: radar.params.MIAN = -90 radar.params.ANTH = -45 As you suggested, changing line 234 of device.py to lower-case i instead of an upper case I, solves the problem.

Error was: Traceback (most recent call last): File "/home/projects/radar/./radarsetup.py", line 17, in radar.params.ANTH = -45... File "/home/projects/radar/nickovskld7/device.py", line 234, in _send_command data = struct.pack("<I", data) struct.error: argument out of range

nickovs commented 1 year ago

Thanks for the confirmation. I will update the code and push a new version to PyPI.

nickovs commented 1 year ago

This is fixed by commit https://github.com/nickovs/kld7/commit/c94c83e1eddeb212367247f3c4f2b2dadddb0419 and the updated code is available as version 0.2.1.