mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 00:41:35 +08:00
mixer_multirotor: fix initialization of _outputs_prev
memset (http://www.cplusplus.com/reference/cstring/memset/) interprets the value argument as unsigned char, so passing a float will not work.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2016 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2018 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -76,7 +76,9 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb,
|
|||||||
_rotors(_config_index[(MultirotorGeometryUnderlyingType)geometry]),
|
_rotors(_config_index[(MultirotorGeometryUnderlyingType)geometry]),
|
||||||
_outputs_prev(new float[_rotor_count])
|
_outputs_prev(new float[_rotor_count])
|
||||||
{
|
{
|
||||||
memset(_outputs_prev, _idle_speed, _rotor_count * sizeof(float));
|
for (unsigned i = 0; i < _rotor_count; ++i) {
|
||||||
|
_outputs_prev[i] = _idle_speed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MultirotorMixer::~MultirotorMixer()
|
MultirotorMixer::~MultirotorMixer()
|
||||||
|
|||||||
Reference in New Issue
Block a user