mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
remove tx/rx limits for standalone
This commit is contained in:
@@ -228,10 +228,12 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
// create the telegram
|
// create the telegram
|
||||||
auto telegram = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length);
|
auto telegram = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length);
|
||||||
|
|
||||||
// check if queue is full, if so remove top item to make space
|
// check if queue is full, if so remove top item to make space, except if we're in standalone mode
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
if (rx_telegrams_.size() >= MAX_RX_TELEGRAMS) {
|
if (rx_telegrams_.size() >= MAX_RX_TELEGRAMS) {
|
||||||
rx_telegrams_.pop_front();
|
rx_telegrams_.pop_front();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
||||||
}
|
}
|
||||||
@@ -239,7 +241,7 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
// add empty telegram to rx-queue
|
// add empty telegram to rx-queue
|
||||||
void RxService::add_empty(const uint8_t src, const uint8_t dest, const uint16_t type_id, uint8_t offset) {
|
void RxService::add_empty(const uint8_t src, const uint8_t dest, const uint16_t type_id, uint8_t offset) {
|
||||||
auto telegram = std::make_shared<Telegram>(Telegram::Operation::RX, src, dest, type_id, offset, nullptr, 0);
|
auto telegram = std::make_shared<Telegram>(Telegram::Operation::RX, src, dest, type_id, offset, nullptr, 0);
|
||||||
// only if queue is not full
|
// only if queue is not full
|
||||||
if (rx_telegrams_.size() < MAX_RX_TELEGRAMS) {
|
if (rx_telegrams_.size() < MAX_RX_TELEGRAMS) {
|
||||||
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
||||||
}
|
}
|
||||||
@@ -442,6 +444,7 @@ void TxService::add(const uint8_t operation,
|
|||||||
|
|
||||||
LOG_DEBUG("New Tx [#%d] telegram, length %d", tx_telegram_id_, message_length);
|
LOG_DEBUG("New Tx [#%d] telegram, length %d", tx_telegram_id_, message_length);
|
||||||
|
|
||||||
|
#ifndef EMSESP_STANDALONE
|
||||||
// if the queue is full, make room by removing the last one
|
// if the queue is full, make room by removing the last one
|
||||||
if (tx_telegrams_.size() >= MAX_TX_TELEGRAMS) {
|
if (tx_telegrams_.size() >= MAX_TX_TELEGRAMS) {
|
||||||
LOG_WARNING("Tx queue overflow, skip one message");
|
LOG_WARNING("Tx queue overflow, skip one message");
|
||||||
@@ -452,6 +455,7 @@ void TxService::add(const uint8_t operation,
|
|||||||
}
|
}
|
||||||
tx_telegrams_.pop_front();
|
tx_telegrams_.pop_front();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (front) {
|
if (front) {
|
||||||
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validateid); // add to front of queue
|
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validateid); // add to front of queue
|
||||||
|
|||||||
@@ -32,13 +32,8 @@
|
|||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
#if defined(EMSESP_STANDALONE)
|
|
||||||
#define MAX_RX_TELEGRAMS 100 // size of Rx queue
|
#define MAX_RX_TELEGRAMS 100 // size of Rx queue
|
||||||
#define MAX_TX_TELEGRAMS 200 // size of Tx queue
|
|
||||||
#else
|
|
||||||
#define MAX_RX_TELEGRAMS 10 // size of Rx queue
|
|
||||||
#define MAX_TX_TELEGRAMS 160 // size of Tx queue
|
#define MAX_TX_TELEGRAMS 160 // size of Tx queue
|
||||||
#endif
|
|
||||||
|
|
||||||
// default values for null values
|
// default values for null values
|
||||||
static constexpr uint8_t EMS_VALUE_BOOL = 0xFF; // used to mark that something is a boolean
|
static constexpr uint8_t EMS_VALUE_BOOL = 0xFF; // used to mark that something is a boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user