set-measurement-timing-budget

wayland/vl53l1x-time-of-flight/set-measurement-timing-budget

Set measurement timing budget. The VL53L1X timing budget can be set from 20 ms up to 1000 ms. • 20 ms is the minimum timing budget and can be used only in Short distance mode. • 33 ms is the minimum timing budget which can work for all distance modes. • 140 ms is the timing budget which allows the maximum distance of 4 m (in the dark on a white chart) to be reached under Long distance mode Increasing the timing budget increases the maximum distance the device can range and improves the repeatability error. However, average power consumption augments accordingly.
set-measurement-timing-budget
@/set-measurement-timing-budget
Set measurement timing budget. The VL53L1X timing budget can be set from 20 ms up to 1000 ms. • 20 ms is the minimum timing budget and can be used only in Short distance mode. • 33 ms is the minimum timing budget which can work for all distance modes. • 140 ms is the timing budget which allows the maximum distance of 4 m (in the dark on a white chart) to be reached under Long distance mode Increasing the timing budget increases the maximum distance the device can range and improves the repeatability error. However, average power consumption augments accordingly.
DEV@/vl53l1x-device
A VL53L1X device.
MTBnumber
Measurement timing budget (microseconds). N.B. units are microseconds not milliseconds.
UPDpulse
Update. Trigger for setting measurement timing budget.
set-measurement-timing-budget
DEV
MTB
UPD
OK
OKpulse
Pulses when measurement timing budget is set.
To use the node in your project you should have the wayland/vl53l1x-time-of-flight library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_UPD>(ctx))
        return;

    // Get a pointer to the `VL53L1X` class instance
    auto sensor = getValue<input_DEV>(ctx);

    // Attempt to set measurement timing budget; if attempt fails emit pulse from error port
    if (!sensor->setMeasurementTimingBudget(getValue<input_MTB>(ctx))) {
        raiseError(ctx);
        return;
    }

    emitValue<output_OK>(ctx,1);
}