From b640b47bf1394cefaf43a5f205b5f76d7099f45d Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:35:00 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index a88dd8d..c0e15f7 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace +// using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esp32::polledTimeout::oneShotMs; +// using esp32::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 81319930ef6ba5f9afc6f64c345da5990e80167d Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:36:59 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index c0e15f7..dc395da 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -// using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace + using ESP8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -// using esp32::polledTimeout::oneShotMs; + using ESP32::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 393a4bedc1061c8221732781216af2c6d13e7147 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:38:35 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index dc395da..745c849 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include - using ESP8266::polledTimeout::oneShotMs; // import the type to the local namespace +using polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" - using ESP32::polledTimeout::oneShotMs; +// using polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 1371c02fbf98c17f8d17aa30136acf36ac6d9907 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:39:56 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index 745c849..a723a5c 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using polledTimeout::oneShotMs; // import the type to the local namespace +using esphome::esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -// using polledTimeout::oneShotMs; +using esphome::esp32::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 956fbc2494b10b0bf7504634c949651cfb1918a1 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:54:07 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index a723a5c..a88dd8d 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using esphome::esp8266::polledTimeout::oneShotMs; // import the type to the local namespace +using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esphome::esp32::polledTimeout::oneShotMs; +using esp32::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 4cae53308dc660dd3f9adc0ef127b92815aa0f12 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 11:59:27 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index a88dd8d..7f04652 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace +using esp8266::polledTimeout::oneShotFastMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esp32::polledTimeout::oneShotMs; +using esp32::polledTimeout::oneShotFastMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 905e5eeb5cbd6d68ca3aae0e2e19e524824deeb8 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:00:30 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FTPCommon.h b/FTPCommon.h index 7f04652..7bc8c96 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -127,7 +127,7 @@ protected: bool parseDataIpPort(const char *p); uint32_t sTimeOutMs; // disconnect timeout - oneShotMs aTimeout; // timeout from esp8266 core library + oneShotFastMs aTimeout; // timeout from esp8266 core library bool doFiletoNetwork(); bool doNetworkToFile(); -- cgit v1.2.3 From 84db283b715f10e66b9e3225eeb00c7ebde36b44 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:01:19 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index 7bc8c96..059b36f 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using esp8266::polledTimeout::oneShotFastMs; // import the type to the local namespace +using polledTimeout::oneShotFastMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esp32::polledTimeout::oneShotFastMs; +using polledTimeout::oneShotFastMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 9ff495ca69d6e1769d4c34132c21afb5b88ca312 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:04:50 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index 059b36f..c876b72 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using polledTimeout::oneShotFastMs; // import the type to the local namespace +using arduino::esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using polledTimeout::oneShotFastMs; +using arduino::esp8266::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif @@ -127,7 +127,7 @@ protected: bool parseDataIpPort(const char *p); uint32_t sTimeOutMs; // disconnect timeout - oneShotFastMs aTimeout; // timeout from esp8266 core library + oneShotMs aTimeout; // timeout from esp8266 core library bool doFiletoNetwork(); bool doNetworkToFile(); -- cgit v1.2.3 From b7f379906e688c2eafcdaa8ba3348869ae8d0e33 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:15:41 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index c876b72..5c2654f 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include -using arduino::esp8266::polledTimeout::oneShotMs; // import the type to the local namespace +using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using arduino::esp8266::polledTimeout::oneShotMs; +using esp8266::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 4bf6163f4766be231935e5a24f2b8db688e4c62d Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:20:25 +0300 Subject: Update PolledTimeout.h --- esp32compat/PolledTimeout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp32compat/PolledTimeout.h b/esp32compat/PolledTimeout.h index 64677b7..29118ee 100644 --- a/esp32compat/PolledTimeout.h +++ b/esp32compat/PolledTimeout.h @@ -27,7 +27,7 @@ #include -namespace esp32 +namespace ESP32 { -- cgit v1.2.3 From 2ecbb4999114706f4228eea677940802e0251543 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 12:21:13 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FTPCommon.h b/FTPCommon.h index 5c2654f..a88dd8d 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -13,7 +13,7 @@ using esp8266::polledTimeout::oneShotMs; // import the type to the local namespa #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esp8266::polledTimeout::oneShotMs; +using esp32::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From 67ba68b61ee0e1a50dce81e8c577d8f87dde4727 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:14:41 +0300 Subject: Add files via upload --- esp8266compat/PolledTimeout.h | 289 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 esp8266compat/PolledTimeout.h diff --git a/esp8266compat/PolledTimeout.h b/esp8266compat/PolledTimeout.h new file mode 100644 index 0000000..dc12bba --- /dev/null +++ b/esp8266compat/PolledTimeout.h @@ -0,0 +1,289 @@ +#ifndef __POLLEDTIMING_H__ +#define __POLLEDTIMING_H__ + + +/* + PolledTimeout.h - Encapsulation of a polled Timeout + + Copyright (c) 2018 Daniel Salazar. All rights reserved. + This file is part of the esp8266 core for Arduino environment. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include + +namespace ESP8266 +{ + + +namespace polledTimeout +{ + +namespace YieldPolicy +{ + +struct DoNothing +{ + static void execute() {} +}; + +struct YieldOrSkip +{ + static void execute() {delay(0);} +}; + +template +struct YieldAndDelayMs +{ + static void execute() {delay(delayMs);} +}; + +} //YieldPolicy + +namespace TimePolicy +{ + +struct TimeSourceMillis +{ + // time policy in milli-seconds based on millis() + + using timeType = decltype(millis()); + static timeType time() {return millis();} + static constexpr timeType ticksPerSecond = 1000; + static constexpr timeType ticksPerSecondMax = 1000; +}; + +struct TimeSourceCycles +{ + // time policy based on ESP.getCycleCount() + // this particular time measurement is intended to be called very often + // (every loop, every yield) + + using timeType = decltype(ESP.getCycleCount()); + static timeType time() {return ESP.getCycleCount();} + static constexpr timeType ticksPerSecond = F_CPU; // 80'000'000 or 160'000'000 Hz + static constexpr timeType ticksPerSecondMax = 160000000; // 160MHz +}; + +template + // "second_th" units of timeType for one second +struct TimeUnit +{ + using timeType = typename TimeSourceType::timeType; + +#if __GNUC__ < 5 + // gcc-4.8 cannot compile the constexpr-only version of this function + // using #defines instead luckily works + static constexpr timeType computeRangeCompensation () + { + #define number_of_secondTh_in_one_tick ((1.0 * second_th) / ticksPerSecond) + #define fractional (number_of_secondTh_in_one_tick - (long)number_of_secondTh_in_one_tick) + + return ({ + fractional == 0? + 1: // no need for compensation + (number_of_secondTh_in_one_tick / fractional) + 0.5; // scalar multiplier allowing exact division + }); + + #undef number_of_secondTh_in_one_tick + #undef fractional + } +#else + static constexpr timeType computeRangeCompensation () + { + return ({ + constexpr double number_of_secondTh_in_one_tick = (1.0 * second_th) / ticksPerSecond; + constexpr double fractional = number_of_secondTh_in_one_tick - (long)number_of_secondTh_in_one_tick; + fractional == 0? + 1: // no need for compensation + (number_of_secondTh_in_one_tick / fractional) + 0.5; // scalar multiplier allowing exact division + }); + } +#endif + + static constexpr timeType ticksPerSecond = TimeSourceType::ticksPerSecond; + static constexpr timeType ticksPerSecondMax = TimeSourceType::ticksPerSecondMax; + static constexpr timeType rangeCompensate = computeRangeCompensation(); + static constexpr timeType user2UnitMultiplierMax = (ticksPerSecondMax * rangeCompensate) / second_th; + static constexpr timeType user2UnitMultiplier = (ticksPerSecond * rangeCompensate) / second_th; + static constexpr timeType user2UnitDivider = rangeCompensate; + // std::numeric_limits::max() is reserved + static constexpr timeType timeMax = (std::numeric_limits::max() - 1) / user2UnitMultiplierMax; + + static timeType toTimeTypeUnit (const timeType userUnit) {return (userUnit * user2UnitMultiplier) / user2UnitDivider;} + static timeType toUserUnit (const timeType internalUnit) {return (internalUnit * user2UnitDivider) / user2UnitMultiplier;} + static timeType time () {return TimeSourceType::time();} +}; + +using TimeMillis = TimeUnit< TimeSourceMillis, 1000 >; +using TimeFastMillis = TimeUnit< TimeSourceCycles, 1000 >; +using TimeFastMicros = TimeUnit< TimeSourceCycles, 1000000 >; +using TimeFastNanos = TimeUnit< TimeSourceCycles, 1000000000 >; + +} //TimePolicy + +template +class timeoutTemplate +{ +public: + using timeType = typename TimePolicyT::timeType; + static_assert(std::is_unsigned::value == true, "timeType must be unsigned"); + + static constexpr timeType alwaysExpired = 0; + static constexpr timeType neverExpires = std::numeric_limits::max(); + static constexpr timeType rangeCompensate = TimePolicyT::rangeCompensate; //debug + + timeoutTemplate(const timeType userTimeout) + { + reset(userTimeout); + } + + IRAM_ATTR // fast + bool expired() + { + YieldPolicyT::execute(); //in case of DoNothing: gets optimized away + if(PeriodicT) //in case of false: gets optimized away + return expiredRetrigger(); + return expiredOneShot(); + } + + IRAM_ATTR // fast + operator bool() + { + return expired(); + } + + bool canExpire () const + { + return !_neverExpires; + } + + bool canWait () const + { + return _timeout != alwaysExpired; + } + + IRAM_ATTR // called from ISR + void reset(const timeType newUserTimeout) + { + reset(); + _timeout = TimePolicyT::toTimeTypeUnit(newUserTimeout); + _neverExpires = (newUserTimeout < 0) || (newUserTimeout > timeMax()); + } + + IRAM_ATTR // called from ISR + void reset() + { + _start = TimePolicyT::time(); + } + + void resetToNeverExpires () + { + _timeout = alwaysExpired + 1; // because canWait() has precedence + _neverExpires = true; + } + + timeType getTimeout() const + { + return TimePolicyT::toUserUnit(_timeout); + } + + static constexpr timeType timeMax() + { + return TimePolicyT::timeMax; + } + +private: + + IRAM_ATTR // fast + bool checkExpired(const timeType internalUnit) const + { + // canWait() is not checked here + // returns "can expire" and "time expired" + return (!_neverExpires) && ((internalUnit - _start) >= _timeout); + } + +protected: + + IRAM_ATTR // fast + bool expiredRetrigger() + { + if (!canWait()) + return true; + + timeType current = TimePolicyT::time(); + if(checkExpired(current)) + { + unsigned long n = (current - _start) / _timeout; //how many _timeouts periods have elapsed, will usually be 1 (current - _start >= _timeout) + _start += n * _timeout; + return true; + } + return false; + } + + IRAM_ATTR // fast + bool expiredOneShot() const + { + // returns "always expired" or "has expired" + return !canWait() || checkExpired(TimePolicyT::time()); + } + + timeType _timeout; + timeType _start; + bool _neverExpires; +}; + +// legacy type names, deprecated (unit is milliseconds) + +using oneShot = polledTimeout::timeoutTemplate /*__attribute__((deprecated("use oneShotMs")))*/; +using periodic = polledTimeout::timeoutTemplate /*__attribute__((deprecated("use periodicMs")))*/; + +// standard versions (based on millis()) +// timeMax() is 49.7 days ((2^32)-2 ms) + +using oneShotMs = polledTimeout::timeoutTemplate; +using periodicMs = polledTimeout::timeoutTemplate; + +// Time policy based on ESP.getCycleCount(), and intended to be called very often: +// "Fast" versions sacrifices time range for improved precision and reduced execution time (by 86%) +// (cpu cycles for ::expired(): 372 (millis()) vs 52 (ESP.getCycleCount())) +// timeMax() values: +// Ms: max is 26843 ms (26.8 s) +// Us: max is 26843545 us (26.8 s) +// Ns: max is 1073741823 ns ( 1.07 s) +// (time policy based on ESP.getCycleCount() is intended to be called very often) + +using oneShotFastMs = polledTimeout::timeoutTemplate; +using periodicFastMs = polledTimeout::timeoutTemplate; +using oneShotFastUs = polledTimeout::timeoutTemplate; +using periodicFastUs = polledTimeout::timeoutTemplate; +using oneShotFastNs = polledTimeout::timeoutTemplate; +using periodicFastNs = polledTimeout::timeoutTemplate; + +} //polledTimeout + + +/* A 1-shot timeout that auto-yields when in CONT can be built as follows: + * using oneShotYieldMs = esp8266::polledTimeout::timeoutTemplate; + * + * Other policies can be implemented by the user, e.g.: simple yield that panics in SYS, and the polledTimeout types built as needed as shown above, without modifying this file. + */ + +}//esp8266 + +#endif -- cgit v1.2.3 From fc321f557244ef928097a8c771e5b0732fe3b009 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:15:59 +0300 Subject: Update PolledTimeout.h --- esp8266compat/PolledTimeout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp8266compat/PolledTimeout.h b/esp8266compat/PolledTimeout.h index dc12bba..fe9c9ca 100644 --- a/esp8266compat/PolledTimeout.h +++ b/esp8266compat/PolledTimeout.h @@ -27,7 +27,7 @@ #include -namespace ESP8266 +namespace esp8266 { -- cgit v1.2.3 From 397755e4d64926086a4abba10c4c9e7377a85537 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:16:25 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FTPCommon.h b/FTPCommon.h index a88dd8d..c1f99ec 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -7,7 +7,7 @@ #include #ifdef ESP8266 -#include +#include "esp8266compat/PolledTimeout.h" using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" -- cgit v1.2.3 From 2408ad5c02229cc9b40f071bbda5663e720bd45f Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:17:21 +0300 Subject: Update FTPCommon.h --- FTPCommon.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPCommon.h b/FTPCommon.h index c1f99ec..79a8817 100644 --- a/FTPCommon.h +++ b/FTPCommon.h @@ -8,12 +8,12 @@ #ifdef ESP8266 #include "esp8266compat/PolledTimeout.h" -using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace +using esp8266Pool::polledTimeout::oneShotMs; // import the type to the local namespace #define BUFFERSIZE TCP_MSS #define PRINTu32 "lu" #elif defined ESP32 #include "esp32compat/PolledTimeout.h" -using esp32::polledTimeout::oneShotMs; +using esp32Pool::polledTimeout::oneShotMs; #define BUFFERSIZE CONFIG_TCP_MSS #define PRINTu32 "u" #endif -- cgit v1.2.3 From b5f949c5f02616426468d05a24dc2d3565aa7971 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:17:43 +0300 Subject: Update PolledTimeout.h --- esp8266compat/PolledTimeout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp8266compat/PolledTimeout.h b/esp8266compat/PolledTimeout.h index fe9c9ca..ec4064f 100644 --- a/esp8266compat/PolledTimeout.h +++ b/esp8266compat/PolledTimeout.h @@ -27,7 +27,7 @@ #include -namespace esp8266 +namespace esp8266Pool { -- cgit v1.2.3 From ef2a7811eb9e0bc838c44aa0cbe6782af2ed8677 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Sat, 23 Oct 2021 13:20:23 +0300 Subject: Update PolledTimeout.h --- esp32compat/PolledTimeout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esp32compat/PolledTimeout.h b/esp32compat/PolledTimeout.h index 29118ee..06fe14e 100644 --- a/esp32compat/PolledTimeout.h +++ b/esp32compat/PolledTimeout.h @@ -27,7 +27,7 @@ #include -namespace ESP32 +namespace esp32Pool { -- cgit v1.2.3 From f4ebb57dbc46150b219a2f045543112cc7afc900 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Mon, 15 Nov 2021 13:20:45 +0300 Subject: Update FTPServer.cpp --- FTPServer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FTPServer.cpp b/FTPServer.cpp index 0e87fba..98f661e 100644 --- a/FTPServer.cpp +++ b/FTPServer.cpp @@ -46,10 +46,11 @@ FTPServer::FTPServer(FS &_FSImplementation) : FTPCommon(_FSImplementation) aTimeout.resetToNeverExpires(); } -void FTPServer::begin(const String &uname, const String &pword) +void FTPServer::begin(const String &uname, const String &pword, boolean _bUnixLst) { _FTP_USER = uname; _FTP_PASS = pword; + bUnixLst = _bUnixLst; iniVariables(); -- cgit v1.2.3 From b6715f1db3d0b9076a4350c941a2e31afb70bc3b Mon Sep 17 00:00:00 2001 From: SCratORS Date: Mon, 15 Nov 2021 13:25:29 +0300 Subject: Update FTPServer.cpp --- FTPServer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/FTPServer.cpp b/FTPServer.cpp index 98f661e..f988b86 100644 --- a/FTPServer.cpp +++ b/FTPServer.cpp @@ -46,11 +46,10 @@ FTPServer::FTPServer(FS &_FSImplementation) : FTPCommon(_FSImplementation) aTimeout.resetToNeverExpires(); } -void FTPServer::begin(const String &uname, const String &pword, boolean _bUnixLst) +void FTPServer::begin(const String &uname, const String &pword) { _FTP_USER = uname; _FTP_PASS = pword; - bUnixLst = _bUnixLst; iniVariables(); @@ -563,8 +562,11 @@ int8_t FTPServer::processCommand() uint32_t fs = file.size(); String fileTime = makeDateTimeStr(file.getLastWrite()); file.close(); - if (cwd == FPSTR(aSlash) && fn[0] == '/') - fn.remove(0, 1); + dashPos = fn.lastIndexOf(F("/")); + if (dashPos >= 0) + { + fn.remove(0, dashPos + 1); + } if (FTP_CMD(LIST) == command) { -- cgit v1.2.3 From 86a91561bc34eb04b32630f7c589fbccd912db79 Mon Sep 17 00:00:00 2001 From: SCratORS Date: Mon, 15 Nov 2021 13:26:25 +0300 Subject: Update FTPClient.cpp --- FTPClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FTPClient.cpp b/FTPClient.cpp index 51456f9..4ea31be 100644 --- a/FTPClient.cpp +++ b/FTPClient.cpp @@ -19,9 +19,9 @@ const FTPClient::Status &FTPClient::transfer(const String &localFileName, const _remoteFileName = remoteFileName; _direction = direction; - if (direction & FTP_GET) + if (direction & FTP_GET_NONBLOCKING) file = THEFS.open(localFileName, "w"); - else if (direction & FTP_PUT) + else if (direction & FTP_PUT_NONBLOCKING) file = THEFS.open(localFileName, "r"); if (!file) -- cgit v1.2.3