mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 05:53:34 +08:00
Add missing CDev init step
This commit is contained in:
@@ -209,6 +209,10 @@ SF0X::init()
|
||||
{
|
||||
int ret = ERROR;
|
||||
|
||||
/* do regular cdev init */
|
||||
if (CDev::init() != OK)
|
||||
goto out;
|
||||
|
||||
/* allocate basic report buffers */
|
||||
_reports = new RingBuffer(2, sizeof(range_finder_report));
|
||||
|
||||
@@ -447,7 +451,7 @@ SF0X::measure()
|
||||
char cmd = SF0X_TAKE_RANGE_REG;
|
||||
ret = ::write(_fd, &cmd, 1);
|
||||
|
||||
if (OK != sizeof(cmd)) {
|
||||
if (ret != sizeof(cmd)) {
|
||||
perf_count(_comms_errors);
|
||||
log("serial transfer returned %d", ret);
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user