Link check validation disabled after join
This commit is contained in:
parent
63a063f9bc
commit
af62c8fb11
@ -8,7 +8,7 @@
|
|||||||
#include <esp32-hal-log.h>
|
#include <esp32-hal-log.h>
|
||||||
|
|
||||||
// attn: increment version after modifications to configData_t truct!
|
// attn: increment version after modifications to configData_t truct!
|
||||||
#define PROGVERSION "1.4.2" // use max 10 chars here!
|
#define PROGVERSION "1.4.21" // use max 10 chars here!
|
||||||
#define PROGNAME "PAXCNT"
|
#define PROGNAME "PAXCNT"
|
||||||
|
|
||||||
// std::set for unified array functions
|
// std::set for unified array functions
|
||||||
|
@ -172,8 +172,13 @@ void onEvent(ev_t ev) {
|
|||||||
strcpy_P(buff, PSTR("JOINED"));
|
strcpy_P(buff, PSTR("JOINED"));
|
||||||
sprintf(display_line6, " "); // clear previous lmic status
|
sprintf(display_line6, " "); // clear previous lmic status
|
||||||
|
|
||||||
// set data rate adaptation
|
// set cyclic lmic link check to off because is not supported by ttn
|
||||||
|
// (but enabled by lmic after join)
|
||||||
|
LMIC_setLinkCheckMode(0);
|
||||||
|
|
||||||
|
// set data rate adaptation according to saved setting
|
||||||
LMIC_setAdrMode(cfg.adrmode);
|
LMIC_setAdrMode(cfg.adrmode);
|
||||||
|
|
||||||
// Set data rate and transmit power (note: txpower seems to be ignored by
|
// Set data rate and transmit power (note: txpower seems to be ignored by
|
||||||
// the library)
|
// the library)
|
||||||
switch_lora(cfg.lorasf, cfg.txpower);
|
switch_lora(cfg.lorasf, cfg.txpower);
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
// Basic Config
|
// Basic Config
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
|
MessageBuffer_t SendBuffer;
|
||||||
|
|
||||||
// put data to send in RTos Queues used for transmit over channels Lora and SPI
|
// put data to send in RTos Queues used for transmit over channels Lora and SPI
|
||||||
void SendData(uint8_t port) {
|
void SendData(uint8_t port) {
|
||||||
|
|
||||||
MessageBuffer_t MySendBuffer;
|
SendBuffer.MessageSize = payload.getSize();
|
||||||
|
SendBuffer.MessagePort = PAYLOAD_ENCODER <= 2
|
||||||
MySendBuffer.MessageSize = payload.getSize();
|
|
||||||
MySendBuffer.MessagePort = PAYLOAD_ENCODER <= 2
|
|
||||||
? port
|
? port
|
||||||
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
|
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
|
||||||
memcpy(MySendBuffer.Message, payload.getBuffer(), payload.getSize());
|
memcpy(SendBuffer.Message, payload.getBuffer(), payload.getSize());
|
||||||
|
|
||||||
// enqueue message in LoRa send queue
|
// enqueue message in LoRa send queue
|
||||||
#ifdef HAS_LORA
|
#ifdef HAS_LORA
|
||||||
if (xQueueSendToBack(LoraSendQueue, (void *)&MySendBuffer, (TickType_t)0))
|
if (xQueueSendToBack(LoraSendQueue, (void *)&SendBuffer, (TickType_t)0))
|
||||||
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 *)&MySendBuffer, (TickType_t)0))
|
if (xQueueSendToBack(SPISendQueue, (void *)&SendBuffer, (TickType_t)0))
|
||||||
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
|
||||||
|
|
||||||
@ -77,26 +77,24 @@ void IRAM_ATTR SendCycleIRQ() {
|
|||||||
// cyclic called function to eat data from RTos send queues and transmit it
|
// cyclic called function to eat data from RTos send queues and transmit it
|
||||||
void processSendBuffer() {
|
void processSendBuffer() {
|
||||||
|
|
||||||
MessageBuffer_t RcvBuf;
|
|
||||||
|
|
||||||
#ifdef HAS_LORA
|
#ifdef HAS_LORA
|
||||||
// Check if there is a pending TX/RX job running
|
// Check if there is a pending TX/RX job running
|
||||||
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, &(RcvBuf), (TickType_t)10)) {
|
if (xQueueReceive(LoraSendQueue, &(SendBuffer), (TickType_t)10)) {
|
||||||
// xMsg now holds the struct MessageBuffer from queue
|
// SendBuffer now holds the struct MessageBuffer with next payload from queue
|
||||||
LMIC_setTxData2(RcvBuf.MessagePort, RcvBuf.Message, RcvBuf.MessageSize,
|
LMIC_setTxData2(SendBuffer.MessagePort, SendBuffer.Message, SendBuffer.MessageSize,
|
||||||
(cfg.countermode & 0x02));
|
(cfg.countermode & 0x02));
|
||||||
ESP_LOGI(TAG, "%d bytes sent to LORA", RcvBuf.MessageSize);
|
ESP_LOGI(TAG, "%d bytes sent to LORA", SendBuffer.MessageSize);
|
||||||
sprintf(display_line7, "PACKET QUEUED");
|
sprintf(display_line7, "PACKET QUEUED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
if (xQueueReceive(SPISendQueue, &(RcvBuf), (TickType_t)10)) {
|
if (xQueueReceive(SPISendQueue, &(SendBuffer), (TickType_t)10)) {
|
||||||
ESP_LOGI(TAG, "%d bytes sent to SPI", RcvBuf.MessageSize);
|
ESP_LOGI(TAG, "%d bytes sent to SPI", SendBuffer.MessageSize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user