projects
/
apps
/
native
/
gear-racing-car.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code fixes. Some logs added
[apps/native/gear-racing-car.git]
/
src
/
resource
/
resource_motor_driver_L298N.c
diff --git
a/src/resource/resource_motor_driver_L298N.c
b/src/resource/resource_motor_driver_L298N.c
index
972a9ac
..
6d434dc
100644
(file)
--- a/
src/resource/resource_motor_driver_L298N.c
+++ b/
src/resource/resource_motor_driver_L298N.c
@@
-95,6
+95,8
@@
static int __motor_brake_n_stop_by_id(motor_id_e id)
static int __set_default_configuration_by_id(motor_id_e id)
{
static int __set_default_configuration_by_id(motor_id_e id)
{
+ FUNCTION_START;
+
unsigned int pin_1, pin_2, en_ch;
switch (id) {
unsigned int pin_1, pin_2, en_ch;
switch (id) {
@@
-130,6
+132,7
@@
static int __set_default_configuration_by_id(motor_id_e id)
g_md_h[id].en_ch = en_ch;
g_md_h[id].motor_state = MOTOR_STATE_CONFIGURED;
g_md_h[id].en_ch = en_ch;
g_md_h[id].motor_state = MOTOR_STATE_CONFIGURED;
+ FUNCTION_END;
return 0;
}
return 0;
}
@@
-181,7
+184,7
@@
static int __init_motor_by_id(motor_id_e id)
peripheral_gpio_set_direction(g_md_h[id].pin1_h,
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
else {
peripheral_gpio_set_direction(g_md_h[id].pin1_h,
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
else {
- _E("failed to open Motor[%d] gpio pin1[%u]
", id, g_md_h[id].pin_1
);
+ _E("failed to open Motor[%d] gpio pin1[%u]
. Error: %s", id, g_md_h[id].pin_1, get_error_message(ret)
);
goto ERROR;
}
goto ERROR;
}
@@
-190,7
+193,7
@@
static int __init_motor_by_id(motor_id_e id)
peripheral_gpio_set_direction(g_md_h[id].pin2_h,
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
else {
peripheral_gpio_set_direction(g_md_h[id].pin2_h,
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW);
else {
- _E("failed to open Motor[%d] gpio pin2[%u]
", id, g_md_h[id].pin_2
);
+ _E("failed to open Motor[%d] gpio pin2[%u]
. Error: %s", id, g_md_h[id].pin_2, get_error_message(ret)
);
goto ERROR;
}
goto ERROR;
}
@@
-201,6
+204,8
@@
static int __init_motor_by_id(motor_id_e id)
ERROR:
resource_pca9685_fini(g_md_h[id].en_ch);
ERROR:
resource_pca9685_fini(g_md_h[id].en_ch);
+ _E("Motor init error: %s", get_error_message(ret));
+
if (g_md_h[id].pin1_h) {
peripheral_gpio_close(g_md_h[id].pin1_h);
g_md_h[id].pin1_h = NULL;
if (g_md_h[id].pin1_h) {
peripheral_gpio_close(g_md_h[id].pin1_h);
g_md_h[id].pin1_h = NULL;