duck531a98 / esp8266-weather-station-epaper

use esp8266 to show weather forecast on 2.9inch e-paper
GNU General Public License v3.0
175 stars 40 forks source link

字符显示乱码 #3

Open jcyfkimi opened 5 years ago

jcyfkimi commented 5 years ago

我将data目录下的文件烧录进spi flash后,显示乱码,无论是中文还是英文,我尝试着将从flash读取的内容打印出来,不过有点不明白这个字体是如何转换的。望解答。

duck531a98 commented 5 years ago

你好,你要确保data目录下的文件都已经写入spiff中,可以试着看一下spiff中的文件列表。如果文件存在,是不会出现乱码问题的。字体的转换方法可以看看我字体转换工具的源码。

jcyfkimi commented 5 years ago

这个spiffs烧写很奇怪,一开始烧,文件都存在,就是各种乱码,然后我format了一遍,再烧,文件少了icon80,字符显示正常了,再烧一次,文件和现实都正常了。挺奇怪的。

duck531a98 commented 5 years ago

我觉得是线接触不好吧

jcyfkimi commented 5 years ago

恩,有点奇怪,不过好在目前搞定了,现在的问题是,heweather的api改到了v6,看你原来一次连接就能拿全的信息,现在得分多次,分了多次后,虽然信息能拿到了,但是要在送给epd显示的时候确显示不出来了,连清屏都不行。

duck531a98 commented 5 years ago

一次跟多次一样的,一次拿全的信息也是分别写入显示缓存最后一次性送到屏幕,不要每更新一点就送到屏幕,太快反应不过来。支持的字符串编码是utf-8。

jcyfkimi commented 5 years ago

you can use below code to check if the data file are written into the spi flash on setup function. Make sure all the files are exists.

void check_res_from_spiffs() { SPIFFS.begin(); File file; FSInfo fs_info; SPIFFS.info(fs_info); Serial.println("Before format:"); Serial.print("totalBytes="); Serial.println(fs_info.totalBytes, DEC); Serial.print("usedBytes="); Serial.println(fs_info.usedBytes, DEC); Serial.print("blockSize="); Serial.println(fs_info.blockSize, DEC); Serial.print("pageSize="); Serial.println(fs_info.pageSize, DEC); Serial.print("maxOpenFiles="); Serial.println(fs_info.maxOpenFiles, DEC); Serial.print("maxPathLength="); Serial.println(fs_info.maxPathLength, DEC); if (SPIFFS.exists("/font10")) { Serial.print("font10 exists, size = "); file = SPIFFS.open("/font10", "r"); Serial.println(file.size()); file.close(); } if (SPIFFS.exists("/font12")) { Serial.print("font12 exists, size = "); file = SPIFFS.open("/font12", "r"); Serial.println(file.size()); file.close(); } if (SPIFFS.exists("/font32")) { Serial.print("font32 exists, size = "); file = SPIFFS.open("/font32", "r"); Serial.println(file.size()); file.close(); } if (SPIFFS.exists("/weathericon")) { Serial.print("weathericon exists, size = "); file = SPIFFS.open("/weathericon", "r"); Serial.println(file.size()); file.close(); } if (SPIFFS.exists("/weathericon32")) { Serial.print("weathericon32 exists, size = "); file = SPIFFS.open("/weathericon32", "r"); Serial.println(file.size()); file.close(); } if (SPIFFS.exists("/weathericon80")) { Serial.print("weathericon80 exists, size = "); file = SPIFFS.open("/weathericon80", "r"); Serial.println(file.size()); file.close(); } SPIFFS.end(); }

38293312 notifications@github.com 于2018年8月19日周日 下午9:09写道:

I also encountered the same problem

[image: qq 20180819210123] https://user-images.githubusercontent.com/21971730/44309103-11284680-a3f4-11e8-9104-876749de891b.jpg

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/duck531a98/esp8266-weather-station-epaper/issues/3#issuecomment-414126744, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7kwDen6RWdntI9w9clbd7AMrsQWT50ks5uSWOHgaJpZM4VSDX9 .

38293312 commented 5 years ago

问题解决了,现在发现和你照片界面不一样,而且更新参数修改以后,从串口查看没有参数,如果按复位键更本没有有参数到屏上,简单来说就是不能启动。

jcyfkimi commented 5 years ago

heweather的api换了,博主的php还是使用V5的API,新注册的用户已经不让用了,所以没有数据,现在是V6,很多API都修改了,没有办法一次拿全数据,具体就去看heweather的官方文档吧,我最近没时间来弄这个。

38293312 notifications@github.com 于 2018年8月21日周二 15:48写道:

问题解决了,现在发现和你照片界面不一样,而且更新参数修改以后,从串口查看没有参数,如果按复位键更本没有有参数到屏上,简单来说就是不能启动。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/duck531a98/esp8266-weather-station-epaper/issues/3#issuecomment-414582856, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7kwK2Iv6DLzbK8eiKTIK8Gm43Y903Sks5uS7tjgaJpZM4VSDX9 .