diff --git a/components/stm_pro_mode/include/stm_pro_mode.h b/components/stm_pro_mode/include/stm_pro_mode.h index b250320..9913d29 100755 --- a/components/stm_pro_mode/include/stm_pro_mode.h +++ b/components/stm_pro_mode/include/stm_pro_mode.h @@ -46,7 +46,9 @@ #define LOW 0 #define ACK 0x79 -#define SERIAL_TIMEOUT 5000 +// You may needs to increase this delay, on some chip with bigger flash memory it may takes some time to erase +// over 8s in my case. +#define SERIAL_TIMEOUT 15000 #define FILE_PATH_MAX 128 #define BASE_PATH "/spiffs/" diff --git a/components/stm_pro_mode/stm_pro_mode.c b/components/stm_pro_mode/stm_pro_mode.c index 17edcfa..f345279 100755 --- a/components/stm_pro_mode/stm_pro_mode.c +++ b/components/stm_pro_mode/stm_pro_mode.c @@ -245,14 +245,21 @@ int waitForSerialData(int dataCount, int timeout) { int timer = 0; int length = 0; - while (timer < timeout) + + int ticks = pdMS_TO_TICKS(timeout); + // Minimum one ticks + if (ticks == 0) + ticks = 1; + + while (timer < ticks) { uart_get_buffered_data_len(UART_CONTROLLER, (size_t *)&length); if (length >= dataCount) { return length; } - vTaskDelay(1 / portTICK_PERIOD_MS); + + vTaskDelay(1); timer++; } return 0; diff --git a/examples/file_serving_stm/sdkconfig.defaults b/examples/file_serving_stm/sdkconfig.defaults index be87a17..4562b66 100644 --- a/examples/file_serving_stm/sdkconfig.defaults +++ b/examples/file_serving_stm/sdkconfig.defaults @@ -3,3 +3,5 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB" CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv" CONFIG_PARTITION_TABLE_FILENAME="partitions_example.csv" + +CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 \ No newline at end of file