Skip to content

Commit

Permalink
system/arduino/esp32 bugfixes & warnings
Browse files Browse the repository at this point in the history
- [BUG] fixed function typo for condvar from 'free' to 'drop' - this was breaking ring buffers on this platform
- [WARN] added missing <esp_random.h> include header for z_random() calls
- [WARN] explicit cast to (TaskHandle_t*) for FreeRTOS task creation
  • Loading branch information
S3ckShUn21 committed Sep 26, 2024
1 parent 826c8f7 commit e06534d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/system/arduino/esp32/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <Arduino.h>
#include <esp_heap_caps.h>
#include <esp_random.h>
#include <stddef.h>
#include <sys/time.h>

Expand Down Expand Up @@ -70,7 +71,7 @@ z_result_t _z_task_init(_z_task_t *task, z_task_attr_t *attr, void *(*fun)(void
if (z_arg != NULL) {
z_arg->_fun = fun;
z_arg->_arg = arg;
if (xTaskCreate((void *)z_task_wrapper, "", 5120, z_arg, configMAX_PRIORITIES / 2, task) != pdPASS) {
if (xTaskCreate((void *)z_task_wrapper, "", 5120, z_arg, configMAX_PRIORITIES / 2, (TaskHandle_t*)task) != pdPASS) {
ret = -1;
}
} else {
Expand Down Expand Up @@ -110,7 +111,7 @@ z_result_t _z_mutex_unlock(_z_mutex_t *m) { _Z_CHECK_SYS_ERR(pthread_mutex_unloc
/*------------------ Condvar ------------------*/
z_result_t _z_condvar_init(_z_condvar_t *cv) { _Z_CHECK_SYS_ERR(pthread_cond_init(cv, NULL)); }

z_result_t _z_condvar_free(_z_condvar_t *cv) { _Z_CHECK_SYS_ERR(pthread_cond_destroy(cv)); }
z_result_t _z_condvar_drop(_z_condvar_t *cv) { _Z_CHECK_SYS_ERR(pthread_cond_destroy(cv)); }

z_result_t _z_condvar_signal(_z_condvar_t *cv) { _Z_CHECK_SYS_ERR(pthread_cond_signal(cv)); }

Expand Down

0 comments on commit e06534d

Please sign in to comment.