From a59b6b27205bd1e75d62cec7a3f5de0d53be8b38 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 17 Feb 2021 11:06:48 +0100 Subject: [PATCH] Add abort to UfsRun --- CHANGELOG.md | 4 ++-- RELEASENOTES.md | 3 ++- tasmota/xdrv_50_filesystem.ino | 10 +++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7a0a77fc..12cf6f748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,9 @@ All notable changes to this project will be documented in this file. - Support for Frysk language translations by Christiaan Heerze - ESP8266 Fallback to ``*.bin.gz`` binary when OTA upload of ``*.bin`` binary fails - Berry language improved Tasmota integration +- Berry file system support - Filesystem commands ``Ufs``, ``UfsType``, ``UfsSize``, ``UfsFree``, ``UfsDelete``, ``UfsRename`` and ``UfsRun`` -- Basic support for filesystem ``autoexec.bat`` -- Berry add file system support +- Support for filesystem ``autoexec.bat`` to execute sequential commands like backlog ### Changed - IRremoteESP8266 library from v2.7.14 to v2.7.15 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index efb72842c..28ba5fc0b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -96,7 +96,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota - Commands ``ZbNoAutoBind``, ``ZbReceivedTopic`` and ``ZbOmitDevice`` as synonyms for ``SetOption116, 118`` and ``119`` - Commands ``BuzzerActive`` and ``BuzzerPwm`` as synonyms for ``SetOption67`` and ``111`` - Filesystem commands ``Ufs``, ``UfsType``, ``UfsSize``, ``UfsFree``, ``UfsDelete``, ``UfsRename`` and ``UfsRun`` -- Basic support for filesystem ``autoexec.bat`` +- Support for filesystem ``autoexec.bat`` to execute sequential commands like backlog - Milliseconds to console output [#10152](https://github.com/arendst/Tasmota/issues/10152) - Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196) - Rotary No Pullup GPIO selection ``Rotary A/B_n`` [#10407](https://github.com/arendst/Tasmota/issues/10407) @@ -121,6 +121,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota - Support for ESP32 ``Module 3`` Odroid Go 16MB binary tasmota32-odroidgo.bin [#8630](https://github.com/arendst/Tasmota/issues/8630) - Support for ESP32 ``Module 5`` Wireless Tag Eth01 [#9496](https://github.com/arendst/Tasmota/issues/9496) - Support for ESP32 ``Module 7`` M5stack core2 16MB binary tasmota32-core2.bin [#10635](https://github.com/arendst/Tasmota/issues/10635) +- Support for Berry language on ESP32 - Support rotary encoder on Shelly Dimmer [#10407](https://github.com/arendst/Tasmota/issues/10407#issuecomment-756240920) - Support character `#` to be replaced by `space`-character in command ``Publish`` topic [#10258](https://github.com/arendst/Tasmota/issues/10258) - Support trailing silence in buzzer tune [#10694](https://github.com/arendst/Tasmota/issues/10694) diff --git a/tasmota/xdrv_50_filesystem.ino b/tasmota/xdrv_50_filesystem.ino index c735fc2cf..5cf5b310f 100644 --- a/tasmota/xdrv_50_filesystem.ino +++ b/tasmota/xdrv_50_filesystem.ino @@ -360,7 +360,7 @@ bool UfsExecuteCommandFileReady(void) { void UfsExecuteCommandFileLoop(void) { if (UfsExecuteCommandFileReady() || !ffs_type) { return; } - if (strlen(UfsData.run_file) && !UfsData.run_file_mutex) { + if (TimeReached(TasmotaGlobal.backlog_timer) && strlen(UfsData.run_file) && !UfsData.run_file_mutex) { File file = ffsp->open(UfsData.run_file, "r"); if (!file || !file.seek(UfsData.run_file_pos)) { UfsData.run_file_pos = -1; // Signal file ready @@ -401,7 +401,11 @@ void UfsExecuteCommandFileLoop(void) { UfsData.run_file_pos = (file.available()) ? file.position() : -1; file.close(); if (strlen(cmd_line)) { + bool nodelay = (!(!strncasecmp_P(cmd_line, PSTR(D_CMND_DELAY), strlen(D_CMND_DELAY)))); ExecuteCommand(cmd_line, SRC_FILE); + if (nodelay) { + TasmotaGlobal.backlog_timer = millis(); // Reset backlog_timer which has been set by ExecuteCommand (CommandHandler) + } } UfsData.run_file_mutex = false; @@ -507,6 +511,10 @@ void UFSRun(void) { } else { ResponseCmndFailed(); } + } else { + bool not_active = UfsExecuteCommandFileReady(); + UfsData.run_file_pos = -1; + ResponseCmndChar(not_active ? PSTR(D_JSON_DONE) : PSTR(D_JSON_ABORTED)); } }