Send Queues (testing)
This commit is contained in:
parent
7b35c6a539
commit
03ca7d4a37
@ -6,6 +6,7 @@
|
|||||||
<img src="img/Paxcounter-title.jpg">
|
<img src="img/Paxcounter-title.jpg">
|
||||||
<img src="img/Paxcounter-ttgo.jpg">
|
<img src="img/Paxcounter-ttgo.jpg">
|
||||||
<img src="img/Paxcounter-lolin.gif">
|
<img src="img/Paxcounter-lolin.gif">
|
||||||
|
<img src="img/Paxcounter-Screen.png">
|
||||||
|
|
||||||
# Use case
|
# Use case
|
||||||
|
|
||||||
|
BIN
img/Paxcounter-Screen.png
Normal file
BIN
img/Paxcounter-Screen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
@ -12,11 +12,11 @@
|
|||||||
; ---> SELECT TARGET PLATFORM HERE! <---
|
; ---> SELECT TARGET PLATFORM HERE! <---
|
||||||
[platformio]
|
[platformio]
|
||||||
;env_default = test
|
;env_default = test
|
||||||
env_default = generic
|
;env_default = generic
|
||||||
;env_default = heltec
|
;env_default = heltec
|
||||||
;env_default = ttgov1
|
;env_default = ttgov1
|
||||||
;env_default = ttgov2
|
;env_default = ttgov2
|
||||||
;env_default = ttgov21
|
env_default = ttgov21
|
||||||
;env_default = ttgobeam
|
;env_default = ttgobeam
|
||||||
;env_default = lopy
|
;env_default = lopy
|
||||||
;env_default = lopy4
|
;env_default = lopy4
|
||||||
|
@ -33,7 +33,7 @@ void doHomework() {
|
|||||||
|
|
||||||
// check free memory
|
// check free memory
|
||||||
if (esp_get_minimum_free_heap_size() <= MEM_LOW) {
|
if (esp_get_minimum_free_heap_size() <= MEM_LOW) {
|
||||||
ESP_LOGW(TAG,
|
ESP_LOGI(TAG,
|
||||||
"Memory full, counter cleared (heap low water mark = %d Bytes / "
|
"Memory full, counter cleared (heap low water mark = %d Bytes / "
|
||||||
"free heap = %d bytes)",
|
"free heap = %d bytes)",
|
||||||
esp_get_minimum_free_heap_size(), ESP.getFreeHeap());
|
esp_get_minimum_free_heap_size(), ESP.getFreeHeap());
|
||||||
|
@ -91,6 +91,9 @@ void init_display(const char *Productname, const char *Version) {
|
|||||||
|
|
||||||
void refreshtheDisplay() {
|
void refreshtheDisplay() {
|
||||||
|
|
||||||
|
uint8_t msgWaiting = 0;
|
||||||
|
char buff[16];
|
||||||
|
|
||||||
// set display on/off according to current device configuration
|
// set display on/off according to current device configuration
|
||||||
if (DisplayState != cfg.screenon) {
|
if (DisplayState != cfg.screenon) {
|
||||||
DisplayState = cfg.screenon;
|
DisplayState = cfg.screenon;
|
||||||
@ -102,7 +105,6 @@ void refreshtheDisplay() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// update counter (lines 0-1)
|
// update counter (lines 0-1)
|
||||||
char buff[16];
|
|
||||||
snprintf(
|
snprintf(
|
||||||
buff, sizeof(buff), "PAX:%-4d",
|
buff, sizeof(buff), "PAX:%-4d",
|
||||||
(int)macs.size()); // convert 16-bit MAC counter to decimal counter value
|
(int)macs.size()); // convert 16-bit MAC counter to decimal counter value
|
||||||
@ -162,11 +164,23 @@ void refreshtheDisplay() {
|
|||||||
#ifdef HAS_LORA
|
#ifdef HAS_LORA
|
||||||
// update LoRa status display (line 6)
|
// update LoRa status display (line 6)
|
||||||
u8x8.setCursor(0, 6);
|
u8x8.setCursor(0, 6);
|
||||||
u8x8.printf("%-16s", display_line6);
|
u8x8.printf("%-14s", display_line6);
|
||||||
|
|
||||||
// update LMiC event display (line 7)
|
// update LMiC event display (line 7)
|
||||||
u8x8.setCursor(0, 7);
|
u8x8.setCursor(0, 7);
|
||||||
u8x8.printf("%-16s", display_line7);
|
u8x8.printf("%-14s", display_line7);
|
||||||
|
|
||||||
|
// update LoRa send queue display (line 7)
|
||||||
|
msgWaiting = uxQueueMessagesWaiting(LoraSendQueue);
|
||||||
|
if (msgWaiting) {
|
||||||
|
sprintf(buff, "%2d", msgWaiting);
|
||||||
|
u8x8.setCursor(14, 7);
|
||||||
|
u8x8.setInverseFont(1);
|
||||||
|
u8x8.printf("%-2s", msgWaiting == SEND_QUEUE_SIZE ? "<>" : buff);
|
||||||
|
u8x8.setInverseFont(0);
|
||||||
|
} else
|
||||||
|
u8x8.print(" "); // clear queue display
|
||||||
|
|
||||||
#endif // HAS_LORA
|
#endif // HAS_LORA
|
||||||
} // refreshDisplay()
|
} // refreshDisplay()
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ extern hw_timer_t *channelSwitch, *sendCycle;
|
|||||||
extern portMUX_TYPE timerMux;
|
extern portMUX_TYPE timerMux;
|
||||||
extern volatile int SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ,
|
extern volatile int SendCycleTimerIRQ, HomeCycleIRQ, DisplayTimerIRQ,
|
||||||
ChannelTimerIRQ, ButtonPressedIRQ;
|
ChannelTimerIRQ, ButtonPressedIRQ;
|
||||||
|
extern QueueHandle_t LoraSendQueue, SPISendQueue;
|
||||||
|
|
||||||
extern std::array<uint64_t, 0xff>::iterator it;
|
extern std::array<uint64_t, 0xff>::iterator it;
|
||||||
extern std::array<uint64_t, 0xff> beacons;
|
extern std::array<uint64_t, 0xff> beacons;
|
||||||
|
@ -100,7 +100,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
|||||||
if (cfg.monitormode) {
|
if (cfg.monitormode) {
|
||||||
beaconID = isBeacon(macConvert(paddr));
|
beaconID = isBeacon(macConvert(paddr));
|
||||||
if (beaconID >= 0) {
|
if (beaconID >= 0) {
|
||||||
ESP_LOGI(TAG, "Beacon ID#d detected", beaconID);
|
ESP_LOGI(TAG, "Beacon ID#%d detected", beaconID);
|
||||||
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
|
#if (HAS_LED != NOT_A_PIN) || defined(HAS_RGB_LED)
|
||||||
blink_LED(COLOR_WHITE, 2000);
|
blink_LED(COLOR_WHITE, 2000);
|
||||||
#endif
|
#endif
|
||||||
|
13
src/main.cpp
13
src/main.cpp
@ -41,9 +41,8 @@ hw_timer_t *channelSwitch = NULL, *displaytimer = NULL, *sendCycle = NULL,
|
|||||||
volatile int ButtonPressedIRQ = 0, ChannelTimerIRQ = 0, SendCycleTimerIRQ = 0,
|
volatile int ButtonPressedIRQ = 0, ChannelTimerIRQ = 0, SendCycleTimerIRQ = 0,
|
||||||
DisplayTimerIRQ = 0, HomeCycleIRQ = 0;
|
DisplayTimerIRQ = 0, HomeCycleIRQ = 0;
|
||||||
|
|
||||||
// send queues
|
// RTos send queues for payload transmit
|
||||||
QueueHandle_t LoraSendQueue, SPISendQueue;
|
QueueHandle_t LoraSendQueue, SPISendQueue;
|
||||||
MessageBuffer_t SendBuffer;
|
|
||||||
|
|
||||||
portMUX_TYPE timerMux =
|
portMUX_TYPE timerMux =
|
||||||
portMUX_INITIALIZER_UNLOCKED; // sync main loop and ISR when modifying IRQ
|
portMUX_INITIALIZER_UNLOCKED; // sync main loop and ISR when modifying IRQ
|
||||||
@ -110,7 +109,9 @@ void setup() {
|
|||||||
|
|
||||||
// initialize send queues for transmit channels
|
// initialize send queues for transmit channels
|
||||||
#ifdef HAS_LORA
|
#ifdef HAS_LORA
|
||||||
LoraSendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(struct SendBuffer *));
|
//--> LoraSendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(struct SendBuffer
|
||||||
|
//*));
|
||||||
|
LoraSendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t));
|
||||||
if (LoraSendQueue == 0) {
|
if (LoraSendQueue == 0) {
|
||||||
ESP_LOGE(TAG, "Could not create LORA send queue. Aborting.");
|
ESP_LOGE(TAG, "Could not create LORA send queue. Aborting.");
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -119,7 +120,9 @@ void setup() {
|
|||||||
SEND_QUEUE_SIZE * PAYLOAD_BUFFER_SIZE);
|
SEND_QUEUE_SIZE * PAYLOAD_BUFFER_SIZE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(struct SendBuffer *));
|
//--> SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(struct SendBuffer
|
||||||
|
//*));
|
||||||
|
SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t));
|
||||||
if (SPISendQueue == 0) {
|
if (SPISendQueue == 0) {
|
||||||
ESP_LOGE(TAG, "Could not create SPI send queue. Aborting.");
|
ESP_LOGE(TAG, "Could not create SPI send queue. Aborting.");
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -330,6 +333,8 @@ void loop() {
|
|||||||
// reset watchdog
|
// reset watchdog
|
||||||
vTaskDelay(1 / portTICK_PERIOD_MS);
|
vTaskDelay(1 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
//ESP_LOGI(TAG, "%d Bytes left", ESP.getFreeHeap());
|
||||||
|
|
||||||
} // loop()
|
} // loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
// Payload send cycle and encoding
|
// Payload send cycle and encoding
|
||||||
#define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec.
|
#define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec.
|
||||||
#define PAYLOAD_ENCODER 1 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
|
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
|
||||||
|
|
||||||
// Set this to include BLE counting and vendor filter functions
|
// Set this to include BLE counting and vendor filter functions
|
||||||
#define VENDORFILTER 1 // comment out if you want to count things, not people
|
//#define VENDORFILTER 1 // comment out if you want to count things, not people
|
||||||
#define BLECOUNTER 1 // comment out if you don't want BLE count, saves power & memory
|
#define BLECOUNTER 1 // comment out if you don't want BLE count, saves power & memory
|
||||||
|
|
||||||
// BLE scan parameters
|
// BLE scan parameters
|
||||||
|
178
src/senddata.cpp
178
src/senddata.cpp
@ -3,25 +3,25 @@
|
|||||||
|
|
||||||
// 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 EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size) {
|
void EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size) {
|
||||||
MessageBuffer_t *xMsg; // create pointer to struct which holds the sendbuffer
|
|
||||||
|
|
||||||
SendBuffer.MessageSize = size;
|
MessageBuffer_t MySendBuffer;
|
||||||
SendBuffer.MessagePort = PAYLOAD_ENCODER <= 2
|
|
||||||
? port
|
MySendBuffer.MessageSize = size;
|
||||||
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
|
MySendBuffer.MessagePort = PAYLOAD_ENCODER <= 2
|
||||||
memcpy(SendBuffer.Message, data, size);
|
? port
|
||||||
xMsg = &SendBuffer;
|
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
|
||||||
|
memcpy(MySendBuffer.Message, data, size);
|
||||||
|
|
||||||
// enqueue message in LoRa send queue
|
// enqueue message in LoRa send queue
|
||||||
#ifdef HAS_LORA
|
#ifdef HAS_LORA
|
||||||
xQueueSend(LoraSendQueue, (void *)&xMsg, (TickType_t)0);
|
if (xQueueSendToBack(LoraSendQueue, (void *)&MySendBuffer, (TickType_t)0))
|
||||||
ESP_LOGI(TAG, "%d bytes enqueued to send on LoRa", size);
|
ESP_LOGI(TAG, "%d bytes enqueued to send on LoRa", size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// enqueue message in SPI send queue
|
// enqueue message in SPI send queue
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
xQueueSend(SPISendQueue, (void *)&xMsg, (TickType_t)0);
|
if (xQueueSendToBack(SPISendQueue, (void *)&MySendBuffer, (TickType_t)0))
|
||||||
ESP_LOGI(TAG, "%d bytes enqueued to send on SPI", size);
|
ESP_LOGI(TAG, "%d bytes enqueued to send on SPI", size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clear counter if not in cumulative counter mode
|
// clear counter if not in cumulative counter mode
|
||||||
@ -31,6 +31,8 @@ void EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size) {
|
|||||||
ESP_LOGI(TAG, "Counter cleared");
|
ESP_LOGI(TAG, "Counter cleared");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "%d Bytes left", ESP.getFreeHeap());
|
||||||
|
|
||||||
} // senddata
|
} // senddata
|
||||||
|
|
||||||
// cyclic called function to prepare payload to send
|
// cyclic called function to prepare payload to send
|
||||||
@ -76,33 +78,155 @@ 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 *xMsg;
|
|
||||||
|
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_TXRXPEND) {
|
if ((LMIC.opmode & (OP_JOINING | OP_REJOIN | OP_TXDATA | OP_POLL)) != 0) {
|
||||||
sprintf(display_line7, "LORA BUSY");
|
// LoRa Busy -> don't eat data from queue, since it cannot be sent
|
||||||
} else {
|
} else {
|
||||||
if (xQueueReceive(LoraSendQueue, &(xMsg), (TickType_t)10)) {
|
if (xQueueReceive(LoraSendQueue, &(RcvBuf), (TickType_t)10)) {
|
||||||
// xMsg now holds the struct MessageBuffer from queue
|
// xMsg now holds the struct MessageBuffer from queue
|
||||||
LMIC_setTxData2(xMsg->MessagePort, xMsg->Message, xMsg->MessageSize,
|
LMIC_setTxData2(RcvBuf.MessagePort, RcvBuf.Message, RcvBuf.MessageSize,
|
||||||
(cfg.countermode & 0x02));
|
(cfg.countermode & 0x02));
|
||||||
ESP_LOGI(TAG, "%d bytes sent to LORA", xMsg->MessageSize);
|
ESP_LOGI(TAG, "%d bytes sent to LORA", RcvBuf.MessageSize);
|
||||||
sprintf(display_line7, "PACKET QUEUED");
|
sprintf(display_line7, "PACKET QUEUED");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_SPI
|
#ifdef HAS_SPI
|
||||||
if (xQueueReceive(SPISendQueue, &(xMsg), (TickType_t)10)) {
|
if (xQueueReceive(SPISendQueue, &(RcvBuf), (TickType_t)10)) {
|
||||||
|
ESP_LOGI(TAG, "%d bytes sent to SPI", RcvBuf.MessageSize);
|
||||||
// to come here: send data over SPI
|
|
||||||
// use these pointers to the payload:
|
|
||||||
// xMsg->MessagePort
|
|
||||||
// xMsg->MessageSize
|
|
||||||
// xMsg->Message
|
|
||||||
|
|
||||||
ESP_LOGI(TAG, "%d bytes sent to SPI", xMsg->MessageSize);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // processSendBuffer
|
|
||||||
|
ESP_LOGI(TAG, "%d Bytes left", ESP.getFreeHeap());
|
||||||
|
|
||||||
|
} // processSendBuffer
|
||||||
|
|
||||||
|
/* old version with pointers
|
||||||
|
|
||||||
|
// Basic Config
|
||||||
|
#include "globals.h"
|
||||||
|
|
||||||
|
// put data to send in RTos Queues used for transmit over channels Lora and SPI
|
||||||
|
void EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size) {
|
||||||
|
|
||||||
|
MessageBuffer_t *xMsg = &SendBuffer;
|
||||||
|
|
||||||
|
SendBuffer.MessageSize = size;
|
||||||
|
SendBuffer.MessagePort = PAYLOAD_ENCODER <= 2
|
||||||
|
? port
|
||||||
|
: (PAYLOAD_ENCODER == 4 ? LPP2PORT : LPP1PORT);
|
||||||
|
memcpy(SendBuffer.Message, data, size);
|
||||||
|
|
||||||
|
// enqueue message in LoRa send queue
|
||||||
|
#ifdef HAS_LORA
|
||||||
|
if (uxQueueSpacesAvailable(LoraSendQueue)) {
|
||||||
|
xQueueSend(LoraSendQueue, (void *)&xMsg, (TickType_t)0);
|
||||||
|
ESP_LOGI(TAG, "%d bytes enqueued to send on LoRa", size);
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// enqueue message in SPI send queue
|
||||||
|
#ifdef HAS_SPI
|
||||||
|
if (uxQueueSpacesAvailable(SPISendQueue)) {
|
||||||
|
xQueueSend(SPISendQueue, (void *)&xMsg, (TickType_t)0);
|
||||||
|
ESP_LOGI(TAG, "%d bytes enqueued to send on SPI", size);
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// clear counter if not in cumulative counter mode
|
||||||
|
if ((port == COUNTERPORT) && (cfg.countermode != 1)) {
|
||||||
|
reset_counters(); // clear macs container and reset all counters
|
||||||
|
reset_salt(); // get new salt for salting hashes
|
||||||
|
ESP_LOGI(TAG, "Counter cleared");
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "%d Bytes left", ESP.getFreeHeap());
|
||||||
|
|
||||||
|
} // senddata
|
||||||
|
|
||||||
|
// cyclic called function to prepare payload to send
|
||||||
|
void sendPayload() {
|
||||||
|
if (SendCycleTimerIRQ) {
|
||||||
|
portENTER_CRITICAL(&timerMux);
|
||||||
|
SendCycleTimerIRQ = 0;
|
||||||
|
portEXIT_CRITICAL(&timerMux);
|
||||||
|
|
||||||
|
// append counter data to payload
|
||||||
|
payload.reset();
|
||||||
|
payload.addCount(macs_wifi, cfg.blescan ? macs_ble : 0);
|
||||||
|
// append GPS data, if present
|
||||||
|
|
||||||
|
#ifdef HAS_GPS
|
||||||
|
// show NMEA data in debug mode, useful for debugging GPS on board
|
||||||
|
// connection
|
||||||
|
ESP_LOGD(TAG, "GPS NMEA data: passed %d / failed: %d / with fix: %d",
|
||||||
|
gps.passedChecksum(), gps.failedChecksum(),
|
||||||
|
gps.sentencesWithFix());
|
||||||
|
// log GPS position if we have a fix and gps data mode is enabled
|
||||||
|
if ((cfg.gpsmode) && (gps.location.isValid())) {
|
||||||
|
gps_read();
|
||||||
|
payload.addGPS(gps_status);
|
||||||
|
ESP_LOGD(TAG, "lat=%.6f | lon=%.6f | %u Sats | HDOP=%.1f | Altitude=%um",
|
||||||
|
gps_status.latitude / (float)1e6,
|
||||||
|
gps_status.longitude / (float)1e6, gps_status.satellites,
|
||||||
|
gps_status.hdop / (float)100, gps_status.altitude);
|
||||||
|
} else {
|
||||||
|
ESP_LOGD(TAG, "No valid GPS position or GPS data mode disabled");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
EnqueueSendData(COUNTERPORT, payload.getBuffer(), payload.getSize());
|
||||||
|
}
|
||||||
|
} // sendpayload()
|
||||||
|
|
||||||
|
// interrupt handler used for payload send cycle timer
|
||||||
|
void IRAM_ATTR SendCycleIRQ() {
|
||||||
|
portENTER_CRITICAL(&timerMux);
|
||||||
|
SendCycleTimerIRQ++;
|
||||||
|
portEXIT_CRITICAL(&timerMux);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cyclic called function to eat data from RTos send queues and transmit it
|
||||||
|
void processSendBuffer() {
|
||||||
|
|
||||||
|
MessageBuffer_t *xMsg;
|
||||||
|
|
||||||
|
#ifdef HAS_LORA
|
||||||
|
// Check if there is a pending TX/RX job running
|
||||||
|
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 (uxQueueMessagesWaiting(LoraSendQueue)) // check if msg are waiting on
|
||||||
|
queue if (xQueueReceive(LoraSendQueue, &xMsg, (TickType_t)10)) {
|
||||||
|
// xMsg now holds the struct MessageBuffer from queue
|
||||||
|
LMIC_setTxData2(xMsg->MessagePort, xMsg->Message, xMsg->MessageSize,
|
||||||
|
(cfg.countermode & 0x02));
|
||||||
|
ESP_LOGI(TAG, "%d bytes sent to LORA", xMsg->MessageSize);
|
||||||
|
sprintf(display_line7, "PACKET QUEUED");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_SPI
|
||||||
|
if (uxQueueMessagesWaiting(SPISendQueue)) // check if msg are waiting on queue
|
||||||
|
if (xQueueReceive(SPISendQueue, &xMsg, (TickType_t)10)) {
|
||||||
|
|
||||||
|
// to come here: send data over SPI
|
||||||
|
// use these pointers to the payload:
|
||||||
|
// xMsg->MessagePort
|
||||||
|
// xMsg->MessageSize
|
||||||
|
// xMsg->Message
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "%d bytes sent to SPI", xMsg->MessageSize);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "%d Bytes left", ESP.getFreeHeap());
|
||||||
|
|
||||||
|
} // processSendBuffer
|
||||||
|
|
||||||
|
*/
|
@ -8,9 +8,6 @@ typedef struct {
|
|||||||
uint8_t Message[PAYLOAD_BUFFER_SIZE];
|
uint8_t Message[PAYLOAD_BUFFER_SIZE];
|
||||||
} MessageBuffer_t;
|
} MessageBuffer_t;
|
||||||
|
|
||||||
extern QueueHandle_t LoraSendQueue, SPISendQueue;
|
|
||||||
extern MessageBuffer_t SendBuffer;
|
|
||||||
|
|
||||||
void EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size);
|
void EnqueueSendData(uint8_t port, uint8_t data[], uint8_t size);
|
||||||
void sendPayload(void);
|
void sendPayload(void);
|
||||||
void SendCycleIRQ(void);
|
void SendCycleIRQ(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user