forked from Archive/PX4-Autopilot
Make PX4IO driver obey HIL as it should
This commit is contained in:
parent
199936b1c5
commit
0581c7f712
|
@ -1332,6 +1332,8 @@ PX4IO::io_handle_battery(uint16_t vbatt, uint16_t ibatt)
|
||||||
battery_status.discharged_mah = _battery_mamphour_total;
|
battery_status.discharged_mah = _battery_mamphour_total;
|
||||||
_battery_last_timestamp = battery_status.timestamp;
|
_battery_last_timestamp = battery_status.timestamp;
|
||||||
|
|
||||||
|
/* the announced battery status would conflict with the simulated battery status in HIL */
|
||||||
|
if (!(_pub_blocked)) {
|
||||||
/* lazily publish the battery voltage */
|
/* lazily publish the battery voltage */
|
||||||
if (_to_battery > 0) {
|
if (_to_battery > 0) {
|
||||||
orb_publish(ORB_ID(battery_status), _to_battery, &battery_status);
|
orb_publish(ORB_ID(battery_status), _to_battery, &battery_status);
|
||||||
|
@ -1340,6 +1342,7 @@ PX4IO::io_handle_battery(uint16_t vbatt, uint16_t ibatt)
|
||||||
_to_battery = orb_advertise(ORB_ID(battery_status), &battery_status);
|
_to_battery = orb_advertise(ORB_ID(battery_status), &battery_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PX4IO::io_handle_vservo(uint16_t vservo, uint16_t vrssi)
|
PX4IO::io_handle_vservo(uint16_t vservo, uint16_t vrssi)
|
||||||
|
@ -1959,8 +1962,7 @@ PX4IO::print_status()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
PX4IO::ioctl(file * /*filep*/, int cmd, unsigned long arg)
|
PX4IO::ioctl(file * filep, int cmd, unsigned long arg)
|
||||||
/* Make it obvious that file * isn't used here */
|
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
|
@ -2372,8 +2374,9 @@ PX4IO::ioctl(file * /*filep*/, int cmd, unsigned long arg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* not a recognized value */
|
/* see if the parent class can make any use of it */
|
||||||
ret = -ENOTTY;
|
ret = CDev::ioctl(filep, cmd, arg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue