Add abort to UfsRun

This commit is contained in:
Theo Arends 2021-02-17 11:06:48 +01:00
parent d84de90b1b
commit a59b6b2720
3 changed files with 13 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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));
}
}