Queue wait time

This commit is contained in:
Klaus K Wilting 2018-08-08 00:05:38 +02:00
parent 0e6b6fb025
commit 5fbcd0aebb

View File

@ -1,7 +1,7 @@
// Basic Config
#include "globals.h"
MessageBuffer_t SendBuffer;
MessageBuffer_t SendBuffer;
// put data to send in RTos Queues used for transmit over channels Lora and SPI
void SendData(uint8_t port) {
@ -14,13 +14,13 @@ void SendData(uint8_t port) {
// enqueue message in LoRa send queue
#ifdef HAS_LORA
if (xQueueSendToBack(LoraSendQueue, (void *)&SendBuffer, (TickType_t)0))
if (xQueueSendToBack(LoraSendQueue, (void *)&SendBuffer, (TickType_t)0) == pdTRUE)
ESP_LOGI(TAG, "%d bytes enqueued to send on LoRa", payload.getSize());
#endif
// enqueue message in SPI send queue
#ifdef HAS_SPI
if (xQueueSendToBack(SPISendQueue, (void *)&SendBuffer, (TickType_t)0))
if (xQueueSendToBack(SPISendQueue, (void *)&SendBuffer, (TickType_t)0) == pdTRUE)
ESP_LOGI(TAG, "%d bytes enqueued to send on SPI", payload.getSize());
#endif
@ -82,10 +82,10 @@ void processSendBuffer() {
if ((LMIC.opmode & (OP_JOINING | OP_REJOIN | OP_TXDATA | OP_POLL)) != 0) {
// LoRa Busy -> don't eat data from queue, since it cannot be sent
} else {
if (xQueueReceive(LoraSendQueue, &(SendBuffer), (TickType_t)10)) {
// SendBuffer now holds the struct MessageBuffer with next payload from queue
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize,
(cfg.countermode & 0x02));
if (xQueueReceive(LoraSendQueue, &(SendBuffer), (TickType_t)0) == pdTRUE) {
// SendBuffer gets struct MessageBuffer with next payload from queue
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message,
SendBuffer.MessageSize, (cfg.countermode & 0x02));
ESP_LOGI(TAG, "%d bytes sent to LORA", SendBuffer.MessageSize);
sprintf(display_line7, "PACKET QUEUED");
}
@ -93,7 +93,7 @@ void processSendBuffer() {
#endif
#ifdef HAS_SPI
if (xQueueReceive(SPISendQueue, &(SendBuffer), (TickType_t)10)) {
if (xQueueReceive(SPISendQueue, &(SendBuffer), (TickType_t)0) == pdTRUE) {
ESP_LOGI(TAG, "%d bytes sent to SPI", SendBuffer.MessageSize);
}
#endif