summaryrefslogtreecommitdiff
path: root/code/esp32/components
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2019-10-13 05:21:28 +0200
committerUros Majstorovic <majstor@majstor.org>2019-10-13 05:21:28 +0200
commitca2d9002fcbebcf37f48944dd8d67e90c186ce4f (patch)
tree603660613302d30afca3687323c53f4434c36126 /code/esp32/components
parent8c6c68e92d6b4c8aa5e2fcc784ed52da40845acc (diff)
fixed msgq bug
Diffstat (limited to 'code/esp32/components')
-rw-r--r--code/esp32/components/eos/msgq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/code/esp32/components/eos/msgq.c b/code/esp32/components/eos/msgq.c
index ec89efe..0160bf5 100644
--- a/code/esp32/components/eos/msgq.c
+++ b/code/esp32/components/eos/msgq.c
@@ -4,7 +4,7 @@
#include "eos.h"
#include "msgq.h"
-#define EOS_MSGQ_IDX_MASK(IDX, SIZE) ((IDX) & ((SIZE) - 1))
+#define EOS_MSGQ_IDX_MASK(IDX, SIZE) ((IDX) & ((SIZE) - 1))
void eos_msgq_init(EOSMsgQ *msgq, EOSMsgItem *array, uint8_t size) {
msgq->idx_r = 0;
@@ -14,7 +14,7 @@ void eos_msgq_init(EOSMsgQ *msgq, EOSMsgItem *array, uint8_t size) {
}
int eos_msgq_push(EOSMsgQ *msgq, unsigned char cmd, unsigned char *buffer, uint16_t len) {
- if (msgq->idx_w - msgq->idx_r == msgq->size) return EOS_ERR_Q_FULL;
+ if ((uint8_t)(msgq->idx_w - msgq->idx_r) == msgq->size) return EOS_ERR_Q_FULL;
uint8_t idx = EOS_MSGQ_IDX_MASK(msgq->idx_w, msgq->size);
msgq->array[idx].cmd = cmd;