Change Backlog max commands to 30

5.12.0i
 * Change max number of commands in Backlog from 15 to 30
This commit is contained in:
Theo Arends 2018-03-31 18:59:37 +02:00
parent 823c9a0404
commit 96212834cf
3 changed files with 7 additions and 14 deletions

View File

@ -6,6 +6,7 @@
* Add support for SGP30 gas and air quality sensor (#2307)
* Change webpage parameter communication
* Change Timer parameter Device to more obvious Output
* Change max number of commands in Backlog from 15 to 30
* Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
* Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
*

View File

@ -97,7 +97,7 @@ typedef unsigned long power_t; // Power (Relay) type
#define WEB_LOG_SIZE 4000 // Max number of characters in weblog
#endif
#define MAX_BACKLOG 16 // Max number of commands in backlog (chk backlog_index and backlog_pointer code)
#define MAX_BACKLOG 30 // Max number of commands in backlog
#define MIN_BACKLOG_DELAY 2 // Minimal backlog delay in 0.1 seconds
#define SOFT_BAUDRATE 9600 // Default software serial baudrate

View File

@ -463,16 +463,13 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
int command_code = GetCommandCode(command, sizeof(command), type, kTasmotaCommands);
if (CMND_BACKLOG == command_code) {
if (data_len) {
uint8_t bl_pointer = (!backlog_pointer) ? MAX_BACKLOG -1 : backlog_pointer;
bl_pointer--;
char *blcommand = strtok(dataBuf, ";");
while (blcommand != NULL) {
while ((blcommand != NULL) && (backlog_index != bl_pointer)) {
backlog[backlog_index] = String(blcommand);
backlog_index++;
/*
if (backlog_index >= MAX_BACKLOG) {
backlog_index = 0;
}
*/
backlog_index &= 0xF;
if (backlog_index >= MAX_BACKLOG) backlog_index = 0;
blcommand = strtok(NULL, ";");
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, command, D_JSON_APPENDED);
@ -1756,12 +1753,7 @@ void StateLoop()
ExecuteCommand((char*)backlog[backlog_pointer].c_str());
backlog_mutex = 0;
backlog_pointer++;
/*
if (backlog_pointer >= MAX_BACKLOG) {
backlog_pointer = 0;
}
*/
backlog_pointer &= 0xF;
if (backlog_pointer >= MAX_BACKLOG) backlog_pointer = 0;
}
}