mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 09:03:34 +08:00
px4io: added monitoring of vservo and vrssi
publish via servorail_status ORB topic
This commit is contained in:
committed by
Lorenz Meier
parent
f12794d30e
commit
e9e46f9c9d
@@ -678,27 +678,25 @@ registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_val
|
||||
#ifdef ADC_VSERVO
|
||||
/* PX4IO_P_STATUS_VSERVO */
|
||||
{
|
||||
/*
|
||||
* Coefficients here derived by measurement of the 5-16V
|
||||
* range on one unit:
|
||||
*
|
||||
* XXX pending measurements
|
||||
*
|
||||
* slope = xxx
|
||||
* intercept = xxx
|
||||
*
|
||||
* Intercept corrected for best results @ 5.0V.
|
||||
*/
|
||||
unsigned counts = adc_measure(ADC_VSERVO);
|
||||
if (counts != 0xffff) {
|
||||
unsigned mV = (4150 + (counts * 46)) / 10 - 200;
|
||||
unsigned corrected = (mV * r_page_setup[PX4IO_P_SETUP_VSERVO_SCALE]) / 10000;
|
||||
|
||||
r_page_status[PX4IO_P_STATUS_VSERVO] = corrected;
|
||||
// use 3:1 scaling on 3.3V ADC input
|
||||
unsigned mV = counts * 9900 / 4096;
|
||||
r_page_status[PX4IO_P_STATUS_VSERVO] = mV;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef ADC_RSSI
|
||||
/* PX4IO_P_STATUS_VRSSI */
|
||||
{
|
||||
unsigned counts = adc_measure(ADC_RSSI);
|
||||
if (counts != 0xffff) {
|
||||
// use 1:1 scaling on 3.3V ADC input
|
||||
unsigned mV = counts * 3300 / 4096;
|
||||
r_page_status[PX4IO_P_STATUS_VRSSI] = mV;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* XXX PX4IO_P_STATUS_VRSSI */
|
||||
/* XXX PX4IO_P_STATUS_PRSSI */
|
||||
|
||||
SELECT_PAGE(r_page_status);
|
||||
|
||||
Reference in New Issue
Block a user