Sparkfun VL6180 Breakout as a bed level guide - thoughts?

First off, this thing! https://www.sparkfun.com/products/12785

I picked this up with the idea of using it as a bed leveling switch. It’s I2C based, which has given me a bit of trouble trying to wrap my head around shoe-horning this into the firmware. But the benefits are that it is (apparently) precise from 0-10CM, and reflectance doesn’t matter (so it can be pointed at the glass bed without weird false readings).

I looked around in the firmware, and I’d like to keep my physical Z-min endstop switch, which is… problematic. The firmware does a lot of preprocessor macros for reading pins (as opposed to using digitalRead(), which is fine). I don’t want to muck about with it too much. Briefly I thought about having a secondary microcontroller JUST for the rangefinder - something like the Adafruit Trinket - but that would make setup and changing parameters a pain.

My goal is to add a custom G-code command that lets me set a rangefinder ‘trigger distance.’ That way, I can manually level once, record the trigger distance that rangefinder reads, and save that to firmware. Whenever the rangefinder hits that distance (or gets closer than that distance) it would then trigger the Z-min endstop pin.

As mentioned above, the firmware isn’t really friendly to modify that way, it seems. So I thought of a somewhat roundabout way of doing it, and I’d like some thoughts on it as I’ve never tried something quiiiite like this before. My idea is, setup the rangefinder as a completely separate object in the printer firmware - and use an extra RAMBo pin as an output that is fed back into the Z-endstop pin. So when the rangefinder hits the threshold, a pin on the RAMBo goes LOW (endstops are pulled-up), which is wired to the Z-endstop pin, which then triggers the endstop code.

Thoughts? Problems? I wouldn’t be surprised if it’d be very easy to accidentally short something out here (like if the RF pin is high and the physical switch is closed?) so I’m looking for some thoughts on the matter.

I originally received an email when this product was released and thought of the same thing but after further research and contacting Sparkfun it isn’t accurate to this very fine precise distances that would be needed as a bed level guide.