mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-01 06:57:43 +00:00
Add command SetOption34 0..255 to set backlog delay
Add command SetOption34 0..255 to set backlog delay. Default value is 200 (mSeconds) (#6562)
This commit is contained in:
parent
18149f5c17
commit
0f72a93170
@ -1,4 +1,7 @@
|
|||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
|
* 6.6.0.17 20191009
|
||||||
|
* Add command SetOption34 0..255 to set backlog delay. Default value is 200 (mSeconds) (#6562)
|
||||||
|
*
|
||||||
* 6.6.0.16 20191008
|
* 6.6.0.16 20191008
|
||||||
* Change PZEM004T default address mask from 0.0.0.x to 192.168.1.x for legacy reason (#6585)
|
* Change PZEM004T default address mask from 0.0.0.x to 192.168.1.x for legacy reason (#6585)
|
||||||
* Fix PZEM004T, PZEMAC and PZEMDC autodetection (#6585)
|
* Fix PZEM004T, PZEMAC and PZEMDC autodetection (#6585)
|
||||||
|
@ -566,6 +566,7 @@ void SettingsDefaultSet2(void)
|
|||||||
// Settings.flag.value_units = 0;
|
// Settings.flag.value_units = 0;
|
||||||
// Settings.flag.stop_flash_rotate = 0;
|
// Settings.flag.stop_flash_rotate = 0;
|
||||||
Settings.save_data = SAVE_DATA;
|
Settings.save_data = SAVE_DATA;
|
||||||
|
Settings.param[P_BACKLOG_DELAY] = MIN_BACKLOG_DELAY;
|
||||||
Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET;
|
Settings.param[P_BOOT_LOOP_OFFSET] = BOOT_LOOP_OFFSET;
|
||||||
Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW;
|
Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW;
|
||||||
Settings.sleep = APP_SLEEP;
|
Settings.sleep = APP_SLEEP;
|
||||||
@ -1097,9 +1098,9 @@ void SettingsDelta(void)
|
|||||||
|
|
||||||
if (Settings.version < 0x0606000A) {
|
if (Settings.version < 0x0606000A) {
|
||||||
uint8_t tuyaindex = 0;
|
uint8_t tuyaindex = 0;
|
||||||
if (Settings.param[P_ex_TUYA_DIMMER_ID] > 0) { // ex SetOption34
|
if (Settings.param[P_BACKLOG_DELAY] > 0) { // ex SetOption34
|
||||||
Settings.tuya_fnid_map[tuyaindex].fnid = 21; // TUYA_MCU_FUNC_DIMMER - Move Tuya Dimmer Id to Map
|
Settings.tuya_fnid_map[tuyaindex].fnid = 21; // TUYA_MCU_FUNC_DIMMER - Move Tuya Dimmer Id to Map
|
||||||
Settings.tuya_fnid_map[tuyaindex].dpid = Settings.param[P_ex_TUYA_DIMMER_ID];
|
Settings.tuya_fnid_map[tuyaindex].dpid = Settings.param[P_BACKLOG_DELAY];
|
||||||
tuyaindex++;
|
tuyaindex++;
|
||||||
} else if (Settings.flag3.ex_tuya_disable_dimmer == 1) { // ex SetOption65
|
} else if (Settings.flag3.ex_tuya_disable_dimmer == 1) { // ex SetOption65
|
||||||
Settings.tuya_fnid_map[tuyaindex].fnid = 11; // TUYA_MCU_FUNC_REL1 - Create FnID for Switches
|
Settings.tuya_fnid_map[tuyaindex].fnid = 11; // TUYA_MCU_FUNC_REL1 - Create FnID for Switches
|
||||||
@ -1136,6 +1137,9 @@ void SettingsDelta(void)
|
|||||||
Settings.shutter_accuracy = 0;
|
Settings.shutter_accuracy = 0;
|
||||||
Settings.mqttlog_level = MQTT_LOG_LEVEL;
|
Settings.mqttlog_level = MQTT_LOG_LEVEL;
|
||||||
}
|
}
|
||||||
|
if (Settings.version < 0x06060011) {
|
||||||
|
Settings.param[P_BACKLOG_DELAY] = MIN_BACKLOG_DELAY;
|
||||||
|
}
|
||||||
|
|
||||||
Settings.version = VERSION;
|
Settings.version = VERSION;
|
||||||
SettingsSave(1);
|
SettingsSave(1);
|
||||||
|
@ -124,7 +124,7 @@ const uint16_t MIN_MESSZ = 893; // Min number of characters in MQTT
|
|||||||
const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline
|
const uint8_t SENSOR_MAX_MISS = 5; // Max number of missed sensor reads before deciding it's offline
|
||||||
|
|
||||||
const uint8_t MAX_BACKLOG = 30; // Max number of commands in backlog
|
const uint8_t MAX_BACKLOG = 30; // Max number of commands in backlog
|
||||||
const uint32_t MIN_BACKLOG_DELAY = 2; // Minimal backlog delay in 0.1 seconds
|
const uint32_t MIN_BACKLOG_DELAY = 200; // Minimal backlog delay in mSeconds
|
||||||
|
|
||||||
const uint32_t SOFT_BAUDRATE = 9600; // Default software serial baudrate
|
const uint32_t SOFT_BAUDRATE = 9600; // Default software serial baudrate
|
||||||
const uint32_t APP_BAUDRATE = 115200; // Default serial baudrate
|
const uint32_t APP_BAUDRATE = 115200; // Default serial baudrate
|
||||||
@ -245,7 +245,7 @@ enum ButtonStates { PRESSED, NOT_PRESSED };
|
|||||||
|
|
||||||
enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER };
|
enum Shortcuts { SC_CLEAR, SC_DEFAULT, SC_USER };
|
||||||
|
|
||||||
enum SettingsParamIndex { P_HOLD_TIME, P_MAX_POWER_RETRY, P_ex_TUYA_DIMMER_ID, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, // SetOption32 .. SetOption38
|
enum SettingsParamIndex { P_HOLD_TIME, P_MAX_POWER_RETRY, P_BACKLOG_DELAY, P_MDNS_DELAYED_START, P_BOOT_LOOP_OFFSET, P_RGB_REMAP, P_IR_UNKNOW_THRESHOLD, // SetOption32 .. SetOption38
|
||||||
P_CSE7766_INVALID_POWER, P_HOLD_IGNORE, P_ex_TUYA_RELAYS, P_OVER_TEMP, // SetOption39 .. SetOption42
|
P_CSE7766_INVALID_POWER, P_HOLD_IGNORE, P_ex_TUYA_RELAYS, P_OVER_TEMP, // SetOption39 .. SetOption42
|
||||||
P_DIMMER_MAX,
|
P_DIMMER_MAX,
|
||||||
P_ex_TUYA_VOLTAGE_ID, P_ex_TUYA_CURRENT_ID, P_ex_TUYA_POWER_ID, // SetOption43 .. SetOption46
|
P_ex_TUYA_VOLTAGE_ID, P_ex_TUYA_CURRENT_ID, P_ex_TUYA_POWER_ID, // SetOption43 .. SetOption46
|
||||||
|
@ -1642,10 +1642,10 @@ void loop(void)
|
|||||||
|
|
||||||
ButtonLoop();
|
ButtonLoop();
|
||||||
SwitchLoop();
|
SwitchLoop();
|
||||||
BacklogLoop();
|
|
||||||
#ifdef ROTARY_V1
|
#ifdef ROTARY_V1
|
||||||
RotaryLoop();
|
RotaryLoop();
|
||||||
#endif
|
#endif
|
||||||
|
BacklogLoop();
|
||||||
|
|
||||||
if (TimeReached(state_50msecond)) {
|
if (TimeReached(state_50msecond)) {
|
||||||
SetNextTimeInterval(state_50msecond, 50);
|
SetNextTimeInterval(state_50msecond, 50);
|
||||||
|
@ -180,7 +180,8 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
|||||||
|
|
||||||
DEBUG_CORE_LOG(PSTR("CMD: Payload %d"), payload);
|
DEBUG_CORE_LOG(PSTR("CMD: Payload %d"), payload);
|
||||||
|
|
||||||
backlog_delay = millis() + (100 * MIN_BACKLOG_DELAY);
|
// backlog_delay = millis() + (100 * MIN_BACKLOG_DELAY);
|
||||||
|
backlog_delay = millis() + Settings.param[P_BACKLOG_DELAY];
|
||||||
|
|
||||||
char command[CMDSZ];
|
char command[CMDSZ];
|
||||||
XdrvMailbox.command = command;
|
XdrvMailbox.command = command;
|
||||||
@ -283,7 +284,7 @@ void CmndBacklog(void)
|
|||||||
|
|
||||||
void CmndDelay(void)
|
void CmndDelay(void)
|
||||||
{
|
{
|
||||||
if ((XdrvMailbox.payload >= MIN_BACKLOG_DELAY) && (XdrvMailbox.payload <= 3600)) {
|
if ((XdrvMailbox.payload >= (MIN_BACKLOG_DELAY / 100)) && (XdrvMailbox.payload <= 3600)) {
|
||||||
backlog_delay = millis() + (100 * XdrvMailbox.payload);
|
backlog_delay = millis() + (100 * XdrvMailbox.payload);
|
||||||
}
|
}
|
||||||
uint32_t bl_delay = 0;
|
uint32_t bl_delay = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user