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

fix linux_pwm_out: return correct value for PCA9685::init()

parent 7a409cf8
No related branches found
No related tags found
No related merge requests found
......@@ -82,7 +82,7 @@ public:
*/
PCA9685(int bus, int address);
int init() override { return _fd >= 0; }
int init() override { return _fd >= 0 ? 0 : -1; }
int send_output_pwm(const uint16_t *pwm, int num_outputs) override;
......
......@@ -217,13 +217,7 @@ void task_main(int argc, char *argv[])
pwm_out = new NavioSysfsPWMOut(_device, _max_num_outputs);
}
/**
* if the _protocol is "pca9685" and the driver is executed correctly,
* the return value of "pwm_out->init()" will be higher than 0.
*/
bool check_pwm_device = (strcmp(_protocol, "pca9685") == 0) ? (0 > pwm_out->init()) : (pwm_out->init() != 0);
if (check_pwm_device) {
if (pwm_out->init() != 0) {
PX4_ERR("PWM output init failed");
delete pwm_out;
return;
......
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