1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 04:43:21 +00:00

Adds runtime err if softpwm fails for Issue #16

This commit is contained in:
Brady L. Hurlburt
2016-07-28 12:49:28 +00:00
parent 40ae9a5cdc
commit 1e3e801e60
2 changed files with 14 additions and 4 deletions

View File

@ -241,8 +241,12 @@ int softpwm_start(const char *key, float duty, float freq, int polarity)
if (get_gpio_number(key, &gpio) < 0)
return -1;
if (gpio_export(gpio) < 0)
return -1;
if (gpio_export(gpio) < 0) {
char err[2000];
snprintf(err, sizeof(err), "Error setting up softpwm on pin %d, maybe already exported? (%s)", gpio, get_error_msg());
add_error_msg(err);
return -1;
}
if (gpio_set_direction(gpio, OUTPUT) < 0)
return -1;