mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Tidy up the write path.
This commit is contained in:
parent
899fbcc7cf
commit
72fcc8aad3
@ -1085,18 +1085,16 @@ ssize_t
|
||||
PX4IO::write(file *filp, const char *buffer, size_t len)
|
||||
{
|
||||
unsigned count = len / 2;
|
||||
int ret;
|
||||
|
||||
if (count > 0) {
|
||||
if (count > _max_actuators)
|
||||
count = _max_actuators;
|
||||
ret = io_reg_set(PX4IO_PAGE_DIRECT_PWM, 0, (uint16_t *)buffer, count);
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
int ret = io_reg_set(PX4IO_PAGE_DIRECT_PWM, 0, (uint16_t *)buffer, count);
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
}
|
||||
return count * 2;
|
||||
}
|
||||
|
||||
extern "C" __EXPORT int px4io_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user