mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Frsky_Telem: add second battery capacity parameter
This commit is contained in:
parent
191e457230
commit
5d9299d72f
@ -567,7 +567,7 @@ uint32_t AP_Frsky_Telem::calc_param(void)
|
||||
uint32_t param = 0;
|
||||
|
||||
// cycle through paramIDs
|
||||
if (_paramID >= 4) {
|
||||
if (_paramID >= 5) {
|
||||
_paramID = 0;
|
||||
}
|
||||
_paramID++;
|
||||
@ -586,11 +586,14 @@ uint32_t AP_Frsky_Telem::calc_param(void)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
param = (uint32_t)roundf(_battery.pack_capacity_mah()); // battery pack capacity in mAh as configured by user
|
||||
param = (uint32_t)roundf(_battery.pack_capacity_mah(0)); // battery pack capacity in mAh
|
||||
break;
|
||||
case 5:
|
||||
param = (uint32_t)roundf(_battery.pack_capacity_mah(1)); // battery pack capacity in mAh
|
||||
break;
|
||||
}
|
||||
//Reserve first 8 bits for param ID, use other 24 bits to store parameter value
|
||||
param = (_paramID << 24) | (param & 0xFFFFFF);
|
||||
param = (_paramID << PARAM_ID_OFFSET) | (param & PARAM_VALUE_LIMIT);
|
||||
|
||||
return param;
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ for FrSky SPort and SPort Passthrough (OpenTX) protocols (X-receivers)
|
||||
for FrSky SPort Passthrough
|
||||
*/
|
||||
// data bits preparation
|
||||
// for parameter data
|
||||
#define PARAM_ID_OFFSET 24
|
||||
#define PARAM_VALUE_LIMIT 0xFFFFFF
|
||||
// for gps status data
|
||||
#define GPS_SATS_LIMIT 0xF
|
||||
#define GPS_STATUS_LIMIT 0x3
|
||||
|
Loading…
Reference in New Issue
Block a user