I recently began using a Lightware LW20 on my quadplane + Pixhawk 2.1 with some firmware on master (commit e76865e to be exact) that was working well. I was receiving the correct distances from the LW20. However, after a single test hover, the LW20 began to constantly report this exact reading in cm (reading_cm): 65436 (0xFF9C) - referring to line https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_RangeFinder/AP_RangeFinder_LightWareI2C.cpp#L83 - which Arduplane used as a 654.36m distance indication. This persists across two different Pixhawk 2.1s with the same firmware installed.
The be16_t val variable on the same line when printed indicates 40191 (0x9CFF) constantly. The wiring between the LW20 and Pixhawk 2.1 is alright, so I’m wondering if something might have been set on the LW20 to force it into a different mode. Also, does anyone know how to read/write to I2C ports with MAVProxy/nsh? I’ve tried the devop module in MAVProxy and it doesn’t seem to work, and nsh doesn’t have an i2c application as indicated in some placed online.
Unfortunately I don’t have an I2C to USB converter on hand right now I was trying to find another way, like connecting through nsh directly to read/write to the I2C bus.
If the sensor was working and then without any change in the system it do not work anymore it could be a problem related to the sensor itself.
Ask for you problem to Lightware they have an good customer support.
I also have a LW20 but because of the lack of a configuration tool for I2C version did not use yet for my project, I was tempted to send it back to Lighware service and switch the cable to the serial connector inside.
Just to follow up on this - there was a small manufacturing error in this particular LW20, which was RMAed and replaced quickly - many thanks to Lightware for the quick response.