Merge pull request #1420 from openmv/py_sensor_reset

Use sensor_strerror for sensor_reset error.
This commit is contained in:
Ibrahim Abd Elkader 2021-07-31 22:22:40 +02:00 committed by GitHub
commit f1021d9e26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,10 @@ static mp_obj_t py_sensor__init__()
static mp_obj_t py_sensor_reset()
{
PY_ASSERT_FALSE_MSG(sensor_reset() != 0, "Reset Failed");
int ret = sensor_reset();
if (ret != 0) {
mp_raise_msg(&mp_type_RuntimeError, sensor_strerror(ret));
}
#if MICROPY_PY_IMU
// +-10 degree dead-zone around pitch 90/270.
// +-45 degree active-zone around roll 0/90/180/270/360.