generated from hulk/gd32e23x_template_cmake_vscode
feat(VL53L4CD): 增加偏移校准支持并固化44mm安装偏移
- 新增 vl53l4cd_set_offset/get_offset/calibrate_offset - main 支持开机自动校准或启动时写回固定偏移 - 当前44mm哑光目标校准结果 offset=-9mm - 同步更新 README 与 CHANGES
This commit is contained in:
+13
@@ -78,6 +78,19 @@ int main(void)
|
||||
#endif
|
||||
|
||||
if (vl53l4cd_init()) {
|
||||
#if VL53L4CD_AUTO_CALIB == CFG_ENABLE
|
||||
int16_t cal_offset = 0;
|
||||
|
||||
if (vl53l4cd_calibrate_offset(VL53L4CD_CALIB_TARGET_MM,
|
||||
VL53L4CD_CALIB_SAMPLES,
|
||||
&cal_offset)) {
|
||||
printf("VL53L4CD offset calibrated: %d mm\r\n", cal_offset);
|
||||
} else {
|
||||
printf("VL53L4CD offset calibration failed\r\n");
|
||||
}
|
||||
#else
|
||||
(void)vl53l4cd_set_offset(VL53L4CD_CALIB_OFFSET_MM);
|
||||
#endif
|
||||
vl53l4cd_start_ranging();
|
||||
printf("VL53L4CD ready\r\n");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user