From b36dd3d186f642baa9d91345d3beadfa41f4ec5d Mon Sep 17 00:00:00 2001 From: Tolentino Cotesta Date: Wed, 20 Nov 2024 14:19:38 +0100 Subject: [PATCH] . --- examples/csvLogger/.vscode/arduino.json | 6 +- .../csvLogger/.vscode/c_cpp_properties.json | 249 +++++++++++------- examples/csvLogger/.vscode/settings.json | 5 + examples/csvLogger/csvLogger.ino | 15 +- library.properties | 2 +- src/esp-fs-webserver.cpp | 126 ++++----- src/esp-fs-webserver.h | 8 +- 7 files changed, 229 insertions(+), 182 deletions(-) create mode 100644 examples/csvLogger/.vscode/settings.json diff --git a/examples/csvLogger/.vscode/arduino.json b/examples/csvLogger/.vscode/arduino.json index c0f261b..156743c 100644 --- a/examples/csvLogger/.vscode/arduino.json +++ b/examples/csvLogger/.vscode/arduino.json @@ -1,6 +1,6 @@ { - "configuration": "JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=default,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none", - "board": "esp32:esp32:esp32s3", - "port": "COM3", + "configuration": "USBMode=hwcdc,JTAGAdapter=default,CDCOnBoot=default,PartitionScheme=default,CPUFreq=160,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=error,EraseFlash=none", + "board": "esp32:esp32:nologo_esp32c3_super_mini", + "port": "COM26", "sketch": "csvLogger.ino" } \ No newline at end of file diff --git a/examples/csvLogger/.vscode/c_cpp_properties.json b/examples/csvLogger/.vscode/c_cpp_properties.json index ff5990a..9873bb9 100644 --- a/examples/csvLogger/.vscode/c_cpp_properties.json +++ b/examples/csvLogger/.vscode/c_cpp_properties.json @@ -3,70 +3,69 @@ "configurations": [ { "name": "Arduino", - "compilerPath": "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\bin\\xtensa-esp32s3-elf-g++", + "compilerPath": "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\bin\\riscv32-esp-elf-g++", "compilerArgs": [ "-MMD", "-w", + "-Werror=return-type", "-iprefix" ], "intelliSenseMode": "gcc-x64", "includePath": [ - "C:\\Dropbox\\ArduinoLibs\\esp-fs-webserver\\examples\\csvLogger", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.1-442a798083\\esp32s3\\qio_qspi\\include", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\cores\\esp32", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\variants\\esp32s3", - "C:\\Users\\cotes\\OneDrive\\Documenti\\Arduino\\libraries\\esp-fs-webserver\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\FS\\src", - "C:\\Users\\cotes\\OneDrive\\Documenti\\Arduino\\libraries\\ArduinoJson\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\WiFi\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\Network\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\ESPmDNS\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\HTTPUpdateServer\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\SPIFFS\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\Update\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\WebServer\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\DNSServer\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\AsyncUDP\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\NetworkClientSecure\\src", - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\libraries\\LittleFS\\src", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\include\\c++\\12.2.0", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\include\\c++\\12.2.0\\xtensa-esp32s3-elf", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\include\\c++\\12.2.0\\backward", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\lib\\gcc\\xtensa-esp32s3-elf\\12.2.0\\include", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\lib\\gcc\\xtensa-esp32s3-elf\\12.2.0\\include-fixed", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\sys-include", - "c:\\users\\cotes\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32s3-elf-gcc\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\include" + "C:\\Dati\\Cloud\\Dropbox\\ArduinoLibs\\esp-fs-webserver\\examples\\csvLogger", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esp32-arduino-libs\\idf-release_v5.1-632e0c2a\\esp32c3\\qio_qspi\\include", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\cores\\esp32", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\variants\\nologo_esp32c3_super_mini", + "C:\\Users\\BAN_TAG\\Documents\\Arduino\\libraries\\esp-fs-webserver\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\FS\\src", + "C:\\Users\\BAN_TAG\\Documents\\Arduino\\libraries\\ArduinoJson\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\WiFi\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\Network\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\HTTPUpdateServer\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\SPIFFS\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\Update\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\WebServer\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\DNSServer\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\AsyncUDP\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\NetworkClientSecure\\src", + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\libraries\\LittleFS\\src", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\riscv32-esp-elf\\include\\c++\\12.2.0", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\riscv32-esp-elf\\include\\c++\\12.2.0\\riscv32-esp-elf", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\riscv32-esp-elf\\include\\c++\\12.2.0\\backward", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\lib\\gcc\\riscv32-esp-elf\\12.2.0\\include", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\lib\\gcc\\riscv32-esp-elf\\12.2.0\\include-fixed", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\riscv32-esp-elf\\sys-include", + "c:\\users\\ban_tag\\appdata\\local\\arduino15\\packages\\esp32\\tools\\esp-rv32\\2302\\riscv32-esp-elf\\include" ], "forcedInclude": [ - "C:\\Users\\cotes\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.0\\cores\\esp32\\Arduino.h" + "C:\\Users\\BAN_TAG\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\3.0.7\\cores\\esp32\\Arduino.h" ], "cStandard": "c11", "cppStandard": "c++11", "defines": [ - "F_CPU=240000000L", + "F_CPU=160000000L", "ARDUINO=10607", - "ARDUINO_ESP32S3_DEV", + "ARDUINO_NOLOGO_ESP32C3_SUPER_MINI", "ARDUINO_ARCH_ESP32", - "ARDUINO_BOARD=\"ESP32S3_DEV\"", - "ARDUINO_VARIANT=\"esp32s3\"", + "ARDUINO_BOARD=\"NOLOGO_ESP32C3_SUPER_MINI\"", + "ARDUINO_VARIANT=\"nologo_esp32c3_super_mini\"", "ARDUINO_PARTITION_default", "ARDUINO_HOST_OS=\"windows\"", - "ARDUINO_FQBN=\"esp32:esp32:esp32s3:JTAGAdapter=default,PSRAM=disabled,FlashMode=qio,FlashSize=4M,LoopCore=1,EventsCore=1,USBMode=hwcdc,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,PartitionScheme=default,CPUFreq=240,UploadSpeed=921600,DebugLevel=none,EraseFlash=none,ZigbeeMode=default\"", - "ESP32", - "CORE_DEBUG_LEVEL=0", - "ARDUINO_RUNNING_CORE=1", - "ARDUINO_EVENT_RUNNING_CORE=1", + "ARDUINO_FQBN=\"esp32:esp32:nologo_esp32c3_super_mini:USBMode=hwcdc,JTAGAdapter=default,CDCOnBoot=default,PartitionScheme=default,CPUFreq=160,FlashMode=qio,FlashFreq=80,UploadSpeed=921600,DebugLevel=error,EraseFlash=none\"", + "ESP32=ESP32", + "CORE_DEBUG_LEVEL=1", "ARDUINO_USB_MODE=1", - "ARDUINO_USB_CDC_ON_BOOT=0", - "ARDUINO_USB_MSC_ON_BOOT=0", - "ARDUINO_USB_DFU_ON_BOOT=0", + "ARDUINO_USB_CDC_ON_BOOT=1", + "__riscv=1", "__DBL_MIN_EXP__=(-1021)", "__cpp_attributes=200809L", "__cpp_nontype_template_parameter_auto=201606L", + "__riscv_atomic=1", "__UINT_LEAST16_MAX__=0xffff", "__ATOMIC_ACQUIRE=2", - "__FLT_MIN__=1.1754943508222875e-38F", - "__GCC_IEC_559_COMPLEX=0", + "__FLT128_MAX_10_EXP__=4932", + "__FLT_MIN__=1.17549435082228750796873653722224568e-38F", + "__GCC_IEC_559_COMPLEX=2", "__cpp_aggregate_nsdmi=201304L", "__UINT_LEAST8_TYPE__=unsigned char", "__INTMAX_C(c)=c ## LL", @@ -77,13 +76,12 @@ "__cpp_static_assert=201411L", "__ORDER_LITTLE_ENDIAN__=1234", "__SIZE_MAX__=0xffffffffU", - "__WCHAR_MAX__=0xffff", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1", + "__WCHAR_MAX__=0x7fffffff", "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1", - "__DBL_DENORM_MIN__=double(4.9406564584124654e-324L)", - "__GCC_ATOMIC_CHAR_LOCK_FREE=2", - "__GCC_IEC_559=0", + "__DBL_DENORM_MIN__=double(4.94065645841246544176568792868221372e-324L)", + "__GCC_ATOMIC_CHAR_LOCK_FREE=1", + "__riscv_float_abi_soft=1", + "__GCC_IEC_559=2", "__FLT32X_DECIMAL_DIG__=17", "__FLT_EVAL_METHOD__=0", "__cpp_binary_literals=201304L", @@ -109,82 +107,92 @@ "__INT_LEAST8_MAX__=0x7f", "__cpp_capture_star_this=201603L", "__SHRT_MAX__=0x7fff", - "__LDBL_MAX__=1.7976931348623157e+308L", + "__LDBL_MAX__=1.18973149535723176508575932662800702e+4932L", + "__FLT64X_MAX_10_EXP__=4932", "__cpp_if_constexpr=201606L", + "__riscv_cmodel_medlow=1", "__LDBL_IS_IEC_60559__=2", + "__FLT64X_HAS_QUIET_NAN__=1", "__UINT_LEAST8_MAX__=0xff", - "__GCC_ATOMIC_BOOL_LOCK_FREE=2", + "__GCC_ATOMIC_BOOL_LOCK_FREE=1", + "__FLT128_DENORM_MIN__=6.47517511943802511092443895822764655e-4966F128", "__UINTMAX_TYPE__=long long unsigned int", "__FLT_EVAL_METHOD_TS_18661_3__=0", "__CHAR_UNSIGNED__=1", "__UINT32_MAX__=0xffffffffUL", "__GXX_EXPERIMENTAL_CXX0X__=1", - "__LDBL_MAX_EXP__=1024", + "__riscv_fdiv=1", + "__LDBL_MAX_EXP__=16384", + "__FLT128_MIN_EXP__=(-16381)", "__WINT_MIN__=0U", + "__FLT128_MIN_10_EXP__=(-4931)", "__FLT32X_IS_IEC_60559__=2", "__INT_LEAST16_WIDTH__=16", "__SCHAR_MAX__=0x7f", - "__WCHAR_MIN__=0", + "__FLT128_MANT_DIG__=113", + "__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)", "__INT64_C(c)=c ## LL", "__GCC_ATOMIC_POINTER_LOCK_FREE=2", "__SIZEOF_INT__=4", "__FLT32X_MANT_DIG__=53", - "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2", + "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=1", "__cpp_aligned_new=201606L", "__FLT32_MAX_10_EXP__=38", + "__FLT64X_EPSILON__=1.92592994438723585305597794258492732e-34F64x", "__STDC_HOSTED__=1", - "__XTENSA_EL__=1", "__cpp_decltype_auto=201304L", "__DBL_DIG__=15", "__FLT32_DIG__=6", - "__FLT_EPSILON__=1.1920928955078125e-7F", + "__FLT_EPSILON__=1.19209289550781250000000000000000000e-7F", "__GXX_WEAK__=1", "__SHRT_WIDTH__=16", "__FLT32_IS_IEC_60559__=2", - "__LDBL_MIN__=2.2250738585072014e-308L", + "__LDBL_MIN__=3.36210314311209350626267781732175260e-4932L", "__DBL_IS_IEC_60559__=2", "__cpp_threadsafe_static_init=200806L", "__cpp_enumerator_attributes=201411L", + "__FLT64X_DENORM_MIN__=6.47517511943802511092443895822764655e-4966F64x", + "__FP_FAST_FMA=1", "__FLT32X_HAS_INFINITY__=1", "__INT32_MAX__=0x7fffffffL", "__INT_WIDTH__=32", "__SIZEOF_LONG__=4", "__UINT16_C(c)=c", - "__DECIMAL_DIG__=17", - "__FLT64_EPSILON__=2.2204460492503131e-16F64", + "__DECIMAL_DIG__=36", + "__FLT64_EPSILON__=2.22044604925031308084726333618164062e-16F64", "__INT16_MAX__=0x7fff", "__FLT64_MIN_EXP__=(-1021)", + "__FLT64X_MIN_10_EXP__=(-4931)", "__LDBL_HAS_QUIET_NAN__=1", "__FLT64_MANT_DIG__=53", + "__FLT64X_MANT_DIG__=113", "__GNUC__=12", "__GXX_RTTI=1", "__FLT_HAS_DENORM__=1", - "__SIZEOF_LONG_DOUBLE__=8", + "__SIZEOF_LONG_DOUBLE__=16", "__BIGGEST_ALIGNMENT__=16", "__STDC_UTF_16__=1", "__FLT64_MAX_10_EXP__=308", "__cpp_delegating_constructors=200604L", "__FLT32_HAS_INFINITY__=1", - "__DBL_MAX__=double(1.7976931348623157e+308L)", + "__DBL_MAX__=double(1.79769313486231570814527423731704357e+308L)", "__cpp_raw_strings=200710L", "__INT_FAST32_MAX__=0x7fffffff", "__DBL_HAS_INFINITY__=1", - "__cpp_deduction_guides=201703L", - "__HAVE_SPECULATION_SAFE_VALUE=1", "__cpp_fold_expressions=201603L", "__INTPTR_WIDTH__=32", + "__FLT64X_HAS_INFINITY__=1", "__UINT_LEAST32_MAX__=0xffffffffUL", "__FLT32X_HAS_DENORM__=1", "__INT_FAST16_TYPE__=int", "__LDBL_HAS_DENORM__=1", "__cplusplus=201703L", "__cpp_ref_qualifiers=200710L", - "__INT_LEAST32_MAX__=0x7fffffffL", "__DEPRECATED=1", "__cpp_rvalue_references=200610L", "__DBL_MAX_EXP__=1024", - "__WCHAR_WIDTH__=16", - "__FLT32_MAX__=3.4028234663852886e+38F32", + "__WCHAR_WIDTH__=32", + "__FLT32_MAX__=3.40282346638528859811704183484516925e+38F32", "__GCC_ATOMIC_LONG_LOCK_FREE=2", "__PTRDIFF_MAX__=0x7fffffff", "__FLT32_HAS_QUIET_NAN__=1", @@ -192,41 +200,55 @@ "__LONG_LONG_MAX__=0x7fffffffffffffffLL", "__SIZEOF_SIZE_T__=4", "__cpp_nsdmi=200809L", + "__FLT64X_MIN_EXP__=(-16381)", "__SIZEOF_WINT_T__=4", "__LONG_LONG_WIDTH__=64", "__cpp_initializer_lists=200806L", "__FLT32_MAX_EXP__=128", "__cpp_hex_float=201603L", "__GXX_ABI_VERSION=1017", + "__FLT128_HAS_INFINITY__=1", "__FLT_MIN_EXP__=(-125)", + "__GCC_HAVE_DWARF2_CFI_ASM=1", "__cpp_lambdas=200907L", + "__riscv_flen=64", "__INT_FAST64_TYPE__=long long int", "__FP_FAST_FMAF=1", - "__FLT64_DENORM_MIN__=4.9406564584124654e-324F64", - "__DBL_MIN__=double(2.2250738585072014e-308L)", + "__FLT128_NORM_MAX__=1.18973149535723176508575932662800702e+4932F128", + "__FLT64_DENORM_MIN__=4.94065645841246544176568792868221372e-324F64", + "__cpp_template_auto=201606L", + "__DBL_MIN__=double(2.22507385850720138309023271733240406e-308L)", + "__FLT64X_NORM_MAX__=1.18973149535723176508575932662800702e+4932F64x", "__SIZEOF_POINTER__=4", "__DBL_HAS_QUIET_NAN__=1", - "__FLT32X_EPSILON__=2.2204460492503131e-16F32x", + "__FLT32X_EPSILON__=2.22044604925031308084726333618164062e-16F32x", "__FLT64_MIN_10_EXP__=(-307)", + "__riscv_mul=1", + "__FLT64X_DECIMAL_DIG__=36", "__REGISTER_PREFIX__", "__UINT16_MAX__=0xffff", - "__FLT32_MIN__=1.1754943508222875e-38F32", + "__FLT32_MIN__=1.17549435082228750796873653722224568e-38F32", "__UINT8_TYPE__=unsigned char", "__FLT_DIG__=6", "__NO_INLINE__=1", "__DEC_EVAL_METHOD__=2", "__FLT_MANT_DIG__=24", - "__LDBL_DECIMAL_DIG__=17", + "__LDBL_DECIMAL_DIG__=36", "__VERSION__=\"12.2.0\"", "__UINT64_C(c)=c ## ULL", "__cpp_unicode_characters=201411L", + "__INT_LEAST32_MAX__=0x7fffffffL", "__GCC_ATOMIC_INT_LOCK_FREE=2", + "__FLT128_MAX_EXP__=16384", "__FLT32_MANT_DIG__=24", "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", "__cpp_aggregate_bases=201603L", + "__FLT128_HAS_DENORM__=1", + "__FLT128_DIG__=33", "__SCHAR_WIDTH__=8", "__INT32_C(c)=c ## L", "__ORDER_PDP_ENDIAN__=3412", + "__riscv_muldiv=1", "__INT_FAST32_TYPE__=int", "__UINT_LEAST16_TYPE__=short unsigned int", "__DBL_HAS_DENORM__=1", @@ -234,21 +256,23 @@ "__SIZE_TYPE__=unsigned int", "__UINT64_MAX__=0xffffffffffffffffULL", "__FLT_IS_IEC_60559__=2", - "__GNUC_WIDE_EXECUTION_CHARSET_NAME=\"UTF-16LE\"", + "__riscv_xlen=32", + "__GNUC_WIDE_EXECUTION_CHARSET_NAME=\"UTF-32LE\"", + "__FLT64X_DIG__=33", "__INT8_TYPE__=signed char", "__cpp_digit_separators=201309L", "__ELF__=1", - "__xtensa__=1", "__FLT_RADIX__=2", "__INT_LEAST16_TYPE__=short int", - "__LDBL_EPSILON__=2.2204460492503131e-16L", + "__LDBL_EPSILON__=1.92592994438723585305597794258492732e-34L", "__UINTMAX_C(c)=c ## ULL", - "__FLT32X_MIN__=2.2250738585072014e-308F32x", + "__FLT32X_MIN__=2.22507385850720138309023271733240406e-308F32x", "__SIG_ATOMIC_MAX__=0x7fffffff", "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2", "__USER_LABEL_PREFIX__", "__SIZEOF_PTRDIFF_T__=4", - "__LDBL_DIG__=15", + "__riscv_fsqrt=1", + "__LDBL_DIG__=33", "__FLT64_IS_IEC_60559__=2", "__FLT32X_MIN_EXP__=(-1021)", "__INT_FAST16_MAX__=0x7fffffff", @@ -259,6 +283,7 @@ "__FLT_HAS_QUIET_NAN__=1", "__FLT_MAX_10_EXP__=38", "__LONG_MAX__=0x7fffffffL", + "__FLT64X_HAS_DENORM__=1", "__FLT_HAS_INFINITY__=1", "__GNUC_EXECUTION_CHARSET_NAME=\"UTF-8\"", "__cpp_unicode_literals=200710L", @@ -269,13 +294,14 @@ "__SIZE_WIDTH__=32", "__INT_LEAST16_MAX__=0x7fff", "__INT64_MAX__=0x7fffffffffffffffLL", - "__FLT32_DENORM_MIN__=1.4012984643248171e-45F32", + "__FLT32_DENORM_MIN__=1.40129846432481707092372958328991613e-45F32", "__SIG_ATOMIC_WIDTH__=32", "__INT_LEAST64_TYPE__=long long int", "__INT16_TYPE__=short int", "__INT_LEAST8_TYPE__=signed char", "__cpp_structured_bindings=201606L", "__INT_FAST8_MAX__=0x7fffffff", + "__FLT128_MAX__=1.18973149535723176508575932662800702e+4932F128", "__INTPTR_MAX__=0x7fffffff", "__cpp_sized_deallocation=201309L", "__cpp_guaranteed_copy_elision=201606L", @@ -283,16 +309,18 @@ "__FLT32_MIN_10_EXP__=(-37)", "__EXCEPTIONS=1", "__PTRDIFF_WIDTH__=32", - "__LDBL_MANT_DIG__=53", + "__LDBL_MANT_DIG__=113", + "__riscv_m=2000000", "__cpp_range_based_for=201603L", "__FLT64_HAS_INFINITY__=1", - "__STDCPP_DEFAULT_NEW_ALIGNMENT__=8", + "__FLT64X_MAX__=1.18973149535723176508575932662800702e+4932F64x", + "__STDCPP_DEFAULT_NEW_ALIGNMENT__=16", "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", "__cpp_nontype_template_args=201411L", "__cpp_return_type_deduction=201304L", "__INTPTR_TYPE__=int", "__UINT16_TYPE__=short unsigned int", - "__WCHAR_TYPE__=short unsigned int", + "__WCHAR_TYPE__=int", "__SIZEOF_FLOAT__=4", "__UINTPTR_MAX__=0xffffffffU", "__INT_FAST64_WIDTH__=64", @@ -300,11 +328,18 @@ "__FLT32_DECIMAL_DIG__=9", "__INT_FAST64_MAX__=0x7fffffffffffffffLL", "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", - "__FLT_NORM_MAX__=3.4028234663852886e+38F", + "__FLT_NORM_MAX__=3.40282346638528859811704183484516925e+38F", + "__FLT64X_MAX_EXP__=16384", "__UINT_FAST64_TYPE__=long long unsigned int", "__cpp_inline_variables=201606L", + "__riscv_a=2001000", + "__riscv_c=2000000", + "__riscv_d=2002000", + "__riscv_f=2002000", + "__riscv_i=2001000", "__INT_MAX__=0x7fffffff", "__STDCPP_THREADS__=1", + "__riscv_zicsr=2000000", "__INT64_TYPE__=long long int", "__FLT_MAX_EXP__=128", "__DBL_MANT_DIG__=53", @@ -314,57 +349,63 @@ "__WINT_TYPE__=unsigned int", "__UINT_LEAST32_TYPE__=long unsigned int", "__SIZEOF_SHORT__=2", - "__FLT32_NORM_MAX__=3.4028234663852886e+38F32", - "__LDBL_MIN_EXP__=(-1021)", - "__FLT64_MAX__=1.7976931348623157e+308F64", + "__FLT32_NORM_MAX__=3.40282346638528859811704183484516925e+38F32", + "__LDBL_MIN_EXP__=(-16381)", + "__riscv_compressed=1", + "__FLT64_MAX__=1.79769313486231570814527423731704357e+308F64", "__WINT_WIDTH__=32", - "__cpp_template_auto=201606L", + "__FP_FAST_FMAF64=1", "__INT_LEAST64_WIDTH__=64", "__FLT32X_MAX_10_EXP__=308", - "__WCHAR_UNSIGNED__=1", - "__LDBL_MAX_10_EXP__=308", + "__FLT64X_IS_IEC_60559__=2", + "__LDBL_MAX_10_EXP__=4932", "__ATOMIC_RELAXED=0", - "__DBL_EPSILON__=double(2.2204460492503131e-16L)", - "__XTENSA_WINDOWED_ABI__=1", + "__DBL_EPSILON__=double(2.22044604925031308084726333618164062e-16L)", + "__FLT128_MIN__=3.36210314311209350626267781732175260e-4932F128", "__UINT8_C(c)=c", "__FLT64_MAX_EXP__=1024", "__INT_LEAST32_TYPE__=long int", - "__SIZEOF_WCHAR_T__=2", - "__FLT64_NORM_MAX__=1.7976931348623157e+308F64", + "__SIZEOF_WCHAR_T__=4", + "__FLT64_NORM_MAX__=1.79769313486231570814527423731704357e+308F64", + "__FLT128_HAS_QUIET_NAN__=1", "__INTMAX_MAX__=0x7fffffffffffffffLL", "__INT_FAST8_TYPE__=int", "__cpp_namespace_attributes=201411L", + "__FLT64X_MIN__=3.36210314311209350626267781732175260e-4932F64x", "__LDBL_HAS_INFINITY__=1", "__GNUC_STDC_INLINE__=1", "__FLT64_HAS_DENORM__=1", - "__FLT32_EPSILON__=1.1920928955078125e-7F32", + "__FLT32_EPSILON__=1.19209289550781250000000000000000000e-7F32", + "__FP_FAST_FMAF32x=1", "__DBL_DECIMAL_DIG__=17", "__STDC_UTF_32__=1", "__INT_FAST8_WIDTH__=32", - "__FLT32X_MAX__=1.7976931348623157e+308F32x", - "__DBL_NORM_MAX__=double(1.7976931348623157e+308L)", + "__FLT32X_MAX__=1.79769313486231570814527423731704357e+308F32x", + "__DBL_NORM_MAX__=double(1.79769313486231570814527423731704357e+308L)", "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", "__GCC_DESTRUCTIVE_SIZE=32", - "__XTENSA__=1", "__INTMAX_WIDTH__=64", "__ORDER_BIG_ENDIAN__=4321", "__cpp_runtime_arrays=198712L", "__UINT64_TYPE__=long long unsigned int", "__UINT32_C(c)=c ## UL", "__cpp_alias_templates=200704L", - "__FLT_DENORM_MIN__=1.4012984643248171e-45F", + "__riscv_arch_test=1", + "__FLT_DENORM_MIN__=1.40129846432481707092372958328991613e-45F", + "__FLT128_IS_IEC_60559__=2", "__INT8_MAX__=0x7f", "__LONG_WIDTH__=32", "__UINT_FAST32_TYPE__=unsigned int", - "__FLT32X_NORM_MAX__=1.7976931348623157e+308F32x", + "__FLT32X_NORM_MAX__=1.79769313486231570814527423731704357e+308F32x", "__CHAR32_TYPE__=long unsigned int", - "__FLT_MAX__=3.4028234663852886e+38F", + "__FLT_MAX__=3.40282346638528859811704183484516925e+38F", "__cpp_constexpr=201603L", + "__cpp_deduction_guides=201703L", "__INT32_TYPE__=long int", "__SIZEOF_DOUBLE__=8", "__cpp_exceptions=199711L", "__FLT_MIN_10_EXP__=(-37)", - "__FLT64_MIN__=2.2250738585072014e-308F64", + "__FLT64_MIN__=2.22507385850720138309023271733240406e-308F64", "__INT_LEAST32_WIDTH__=32", "__INTMAX_TYPE__=long long int", "__FLT32X_HAS_QUIET_NAN__=1", @@ -372,27 +413,31 @@ "__GNUC_MINOR__=2", "__INT_FAST16_WIDTH__=32", "__UINTMAX_MAX__=0xffffffffffffffffULL", - "__FLT32X_DENORM_MIN__=4.9406564584124654e-324F32x", + "__FLT32X_DENORM_MIN__=4.94065645841246544176568792868221372e-324F32x", "__cpp_template_template_args=201611L", "__DBL_MAX_10_EXP__=308", - "__LDBL_DENORM_MIN__=4.9406564584124654e-324L", + "__LDBL_DENORM_MIN__=6.47517511943802511092443895822764655e-4966L", "__INT16_C(c)=c", "__STDC__=1", "__FLT32X_DIG__=15", "__PTRDIFF_TYPE__=int", + "__riscv_div=1", "__ATOMIC_SEQ_CST=5", + "__riscv_zifencei=2000000", "__UINT32_TYPE__=long unsigned int", "__FLT32X_MIN_10_EXP__=(-307)", "__UINTPTR_TYPE__=unsigned int", - "__LDBL_MIN_10_EXP__=(-307)", + "__LDBL_MIN_10_EXP__=(-4931)", "__cpp_generic_lambdas=201304L", + "__FLT128_EPSILON__=1.92592994438723585305597794258492732e-34F128", "__SIZEOF_LONG_LONG__=8", "__cpp_user_defined_literals=200809L", + "__FLT128_DECIMAL_DIG__=36", "__GCC_ATOMIC_LLONG_LOCK_FREE=1", "__FLT_DECIMAL_DIG__=9", "__UINT_FAST16_MAX__=0xffffffffU", - "__LDBL_NORM_MAX__=1.7976931348623157e+308L", - "__GCC_ATOMIC_SHORT_LOCK_FREE=2", + "__LDBL_NORM_MAX__=1.18973149535723176508575932662800702e+4932L", + "__GCC_ATOMIC_SHORT_LOCK_FREE=1", "__UINT_FAST8_TYPE__=unsigned int", "__cpp_init_captures=201304L", "__ATOMIC_ACQ_REL=4", diff --git a/examples/csvLogger/.vscode/settings.json b/examples/csvLogger/.vscode/settings.json new file mode 100644 index 0000000..1507357 --- /dev/null +++ b/examples/csvLogger/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "functional": "cpp" + } +} \ No newline at end of file diff --git a/examples/csvLogger/csvLogger.ino b/examples/csvLogger/csvLogger.ino index ce5b9b6..0ddb1ee 100644 --- a/examples/csvLogger/csvLogger.ino +++ b/examples/csvLogger/csvLogger.ino @@ -13,7 +13,6 @@ struct tm ntpTime; const char* basePath = "/csv"; - // This script will set page favicon using a base_64 encoded 32x32 pixel icon static const char base64_favicon[] PROGMEM = R"string_literal( var favIcon = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABv0lEQVRYw+3XvWsUURTG4ScYsVEUJUtEEOxiYxTF0i6bSlBSaCXi32B" + @@ -58,20 +57,10 @@ void getFsInfo(fsInfo_t* fsInfo) { } #endif -//////////////////////////////// NTP Time ///////////////////////////////////////// -void getUpdatedtime(const uint32_t timeout) { - uint32_t start = millis(); - do { - time_t now = time(nullptr); - ntpTime = *localtime(&now); - delay(1); - } while (millis() - start < timeout && ntpTime.tm_year <= (1970 - 1900)); -} - //////////////////////////// Append a row to csv file /////////////////////////////////// bool appendRow() { - getUpdatedtime(10); + getLocalTime(&ntpTime, 10); char filename[32]; snprintf(filename, sizeof(filename), @@ -149,7 +138,7 @@ void setup() { #elif defined(ESP32) configTzTime(MYTZ, "time.google.com", "time.windows.com", "pool.ntp.org"); #endif - getUpdatedtime(5000); // Wait for NTP sync + getLocalTime(&ntpTime, 5000); // Wait for NTP sync // Configure /setup page and start Web Server myWebServer.addJavascript(base64_favicon, "favicon"); diff --git a/library.properties b/library.properties index cf48013..6d1ec9e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=esp-fs-webserver -version=2.0.7 +version=2.0.8 author=Tolentino Cotesta maintainer=Tolentino Cotesta sentence=From FSBrowser.ino example to library diff --git a/src/esp-fs-webserver.cpp b/src/esp-fs-webserver.cpp index d5f9769..a0faf82 100644 --- a/src/esp-fs-webserver.cpp +++ b/src/esp-fs-webserver.cpp @@ -1,65 +1,73 @@ #include "esp-fs-webserver.h" #include "detail/RequestHandlersImpl.h" -// // Override default handleClient() method to increase connection speed -// #if defined(ESP32) -// void FSWebServer::handleClient() -// { -// if (_currentStatus == HC_NONE) { -// _currentClient = _server.available(); -// if (!_currentClient) { -// if (_nullDelay) { -// delay(1); -// } -// return; -// } -// log_v("New client: client.localIP()=%s", _currentClient.localIP().toString().c_str()); -// _currentStatus = HC_WAIT_READ; -// _statusChange = millis(); -// } - -// bool keepCurrentClient = false; - -// if (_currentClient.connected()) { -// switch (_currentStatus) { -// // No-op to avoid C++ compiler warning -// case HC_NONE: -// break; - -// // Wait for data from client to become available -// case HC_WAIT_READ: -// if (_currentClient.available()) { -// if (_parseRequest(_currentClient)) { -// _currentClient.setTimeout(HTTP_MAX_SEND_WAIT / 1000); -// _contentLength = CONTENT_LENGTH_NOT_SET; -// _handleRequest(); -// } -// } -// else { -// if (millis() - _statusChange <= 100) { -// keepCurrentClient = true; -// } -// yield(); -// } -// break; - -// // Wait for client to close the connection -// case HC_WAIT_CLOSE: -// if (millis() - _statusChange <= HTTP_MAX_CLOSE_WAIT) { -// keepCurrentClient = true; -// yield(); -// } -// break; -// } -// } - -// if (!keepCurrentClient) { -// _currentClient = WiFiClient(); -// _currentStatus = HC_NONE; -// _currentUpload.reset(); -// } -// } -// #endif +// Override default handleClient() method to increase connection speed +#if defined(ESP32) +void FSWebServer::handleClient() +{ + if (_currentStatus == HC_NONE) { + _currentClient = _server.available(); + if (!_currentClient) { + if (_nullDelay) { + delay(1); + } + return; + } + log_v("New client: client.localIP()=%s", _currentClient.localIP().toString().c_str()); + _currentStatus = HC_WAIT_READ; + _statusChange = millis(); + } + + bool keepCurrentClient = false; + + if (_currentClient.connected()) { + switch (_currentStatus) { + // No-op to avoid C++ compiler warning + case HC_NONE: + break; + + // Wait for data from client to become available + case HC_WAIT_READ: + if (_currentClient.available()) { + if (_parseRequest(_currentClient)) { + _currentClient.setTimeout(HTTP_MAX_SEND_WAIT / 1000); + _contentLength = CONTENT_LENGTH_NOT_SET; + _handleRequest(); + + if (_currentClient.isSSE()) { + _currentStatus = HC_WAIT_CLOSE; + _statusChange = millis(); + keepCurrentClient = true; + } + } + } + else { // !_currentClient.available() + // if (millis() - _statusChange <= HTTP_MAX_DATA_WAIT) { + + if (millis() - _statusChange <= 100) { + keepCurrentClient = true; + } + yield(); + } + break; + + // Wait for client to close the connection + case HC_WAIT_CLOSE: + if (millis() - _statusChange <= HTTP_MAX_CLOSE_WAIT) { + keepCurrentClient = true; + yield(); + } + break; + } + } + + if (!keepCurrentClient) { + _currentClient = WiFiClient(); + _currentStatus = HC_NONE; + _currentUpload.reset(); + } +} +#endif #define MDNS_INSTANCE "esp-fs-webserver" diff --git a/src/esp-fs-webserver.h b/src/esp-fs-webserver.h index cc06d97..e178fa6 100644 --- a/src/esp-fs-webserver.h +++ b/src/esp-fs-webserver.h @@ -280,10 +280,10 @@ class FSWebServer : public WebServerClass IPAddress m_captiveIp = IPAddress(192, 168, 4, 1); ServerWebSocket* m_websocket; - // #if defined(ESP32) - // // Override default handleClient() method to increase connection speed - // void handleClient() override; - // #endif + #if defined(ESP32) + // Override default handleClient() method to increase connection speed + void handleClient() override; + #endif // Default handler for all URIs not defined above, use it to read files from filesystem bool captivePortal();