Queue wait time
This commit is contained in:
parent
0e6b6fb025
commit
5fbcd0aebb
@ -14,13 +14,13 @@ void SendData(uint8_t port) {
|
|||||||
|
|
||||||
// enqueue message in LoRa send queue
|
// enqueue message in LoRa send queue
|
||||||
#ifdef HAS_LORA
|
#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());
|
ESP_LOGI(TAG, "%d bytes enqueued to send on LoRa", payload.getSize());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// enqueue message in SPI send queue
|
// enqueue message in SPI send queue
|
||||||
#ifdef HAS_SPI
|
#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());
|
ESP_LOGI(TAG, "%d bytes enqueued to send on SPI", payload.getSize());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -82,10 +82,10 @@ void processSendBuffer() {
|
|||||||
if ((LMIC.opmode & (OP_JOINING | OP_REJOIN | OP_TXDATA | OP_POLL)) != 0) {
|
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
|
// LoRa Busy -> don't eat data from queue, since it cannot be sent
|
||||||
} else {
|
} else {
|
||||||
if (xQueueReceive(LoraSendQueue, &(SendBuffer), (TickType_t)10)) {
|
if (xQueueReceive(LoraSendQueue, &(SendBuffer), (TickType_t)0) == pdTRUE) {
|
||||||
// SendBuffer now holds the struct MessageBuffer with next payload from queue
|
// SendBuffer gets struct MessageBuffer with next payload from queue
|
||||||
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize,
|
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message,
|
||||||
(cfg.countermode & 0x02));
|
SendBuffer.MessageSize, (cfg.countermode & 0x02));
|
||||||
ESP_LOGI(TAG, "%d bytes sent to LORA", SendBuffer.MessageSize);
|
ESP_LOGI(TAG, "%d bytes sent to LORA", SendBuffer.MessageSize);
|
||||||
sprintf(display_line7, "PACKET QUEUED");
|
sprintf(display_line7, "PACKET QUEUED");
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ void processSendBuffer() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SPI
|
#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);
|
ESP_LOGI(TAG, "%d bytes sent to SPI", SendBuffer.MessageSize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user