Skip to content
Snippets Groups Projects
Commit e2557f81 authored by swym's avatar swym Committed by rahix
Browse files

feat(epicardium): Improve error logging

parent 0a535cf0
No related branches found
No related tags found
No related merge requests found
......@@ -25,13 +25,25 @@ int hwlock_acquire(enum hwlock_periph p, TickType_t wait)
if (p >= _HWLOCK_MAX) {
return -EINVAL;
}
TaskHandle_t task = xTaskGetCurrentTaskHandle();
if (xSemaphoreTake(hwlock_mutex[p], wait) != pdTRUE) {
LOG_WARN("hwlock", "Lock %u is busy.", p);
LOG_WARN(
"hwlock",
"Lock %u is busy, held by: %s, attempt to accquire by: %s",
p,
pcTaskGetName(hwlock_tasks[p]),
pcTaskGetName(task)
);
LOG_DEBUG(
"hwlock",
"...attempted to lock from pc %p",
__builtin_return_address(0)
);
return -EBUSY;
}
hwlock_tasks[p] = xTaskGetCurrentTaskHandle();
hwlock_tasks[p] = task;
return 0;
}
......
......@@ -16,6 +16,7 @@
#include "timers.h"
#include <stdio.h>
#include <string.h>
/* Task ID for the pmic handler */
static TaskHandle_t pmic_task_id = NULL;
......@@ -207,7 +208,10 @@ static void pmic_check_battery()
res = pmic_read_amux(PMIC_AMUX_BATT_U, &u_batt);
if (res < 0) {
LOG_ERR("pmic", "Failed reading battery voltage: %d", res);
LOG_ERR("pmic",
"Failed reading battery voltage: %s (%d)",
strerror(-res),
res);
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