Skip to content
Snippets Groups Projects
Commit 202505fd authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

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.
parent 4ef3d258
No related branches found
No related tags found
No related merge requests found
/****************************************************************************
*
* 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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment