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:
Beat Küng
2019-09-07 14:23:32 +02:00
parent e78250ab8d
commit 182efaa757
12 changed files with 91 additions and 34 deletions
+11 -3
View File
@@ -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);
}