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:
Beat Küng
2018-04-23 15:41:03 +02:00
committed by Lorenz Meier
parent 4ef3d258eb
commit 202505fd73
+4 -2
View File
@@ -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
* modification, are permitted provided that the following conditions
@@ -76,7 +76,9 @@ MultirotorMixer::MultirotorMixer(ControlCallback control_cb,
_rotors(_config_index[(MultirotorGeometryUnderlyingType)geometry]),
_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()