mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 10:50:34 +08:00
dshot: reduce static buffer size
And handle failures of up_dshot_init(). On Omnibus: reduces memory usage if dshot is enabled by ~1.0KB. The buffer is roughly 1KB in size.
This commit is contained in:
@@ -531,11 +531,20 @@ DShotOutput::update_dshot_out_state(bool on)
|
||||
break;
|
||||
}
|
||||
|
||||
up_dshot_init(_output_mask, dshot_frequency);
|
||||
int ret = up_dshot_init(_output_mask, dshot_frequency);
|
||||
|
||||
if (ret != 0) {
|
||||
PX4_ERR("up_dshot_init failed (%i)", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
_outputs_initialized = true;
|
||||
}
|
||||
|
||||
up_dshot_arm(on);
|
||||
if (_outputs_initialized) {
|
||||
up_dshot_arm(on);
|
||||
_outputs_on = on;
|
||||
}
|
||||
}
|
||||
|
||||
void DShotOutput::updateTelemetryNumMotors()
|
||||
@@ -747,7 +756,6 @@ DShotOutput::Run()
|
||||
bool outputs_on = _mixing_output.armed().armed || _mixing_output.mixers();
|
||||
|
||||
if (_outputs_on != outputs_on) {
|
||||
_outputs_on = outputs_on;
|
||||
update_dshot_out_state(outputs_on);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user