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

@ -80,8 +80,14 @@ static PyObject *py_start_channel(PyObject *self, PyObject *args, PyObject *kwar
return NULL;
}
if (!softpwm_start(key, duty_cycle, frequency, polarity))
return NULL;
if (softpwm_start(key, duty_cycle, frequency, polarity) < 0)
{
printf("softpwm_start failed");
char err[2000];
snprintf(err, sizeof(err), "Error starting softpwm on pin %s (%s)", key, get_error_msg());
PyErr_SetString(PyExc_RuntimeError, err);
return NULL;
}
Py_RETURN_NONE;
}