-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calibration #1
Comments
That's a great resource! I hadn't seen that before. I found this device to be a bit tricky to understand at times... such as the calibration routine! So it would be great to have help/contributions. I see on that page:
I suspected that would need to be the case- but I haven't done that yet. The code should have a way of overriding the
I exposed some of the functions for reading/writing in hope that this will keep folks from being limited. Looks like I didn't expose all of them though 😊. I just pushed a new version with them exposed. I see in the API docs:
That's a problem in the current code since they're both done in Anyhow, I converted the code on that page and it runs... not sure if it worked? what to do next? LMK what you figure out. Thanks! const i2c = require('i2c-bus-promise')
const VL53L0X = require('./')
const CALIBRATE_DISTANCE_OFFSET = (0x61)
const CALIBRATE_SPAD = (0x75)
const TEMPERATURE_CALIBRATION = (0x55)
const sleep = (t) => new Promise((resolve) => setTimeout(resolve, t));
i2c.open(1).then(async (bus) => {
const vl53l0x = VL53L0X(bus, 0x29)
console.log('CALIBRATE_SPAD')
await vl53l0x.io.write(Buffer.alloc(1, CALIBRATE_SPAD))
await sleep(1000)
console.log('TEMPERATURE_CALIBRATION')
await vl53l0x.io.write(Buffer.alloc(1, TEMPERATURE_CALIBRATION))
await sleep(1000)
console.log('CALIBRATE_DISTANCE_OFFSET')
await vl53l0x.io.writeReg16(CALIBRATE_DISTANCE_OFFSET, 100)
console.log('sleeping for 10 seconds...')
await sleep(10000)
console.log("Calibration Complete");
})
.catch(console.error) |
That code didn't really make sense to me... This it appears to just be setting the write index: await vl53l0x.io.write(Buffer.alloc(1, CALIBRATE_SPAD)) ... and not writing anything there. So, I figured there must be some magic going on I wasn't understanding. Indeed, after investigating these MappyDots- I now understand (I don't have one of these). They added a ATmega328PB to help simplify some things. Pretty neat-o. So, when you just write some special values- they're intercepted and then issue the more complicated steps... nice! |
I'm very new to this type of programming. (low level) and I to have a project that I am working on and did a "refactor" fork on my side from your project (Thank you!! for this package!) Alas, I tried to do: console.log('CALIBRATE_DISTANCE_OFFSET')
await vl53l0x.io.writeReg16(CALIBRATE_DISTANCE_OFFSET, 100) and I believe it is doing nothing. :/ and what is the SPAD calibration? I have read what spad is but cannot for the life of me understand what it is here. Thank you again for this project |
Hi, thanks for this JS port, I'm very keen on this since one of my projects is highly dependent on it. Also glad to contribute if anyhow possible. I'm wondering if it's possible to use the calibration functions through this library? I have the sensor behind a cover window and it would benefit if it could go through "crosstalk calibration" as well as "offset distance calibration" as described in here https://sensordots.org/mappydotcalibration thanks a lot!
The text was updated successfully, but these errors were encountered: