forked from Archive/PX4-Autopilot
Merge branch 'multirotor'
This commit is contained in:
commit
94d678098c
|
@ -890,13 +890,14 @@ int sdlog2_thread_main(int argc, char *argv[])
|
|||
if (fds[ifds++].revents & POLLIN) {
|
||||
// Don't orb_copy, it's already done few lines above
|
||||
log_msg.msg_type = LOG_STAT_MSG;
|
||||
log_msg.body.log_STAT.main_state = (unsigned char) buf_status.main_state;
|
||||
log_msg.body.log_STAT.navigation_state = (unsigned char) buf_status.navigation_state;
|
||||
log_msg.body.log_STAT.arming_state = (unsigned char) buf_status.arming_state;
|
||||
log_msg.body.log_STAT.main_state = (uint8_t) buf_status.main_state;
|
||||
log_msg.body.log_STAT.navigation_state = (uint8_t) buf_status.navigation_state;
|
||||
log_msg.body.log_STAT.arming_state = (uint8_t) buf_status.arming_state;
|
||||
log_msg.body.log_STAT.battery_voltage = buf_status.battery_voltage;
|
||||
log_msg.body.log_STAT.battery_current = buf_status.battery_current;
|
||||
log_msg.body.log_STAT.battery_remaining = buf_status.battery_remaining;
|
||||
log_msg.body.log_STAT.battery_warning = (unsigned char) buf_status.battery_warning;
|
||||
log_msg.body.log_STAT.battery_warning = (uint8_t) buf_status.battery_warning;
|
||||
log_msg.body.log_STAT.landed = (uint8_t) buf_status.condition_landed;
|
||||
LOGBUFFER_WRITE_AND_COUNT(STAT);
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ struct log_STAT_s {
|
|||
float battery_current;
|
||||
float battery_remaining;
|
||||
uint8_t battery_warning;
|
||||
uint8_t landed;
|
||||
};
|
||||
|
||||
/* --- RC - RC INPUT CHANNELS --- */
|
||||
|
@ -263,7 +264,7 @@ static const struct log_format_s log_formats[] = {
|
|||
LOG_FORMAT(LPSP, "ffff", "X,Y,Z,Yaw"),
|
||||
LOG_FORMAT(GPS, "QBffLLfffff", "GPSTime,FixType,EPH,EPV,Lat,Lon,Alt,VelN,VelE,VelD,Cog"),
|
||||
LOG_FORMAT(ATTC, "ffff", "Roll,Pitch,Yaw,Thrust"),
|
||||
LOG_FORMAT(STAT, "BBBfffB", "MainState,NavState,ArmState,BatV,BatC,BatRem,BatWarn"),
|
||||
LOG_FORMAT(STAT, "BBBfffBB", "MainState,NavState,ArmState,BatV,BatC,BatRem,BatWarn,Landed"),
|
||||
LOG_FORMAT(RC, "ffffffff", "Ch0,Ch1,Ch2,Ch3,Ch4,Ch5,Ch6,Ch7"),
|
||||
LOG_FORMAT(OUT0, "ffffffff", "Out0,Out1,Out2,Out3,Out4,Out5,Out6,Out7"),
|
||||
LOG_FORMAT(AIRS, "ff", "IndSpeed,TrueSpeed"),
|
||||
|
|
|
@ -158,6 +158,13 @@ PARAM_DEFINE_FLOAT(RC14_MAX, 2000);
|
|||
PARAM_DEFINE_FLOAT(RC14_REV, 1.0f);
|
||||
PARAM_DEFINE_FLOAT(RC14_DZ, 0.0f);
|
||||
|
||||
PARAM_DEFINE_FLOAT(RC15_MIN, 1000);
|
||||
PARAM_DEFINE_FLOAT(RC15_TRIM, 1500);
|
||||
PARAM_DEFINE_FLOAT(RC15_MAX, 2000);
|
||||
PARAM_DEFINE_FLOAT(RC15_REV, 1.0f);
|
||||
PARAM_DEFINE_FLOAT(RC15_DZ, 0.0f);
|
||||
|
||||
|
||||
PARAM_DEFINE_INT32(RC_RL1_DSM_VCC, 0); /* Relay 1 controls DSM VCC */
|
||||
PARAM_DEFINE_INT32(RC_DSM_BIND, 0); /* 0 = Idle, 1 = Start DSM2 bind, 2 = Start DSMX bind */
|
||||
|
||||
|
|
|
@ -660,6 +660,8 @@ int
|
|||
Sensors::parameters_update()
|
||||
{
|
||||
bool rc_valid = true;
|
||||
float tmpScaleFactor = 0.0f;
|
||||
float tmpRevFactor = 0.0f;
|
||||
|
||||
/* rc values */
|
||||
for (unsigned int i = 0; i < RC_CHANNELS_MAX; i++) {
|
||||
|
@ -670,18 +672,21 @@ Sensors::parameters_update()
|
|||
param_get(_parameter_handles.rev[i], &(_parameters.rev[i]));
|
||||
param_get(_parameter_handles.dz[i], &(_parameters.dz[i]));
|
||||
|
||||
_parameters.scaling_factor[i] = (1.0f / ((_parameters.max[i] - _parameters.min[i]) / 2.0f) * _parameters.rev[i]);
|
||||
tmpScaleFactor = (1.0f / ((_parameters.max[i] - _parameters.min[i]) / 2.0f) * _parameters.rev[i]);
|
||||
tmpRevFactor = tmpScaleFactor * _parameters.rev[i];
|
||||
|
||||
/* handle blowup in the scaling factor calculation */
|
||||
if (!isfinite(_parameters.scaling_factor[i]) ||
|
||||
_parameters.scaling_factor[i] * _parameters.rev[i] < 0.000001f ||
|
||||
_parameters.scaling_factor[i] * _parameters.rev[i] > 0.2f) {
|
||||
warnx("RC chan %u not sane, scaling: %8.6f, rev: %d", i, _parameters.scaling_factor[i], (int)(_parameters.rev[i]));
|
||||
if (!isfinite(tmpScaleFactor) ||
|
||||
(tmpRevFactor < 0.000001f) ||
|
||||
(tmpRevFactor > 0.2f) ) {
|
||||
warnx("RC chan %u not sane, scaling: %8.6f, rev: %d", i, tmpScaleFactor, (int)(_parameters.rev[i]));
|
||||
/* scaling factors do not make sense, lock them down */
|
||||
_parameters.scaling_factor[i] = 0;
|
||||
_parameters.scaling_factor[i] = 0.0f;
|
||||
rc_valid = false;
|
||||
}
|
||||
|
||||
else {
|
||||
_parameters.scaling_factor[i] = tmpScaleFactor;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle wrong values */
|
||||
|
|
Loading…
Reference in New Issue