|
|
|
@ -46,11 +46,7 @@
@@ -46,11 +46,7 @@
|
|
|
|
|
VOXLPM::VOXLPM(const char *path, int bus, int address, VOXLPM_CH_TYPE ch_type) : |
|
|
|
|
I2C("voxlpm", path, bus, address, 400000), |
|
|
|
|
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(I2C::get_device_id())), |
|
|
|
|
_sample_perf(perf_alloc(PC_ELAPSED, "voxlpm: sample")), |
|
|
|
|
_bat_pub_topic(nullptr), |
|
|
|
|
_pm_pub_topic(nullptr), |
|
|
|
|
_voltage(0.0f), |
|
|
|
|
_amperage(0.0f) |
|
|
|
|
_sample_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": sample")) |
|
|
|
|
{ |
|
|
|
|
_ch_type = ch_type; |
|
|
|
|
|
|
|
|
@ -159,12 +155,7 @@ VOXLPM::measure()
@@ -159,12 +155,7 @@ VOXLPM::measure()
|
|
|
|
|
case VOXLPM_CH_TYPE_VBATT: { |
|
|
|
|
_battery.updateBatteryStatus(tnow, _voltage, _amperage, true, true, 0, 0, false, &_bat_status); |
|
|
|
|
|
|
|
|
|
if (_bat_pub_topic != nullptr) { |
|
|
|
|
orb_publish(ORB_ID(battery_status), _bat_pub_topic, &_bat_status); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
_bat_pub_topic = orb_advertise(ORB_ID(battery_status), &_bat_status); |
|
|
|
|
} |
|
|
|
|
_bat_pub_topic.publish(_bat_status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// fallthrough
|
|
|
|
@ -176,13 +167,7 @@ VOXLPM::measure()
@@ -176,13 +167,7 @@ VOXLPM::measure()
|
|
|
|
|
_pm_status.current_a = (float) _amperage; |
|
|
|
|
|
|
|
|
|
//_pm_pub_topic.power_w = (float) _power * _power_lsb;
|
|
|
|
|
|
|
|
|
|
if (_pm_pub_topic != nullptr) { |
|
|
|
|
orb_publish(ORB_ID(power_monitor), _pm_pub_topic, &_pm_status); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
_pm_pub_topic = orb_advertise(ORB_ID(power_monitor), &_pm_status); |
|
|
|
|
} |
|
|
|
|
_pm_pub_topic.publish(_pm_status); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
@ -193,12 +178,7 @@ VOXLPM::measure()
@@ -193,12 +178,7 @@ VOXLPM::measure()
|
|
|
|
|
case VOXLPM_CH_TYPE_VBATT: { |
|
|
|
|
_battery.updateBatteryStatus(tnow, 0.0, 0.0, true, true, 0, 0, false, &_bat_status); |
|
|
|
|
|
|
|
|
|
if (_bat_pub_topic != nullptr) { |
|
|
|
|
orb_publish(ORB_ID(battery_status), _bat_pub_topic, &_bat_status); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
_bat_pub_topic = orb_advertise(ORB_ID(battery_status), &_bat_status); |
|
|
|
|
} |
|
|
|
|
_bat_pub_topic.publish(_bat_status); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|