完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你写的文件越多,它就越慢!!!!太疯狂了,从 2.0.0 到 2.4.0,我一直在与它作斗争,它总是一样,我已经改变了代码,代码逻辑等等……
无法让它工作。 运行此 Arduino 代码(它将格式化您的 SPIFFS),您会发现它变得越来越慢…… 为什么? 代码:全选//****************************************************************************** // SPIFFS TEST //****************************************************************************** #include void setup() { Serial.begin(115200); SPIFFS.begin(); } void removeAll() { #if 0 SPIFFS.remove("/1"); SPIFFS.remove("/2"); SPIFFS.remove("/3"); SPIFFS.remove("/4"); SPIFFS.remove("/5"); #endif SPIFFS.remove("/5"); SPIFFS.remove("/4"); SPIFFS.remove("/3"); SPIFFS.remove("/2"); SPIFFS.remove("/1"); } #define SECTOR 256 char buf[SECTOR]; void make(String f, int n) { int time; int packet = 0; Serial.printf("making %s length = %dn", f.c_str(), n); // SPIFFS.remove(f); File pESP = SPIFFS.open(f, "w"); time = millis(); while (n > 0) { if((packet++ % 20) == 0) { Serial.println(millis()-time); time = millis(); } int bytes = (n > SECTOR) ? SECTOR : n; n -= SECTOR; //memset(buf, n, sizeof(buf)); pESP.write((uint8_t*)buf, bytes); yield(); } pESP.close(); } void loop() { uint32_t first, second, third, fourth; Serial.printf("nFormatting...n"); SPIFFS.format(); if(0) { // was used to read and write at same time for tests... //make("/temp", 1234 + 12112 + 200220 + 454030 + 20220 + 100100); //fp = SPIFFS.open("temp", "r"); //fp.seek(0, SeekEnd); //fp.position(); //fp.seek(0, SeekSet); } Serial.println("first run"); uint32_t startTime = millis(); make("/1", 1234); make("/2", 12112); make("/3", 200220); make("/4", 454030); make("/5", 20220); make("/6", 100100); first = millis() - startTime; removeAll(); Serial.println("second run"); startTime = millis(); make("/1", 1234); make("/2", 12112); make("/3", 200220); make("/4", 454030); make("/5", 20220); make("/6", 100100); second = millis() - startTime; removeAll(); Serial.println("third run"); startTime = millis(); make("/1", 1234); make("/2", 12112); make("/3", 200220); make("/4", 454030); make("/5", 20220); make("/6", 100100); third = millis() - startTime; removeAll(); Serial.println("fourth run"); startTime = millis(); make("/1", 1234); make("/2", 12112); make("/3", 200220); make("/4", 454030); make("/5", 20220); make("/6", 100100); fourth = millis() - startTime; Serial.printf("Time first = %dmsn", first); Serial.printf("Time second = %dmsn", second); Serial.printf("Time third = %dmsn", third); Serial.printf("Time fourth = %dmsn", fourth); for(;;) yield(); } |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
543浏览 6评论
455浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
435浏览 5评论
437浏览 4评论
410浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 19:42 , Processed in 0.608247 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号