From c55e5e9d22787fcff106ce95dcaf3f59231e620a Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Thu, 24 Nov 2022 19:35:11 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + code/data/IdCard.txt | 794 ++++++++++++++++++++++++++++++++ code/data/picture/default/1.jpg | Bin 7544 -> 0 bytes code/data/picture/default/2.jpg | Bin 7544 -> 0 bytes code/data/picture/default/3.jpg | Bin 7527 -> 0 bytes code/data/picture/default/4.jpg | Bin 7498 -> 0 bytes code/main.py | 555 +++++++++++----------- code/t1/main.py | 123 +++++ code/ui/default.py | 463 +++++++++---------- 9 files changed, 1422 insertions(+), 514 deletions(-) create mode 100644 code/data/IdCard.txt delete mode 100644 code/data/picture/default/1.jpg delete mode 100644 code/data/picture/default/2.jpg delete mode 100644 code/data/picture/default/3.jpg delete mode 100644 code/data/picture/default/4.jpg create mode 100644 code/t1/main.py diff --git a/.gitignore b/.gitignore index 03fa991..0c1bf1e 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,4 @@ dmypy.json # Pyre type checker .pyre/ +/.idea/ diff --git a/code/data/IdCard.txt b/code/data/IdCard.txt new file mode 100644 index 0000000..54a221a --- /dev/null +++ b/code/data/IdCard.txt @@ -0,0 +1,794 @@ +{ +"北京市":"110000", +"天津市":"120000", +"河北省":"130000", +"石家庄市":"130100", +"辛集市":"130181", +"晋州市":"130183", +"新乐市":"130184", +"唐山市":"130200", +"遵化市":"130281", +"迁安市":"130283", +"滦州市":"130284", +"秦皇岛市":"130300", +"邯郸市":"130400", +"武安市":"130481", +"邢台市":"130500", +"南宫市":"130581", +"沙河市":"130582", +"保定市":"130600", +"涿州市":"130681", +"定州市":"130682", +"安国市":"130683", +"高碑店市":"130684", +"张家口市":"130700", +"承德市":"130800", +"平泉市":"130881", +"沧州市":"130900", +"泊头市":"130981", +"任丘市":"130982", +"黄骅市":"130983", +"河间市":"130984", +"廊坊市":"131000", +"霸州市":"131081", +"三河市":"131082", +"衡水市":"131100", +"深州市":"131182", +"山西省":"140000", +"太原市":"140100", +"古交市":"140181", +"大同市":"140200", +"阳泉市":"140300", +"长治市":"140400", +"晋城市":"140500", +"高平市":"140581", +"朔州市":"140600", +"怀仁市":"140681", +"晋中市":"140700", +"介休市":"140781", +"运城市":"140800", +"永济市":"140881", +"河津市":"140882", +"忻州市":"140900", +"原平市":"140981", +"临汾市":"141000", +"侯马市":"141081", +"霍州市":"141082", +"吕梁市":"141100", +"孝义市":"141181", +"汾阳市":"141182", +"呼和浩特市":"150100", +"土默特左旗":"150121", +"包头市":"150200", +"土默特右旗":"150221", +"达尔罕茂明安联合旗":"150223", +"乌海市":"150300", +"赤峰市":"150400", +"阿鲁科尔沁旗":"150421", +"巴林左旗":"150422", +"巴林右旗":"150423", +"克什克腾旗":"150425", +"翁牛特旗":"150426", +"喀喇沁旗":"150428", +"敖汉旗":"150430", +"通辽市":"150500", +"科尔沁左翼中旗":"150521", +"科尔沁左翼后旗":"150522", +"库伦旗":"150524", +"奈曼旗":"150525", +"扎鲁特旗":"150526", +"霍林郭勒市":"150581", +"鄂尔多斯市":"150600", +"达拉特旗":"150621", +"准格尔旗":"150622", +"鄂托克前旗":"150623", +"鄂托克旗":"150624", +"杭锦旗":"150625", +"乌审旗":"150626", +"伊金霍洛旗":"150627", +"呼伦贝尔市":"150700", +"阿荣旗":"150721", +"莫力达瓦达斡尔族自治旗":"150722", +"鄂伦春自治旗":"150723", +"鄂温克族自治旗":"150724", +"陈巴尔虎旗":"150725", +"新巴尔虎左旗":"150726", +"新巴尔虎右旗":"150727", +"满洲里市":"150781", +"牙克石市":"150782", +"扎兰屯市":"150783", +"额尔古纳市":"150784", +"根河市":"150785", +"巴彦淖尔市":"150800", +"乌拉特前旗":"150823", +"乌拉特中旗":"150824", +"乌拉特后旗":"150825", +"杭锦后旗":"150826", +"乌兰察布市":"150900", +"察哈尔右翼前旗":"150926", +"察哈尔右翼中旗":"150927", +"察哈尔右翼后旗":"150928", +"四子王旗":"150929", +"丰镇市":"150981", +"兴安盟":"152200", +"乌兰浩特市":"152201", +"阿尔山市":"152202", +"科尔沁右翼前旗":"152221", +"科尔沁右翼中旗":"152222", +"扎赉特旗":"152223", +"锡林郭勒盟":"152500", +"二连浩特市":"152501", +"锡林浩特市":"152502", +"阿巴嘎旗":"152522", +"苏尼特左旗":"152523", +"苏尼特右旗":"152524", +"东乌珠穆沁旗":"152525", +"西乌珠穆沁旗":"152526", +"太仆寺旗":"152527", +"镶黄旗":"152528", +"正镶白旗":"152529", +"正蓝旗":"152530", +"阿拉善盟":"152900", +"阿拉善左旗":"152921", +"阿拉善右旗":"152922", +"额济纳旗":"152923", +"辽宁省":"210000", +"沈阳市":"210100", +"新民市":"210181", +"大连市":"210200", +"瓦房店市":"210281", +"庄河市":"210283", +"鞍山市":"210300", +"海城市":"210381", +"抚顺市":"210400", +"本溪市":"210500", +"丹东市":"210600", +"东港市":"210681", +"凤城市":"210682", +"锦州市":"210700", +"凌海市":"210781", +"北镇市":"210782", +"营口市":"210800", +"盖州市":"210881", +"大石桥市":"210882", +"阜新市":"210900", +"辽阳市":"211000", +"灯塔市":"211081", +"盘锦市":"211100", +"铁岭市":"211200", +"调兵山市":"211281", +"开原市":"211282", +"朝阳市":"211300", +"北票市":"211381", +"凌源市":"211382", +"葫芦岛市":"211400", +"兴城市":"211481", +"吉林省":"220000", +"长春市":"220100", +"榆树市":"220182", +"德惠市":"220183", +"吉林市":"220200", +"蛟河市":"220281", +"桦甸市":"220282", +"舒兰市":"220283", +"磐石市":"220284", +"四平市":"220300", +"公主岭市":"220381", +"双辽市":"220382", +"辽源市":"220400", +"通化市":"220500", +"梅河口市":"220581", +"集安市":"220582", +"白山市":"220600", +"临江市":"220681", +"松原市":"220700", +"扶余市":"220781", +"白城市":"220800", +"洮南市":"220881", +"大安市":"220882", +"延边朝鲜族自治州":"222400", +"延吉市":"222401", +"图们市":"222402", +"敦化市":"222403", +"珲春市":"222404", +"龙井市":"222405", +"和龙市":"222406", +"黑龙江省":"230000", +"哈尔滨市":"230100", +"尚志市":"230183", +"五常市":"230184", +"齐齐哈尔市":"230200", +"讷河市":"230281", +"鸡西市":"230300", +"虎林市":"230381", +"密山市":"230382", +"鹤岗市":"230400", +"双鸭山市":"230500", +"大庆市":"230600", +"伊春市":"230700", +"铁力市":"230781", +"佳木斯市":"230800", +"同江市":"230881", +"富锦市":"230882", +"抚远市":"230883", +"七台河市":"230900", +"牡丹江市":"231000", +"绥芬河市":"231081", +"海林市":"231083", +"宁安市":"231084", +"穆棱市":"231085", +"东宁市":"231086", +"黑河市":"231100", +"北安市":"231181", +"五大连池市":"231182", +"嫩江市":"231183", +"绥化市":"231200", +"安达市":"231281", +"肇东市":"231282", +"海伦市":"231283", +"漠河市":"232701", +"上海市":"310000", +"江苏省":"320000", +"南京市":"320100", +"无锡市":"320200", +"江阴市":"320281", +"宜兴市":"320282", +"徐州市":"320300", +"新沂市":"320381", +"邳州市":"320382", +"常州市":"320400", +"溧阳市":"320481", +"苏州市":"320500", +"常熟市":"320581", +"张家港市":"320582", +"昆山市":"320583", +"太仓市":"320585", +"南通市":"320600", +"启东市":"320681", +"如皋市":"320682", +"海门市":"320684", +"海安市":"320685", +"连云港市":"320700", +"淮安市":"320800", +"盐城市":"320900", +"东台市":"320981", +"扬州市":"321000", +"仪征市":"321081", +"高邮市":"321084", +"镇江市":"321100", +"丹阳市":"321181", +"扬中市":"321182", +"句容市":"321183", +"泰州市":"321200", +"兴化市":"321281", +"靖江市":"321282", +"泰兴市":"321283", +"宿迁市":"321300", +"浙江省":"330000", +"杭州市":"330100", +"建德市":"330182", +"宁波市":"330200", +"余姚市":"330281", +"慈溪市":"330282", +"温州市":"330300", +"瑞安市":"330381", +"乐清市":"330382", +"龙港市":"330383", +"嘉兴市":"330400", +"海宁市":"330481", +"平湖市":"330482", +"桐乡市":"330483", +"湖州市":"330500", +"绍兴市":"330600", +"诸暨市":"330681", +"嵊州市":"330683", +"金华市":"330700", +"兰溪市":"330781", +"义乌市":"330782", +"东阳市":"330783", +"永康市":"330784", +"衢州市":"330800", +"江山市":"330881", +"舟山市":"330900", +"台州市":"331000", +"温岭市":"331081", +"临海市":"331082", +"玉环市":"331083", +"丽水市":"331100", +"龙泉市":"331181", +"安徽省":"340000", +"合肥市":"340100", +"巢湖市":"340181", +"芜湖市":"340200", +"无为市":"340281", +"蚌埠市":"340300", +"淮南市":"340400", +"马鞍山市":"340500", +"淮北市":"340600", +"铜陵市":"340700", +"安庆市":"340800", +"桐城市":"340881", +"潜山市":"340882", +"黄山市":"341000", +"滁州市":"341100", +"天长市":"341181", +"明光市":"341182", +"阜阳市":"341200", +"界首市":"341282", +"宿州市":"341300", +"六安市":"341500", +"亳州市":"341600", +"池州市":"341700", +"宣城市":"341800", +"宁国市":"341881", +"广德市":"341882", +"福建省":"350000", +"福州市":"350100", +"福清市":"350181", +"厦门市":"350200", +"莆田市":"350300", +"三明市":"350400", +"永安市":"350481", +"泉州市":"350500", +"石狮市":"350581", +"晋江市":"350582", +"南安市":"350583", +"漳州市":"350600", +"龙海市":"350681", +"南平市":"350700", +"邵武市":"350781", +"武夷山市":"350782", +"建瓯市":"350783", +"龙岩市":"350800", +"漳平市":"350881", +"宁德市":"350900", +"福安市":"350981", +"福鼎市":"350982", +"江西省":"360000", +"南昌市":"360100", +"景德镇市":"360200", +"乐平市":"360281", +"萍乡市":"360300", +"九江市":"360400", +"瑞昌市":"360481", +"共青城市":"360482", +"庐山市":"360483", +"新余市":"360500", +"鹰潭市":"360600", +"贵溪市":"360681", +"赣州市":"360700", +"瑞金市":"360781", +"吉安市":"360800", +"井冈山市":"360881", +"宜春市":"360900", +"丰城市":"360981", +"樟树市":"360982", +"高安市":"360983", +"抚州市":"361000", +"上饶市":"361100", +"德兴市":"361181", +"山东省":"370000", +"济南市":"370100", +"青岛市":"370200", +"胶州市":"370281", +"平度市":"370283", +"莱西市":"370285", +"淄博市":"370300", +"枣庄市":"370400", +"滕州市":"370481", +"东营市":"370500", +"烟台市":"370600", +"龙口市":"370681", +"莱阳市":"370682", +"莱州市":"370683", +"蓬莱市":"370684", +"招远市":"370685", +"栖霞市":"370686", +"海阳市":"370687", +"潍坊市":"370700", +"青州市":"370781", +"诸城市":"370782", +"寿光市":"370783", +"安丘市":"370784", +"高密市":"370785", +"昌邑市":"370786", +"济宁市":"370800", +"曲阜市":"370881", +"邹城市":"370883", +"泰安市":"370900", +"新泰市":"370982", +"肥城市":"370983", +"威海市":"371000", +"荣成市":"371082", +"乳山市":"371083", +"日照市":"371100", +"临沂市":"371300", +"德州市":"371400", +"乐陵市":"371481", +"禹城市":"371482", +"聊城市":"371500", +"临清市":"371581", +"滨州市":"371600", +"邹平市":"371681", +"菏泽市":"371700", +"河南省":"410000", +"郑州市":"410100", +"巩义市":"410181", +"荥阳市":"410182", +"新密市":"410183", +"新郑市":"410184", +"登封市":"410185", +"开封市":"410200", +"洛阳市":"410300", +"偃师市":"410381", +"平顶山市":"410400", +"舞钢市":"410481", +"汝州市":"410482", +"安阳市":"410500", +"林州市":"410581", +"鹤壁市":"410600", +"新乡市":"410700", +"卫辉市":"410781", +"辉县市":"410782", +"长垣市":"410783", +"焦作市":"410800", +"沁阳市":"410882", +"孟州市":"410883", +"濮阳市":"410900", +"许昌市":"411000", +"禹州市":"411081", +"长葛市":"411082", +"漯河市":"411100", +"三门峡市":"411200", +"义马市":"411281", +"灵宝市":"411282", +"南阳市":"411300", +"邓州市":"411381", +"商丘市":"411400", +"永城市":"411481", +"信阳市":"411500", +"周口市":"411600", +"项城市":"411681", +"驻马店市":"411700", +"济源市":"419001", +"湖北省":"420000", +"武汉市":"420100", +"黄石市":"420200", +"大冶市":"420281", +"十堰市":"420300", +"丹江口市":"420381", +"宜昌市":"420500", +"宜都市":"420581", +"当阳市":"420582", +"枝江市":"420583", +"襄阳市":"420600", +"老河口市":"420682", +"枣阳市":"420683", +"宜城市":"420684", +"鄂州市":"420700", +"荆门市":"420800", +"钟祥市":"420881", +"京山市":"420882", +"孝感市":"420900", +"应城市":"420981", +"安陆市":"420982", +"汉川市":"420984", +"荆州市":"421000", +"石首市":"421081", +"洪湖市":"421083", +"松滋市":"421087", +"黄冈市":"421100", +"麻城市":"421181", +"武穴市":"421182", +"咸宁市":"421200", +"赤壁市":"421281", +"随州市":"421300", +"广水市":"421381", +"恩施土家族苗族自治州":"422800", +"恩施市":"422801", +"利川市":"422802", +"仙桃市":"429004", +"潜江市":"429005", +"天门市":"429006", +"湖南省":"430000", +"长沙市":"430100", +"浏阳市":"430181", +"宁乡市":"430182", +"株洲市":"430200", +"醴陵市":"430281", +"湘潭市":"430300", +"湘乡市":"430381", +"韶山市":"430382", +"衡阳市":"430400", +"耒阳市":"430481", +"常宁市":"430482", +"邵阳市":"430500", +"武冈市":"430581", +"邵东市":"430582", +"岳阳市":"430600", +"汨罗市":"430681", +"临湘市":"430682", +"常德市":"430700", +"津市市":"430781", +"张家界市":"430800", +"益阳市":"430900", +"沅江市":"430981", +"郴州市":"431000", +"资兴市":"431081", +"永州市":"431100", +"怀化市":"431200", +"洪江市":"431281", +"娄底市":"431300", +"冷水江市":"431381", +"涟源市":"431382", +"湘西土家族苗族自治州":"433100", +"吉首市":"433101", +"广东省":"440000", +"广州市":"440100", +"韶关市":"440200", +"乐昌市":"440281", +"南雄市":"440282", +"深圳市":"440300", +"珠海市":"440400", +"汕头市":"440500", +"佛山市":"440600", +"江门市":"440700", +"台山市":"440781", +"开平市":"440783", +"鹤山市":"440784", +"恩平市":"440785", +"湛江市":"440800", +"廉江市":"440881", +"雷州市":"440882", +"吴川市":"440883", +"茂名市":"440900", +"高州市":"440981", +"化州市":"440982", +"信宜市":"440983", +"肇庆市":"441200", +"四会市":"441284", +"惠州市":"441300", +"梅州市":"441400", +"兴宁市":"441481", +"汕尾市":"441500", +"陆丰市":"441581", +"河源市":"441600", +"阳江市":"441700", +"阳春市":"441781", +"清远市":"441800", +"英德市":"441881", +"连州市":"441882", +"东莞市":"441900", +"中山市":"442000", +"潮州市":"445100", +"揭阳市":"445200", +"普宁市":"445281", +"云浮市":"445300", +"罗定市":"445381", +"南宁市":"450100", +"柳州市":"450200", +"桂林市":"450300", +"荔浦市":"450381", +"梧州市":"450400", +"岑溪市":"450481", +"北海市":"450500", +"防城港市":"450600", +"东兴市":"450681", +"钦州市":"450700", +"贵港市":"450800", +"桂平市":"450881", +"玉林市":"450900", +"北流市":"450981", +"百色市":"451000", +"靖西市":"451081", +"平果市":"451082", +"贺州市":"451100", +"河池市":"451200", +"来宾市":"451300", +"合山市":"451381", +"崇左市":"451400", +"凭祥市":"451481", +"海南省":"460000", +"海口市":"460100", +"三亚市":"460200", +"三沙市":"460300", +"儋州市":"460400", +"五指山市":"469001", +"琼海市":"469002", +"文昌市":"469005", +"万宁市":"469006", +"东方市":"469007", +"重庆市":"500000", +"四川省":"510000", +"成都市":"510100", +"都江堰市":"510181", +"彭州市":"510182", +"邛崃市":"510183", +"崇州市":"510184", +"简阳市":"510185", +"自贡市":"510300", +"攀枝花市":"510400", +"泸州市":"510500", +"德阳市":"510600", +"广汉市":"510681", +"什邡市":"510682", +"绵竹市":"510683", +"绵阳市":"510700", +"江油市":"510781", +"广元市":"510800", +"遂宁市":"510900", +"射洪市":"510981", +"内江市":"511000", +"隆昌市":"511083", +"乐山市":"511100", +"峨眉山市":"511181", +"南充市":"511300", +"阆中市":"511381", +"眉山市":"511400", +"宜宾市":"511500", +"广安市":"511600", +"华蓥市":"511681", +"达州市":"511700", +"万源市":"511781", +"雅安市":"511800", +"巴中市":"511900", +"资阳市":"512000", +"阿坝藏族羌族自治州":"513200", +"马尔康市":"513201", +"甘孜藏族自治州":"513300", +"康定市":"513301", +"凉山彝族自治州":"513400", +"西昌市":"513401", +"贵州省":"520000", +"贵阳市":"520100", +"清镇市":"520181", +"六盘水市":"520200", +"盘州市":"520281", +"遵义市":"520300", +"赤水市":"520381", +"仁怀市":"520382", +"安顺市":"520400", +"毕节市":"520500", +"铜仁市":"520600", +"黔西南布依族苗族自治州":"522300", +"兴义市":"522301", +"兴仁市":"522302", +"黔东南苗族侗族自治州":"522600", +"凯里市":"522601", +"黔南布依族苗族自治州":"522700", +"都匀市":"522701", +"福泉市":"522702", +"云南省":"530000", +"昆明市":"530100", +"安宁市":"530181", +"曲靖市":"530300", +"宣威市":"530381", +"玉溪市":"530400", +"澄江市":"530481", +"保山市":"530500", +"腾冲市":"530581", +"昭通市":"530600", +"水富市":"530681", +"丽江市":"530700", +"普洱市":"530800", +"临沧市":"530900", +"楚雄彝族自治州":"532300", +"楚雄市":"532301", +"红河哈尼族彝族自治州":"532500", +"个旧市":"532501", +"开远市":"532502", +"蒙自市":"532503", +"弥勒市":"532504", +"文山壮族苗族自治州":"532600", +"文山市":"532601", +"西双版纳傣族自治州":"532800", +"景洪市":"532801", +"大理白族自治州":"532900", +"大理市":"532901", +"德宏傣族景颇族自治州":"533100", +"瑞丽市":"533102", +"芒市":"533103", +"怒江傈僳族自治州":"533300", +"泸水市":"533301", +"迪庆藏族自治州":"533400", +"香格里拉市":"533401", +"拉萨市":"540100", +"日喀则市":"540200", +"昌都市":"540300", +"林芝市":"540400", +"山南市":"540500", +"那曲市":"540600", +"陕西省":"610000", +"西安市":"610100", +"铜川市":"610200", +"宝鸡市":"610300", +"咸阳市":"610400", +"兴平市":"610481", +"彬州市":"610482", +"渭南市":"610500", +"韩城市":"610581", +"华阴市":"610582", +"延安市":"610600", +"子长市":"610681", +"汉中市":"610700", +"榆林市":"610800", +"神木市":"610881", +"安康市":"610900", +"商洛市":"611000", +"甘肃省":"620000", +"兰州市":"620100", +"嘉峪关市":"620200", +"金昌市":"620300", +"白银市":"620400", +"天水市":"620500", +"武威市":"620600", +"张掖市":"620700", +"平凉市":"620800", +"华亭市":"620881", +"酒泉市":"620900", +"玉门市":"620981", +"敦煌市":"620982", +"庆阳市":"621000", +"定西市":"621100", +"陇南市":"621200", +"临夏回族自治州":"622900", +"临夏市":"622901", +"甘南藏族自治州":"623000", +"合作市":"623001", +"青海省":"630000", +"西宁市":"630100", +"海东市":"630200", +"海北藏族自治州":"632200", +"黄南藏族自治州":"632300", +"海南藏族自治州":"632500", +"果洛藏族自治州":"632600", +"玉树藏族自治州":"632700", +"玉树市":"632701", +"海西蒙古族藏族自治州":"632800", +"格尔木市":"632801", +"德令哈市":"632802", +"茫崖市":"632803", +"银川市":"640100", +"灵武市":"640181", +"石嘴山市":"640200", +"吴忠市":"640300", +"青铜峡市":"640381", +"固原市":"640400", +"中卫市":"640500", +"乌鲁木齐市":"650100", +"克拉玛依市":"650200", +"吐鲁番市":"650400", +"哈密市":"650500", +"昌吉回族自治州":"652300", +"昌吉市":"652301", +"阜康市":"652302", +"博尔塔拉蒙古自治州":"652700", +"博乐市":"652701", +"阿拉山口市":"652702", +"巴音郭楞蒙古自治州":"652800", +"库尔勒市":"652801", +"阿克苏市":"652901", +"库车市":"652902", +"克孜勒苏柯尔克孜自治州":"653000", +"阿图什市":"653001", +"喀什市":"653101", +"和田市":"653201", +"伊犁哈萨克自治州":"654000", +"伊宁市":"654002", +"奎屯市":"654003", +"霍尔果斯市":"654004", +"塔城市":"654201", +"乌苏市":"654202", +"阿勒泰市":"654301", +"石河子市":"659001", +"阿拉尔市":"659002", +"图木舒克市":"659003", +"五家渠市":"659004", +"北屯市":"659005", +"铁门关市":"659006", +"双河市":"659007", +"可克达拉市":"659008", +"昆玉市":"659009", +"胡杨河市":"659010", +"台湾省":"710000", +} \ No newline at end of file diff --git a/code/data/picture/default/1.jpg b/code/data/picture/default/1.jpg deleted file mode 100644 index e21550a4642ae68641faf02487ff24d4e6d9d1ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7544 zcmeHLXH-+$w%$PKy$VPPB!JXVq=eq3C?L{{0-=`>2qp9)y%UP46cLarO0UunAXSPe zO+diV6;Tl>dFVa&-uLtUe`k)d$C`VsI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n4twHikkehR!nANkJ7r(ZHi%zY zL|-h7%RDu=jiE{!lgAZDK9mDrOxPQ8PC|ZEa{zX!=o9b1)%=`V@i@fx*S(*&7i)td zp`WXzkfz@5C+xbaL7`2GNvJoa_It-WmL~fSElQ~I=ZR;Lq&{z*i2GeB+ z2`lXms48f}YHtp8^r7`wI5GoMQF>n)D&?Zppmn4UH$Bzk7_}&j69{?6)MCKwBX?L6 z=>~Yp^exGns>#{uVsJte=yle!2o)N7#*rEU5;v)^lbTTGmSf2ebA>CCmN_$0o2ePC z@T9acWc%r^@d}ZXixD{X_0n!UP0!LAKjC~XH0hg9->E2-j+SMrWLGaV9g>f^nYq@? zTe_ONu)x~`iJ#RYiz1;7EG*E>$s1&Hn=#p(aUa3Y{rQhAsF~k0>7e3kE|C?qYBVcj z9e=k+m!7XZ+OI#@dbOG1_KSrK19nB%4PA@jSbJS#pTgE2$!)Jxht0G->+HO)U)!T7fM@sX zHHd1PzT}e;t5__b@St9@NV|XqYq%g!mlT|=7<~j!GasIoA^0S6wVZ7EM9coNPUB0upC1LukmHK(yx@*s z``MxU*NX9HA0iEGuRnQYd3!0*GxfOC*U+qb%hRL4>+L9~&)%bEKSd7mGBj9S0*0nA z6I;q1c26^cGY3Z)dzAxgM{E*>$Rl+*B$0C8I&V6&ybfbAqK3=-VuXys(+Lr|@1MOO zb`wnow@mfYl@3S!aExAXk=Iv^ENNS=LQjN#+o>Y~2*)LbyQs!(!Vk~ojn-OGj@G&t^yfnN z#*4BdT))Dyl?X>Eq{MIapiV)s?6?H YRk22dQ2-SnjGMB(ynr%D62{N}57RZ?!~g&Q diff --git a/code/data/picture/default/2.jpg b/code/data/picture/default/2.jpg deleted file mode 100644 index 205f0a1b1db9801df7fa358e11b59f82b9b0bb60..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7544 zcmeHLWmr_*+TKH#q#!8ZFu>5v4Bedq(%s#|Fr-Kd(v1jG0>UUE-Jz7kkkU0Eh$s>U zh@c1u{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Wh?jeXY`%*YG#FiI^ z4S(qLF^b6mL2SXr;ya)U7S@fb`4zLJ?y4xv%sPISj>MrkI`)Fcs? zCt^oW+5gyD2~w>O&H3^p56HTd$o`sy9Fu2E!b=NS(9>qO8~#);|MRtbfdv7ATPiyj zaX(M9ySAR507?3iMXn3HIekbY^MgZ~YKMMlQ6VO0nt=zb;rF`x10SkiB?%1Rb<@#J zyDj17{`}|`)h_Ovw2|>(%B1-aO=cfKg)bI3$stlU%r+7Uqj=g9M^-M;WR$sCO+q9+ zS+)K>_~ezb=C4q~PqALw?Bi8j8E}=MAvzcI`!CKbmMx|X_uSdkJ@Itrm%g*na+|nP z4OjG9?R%9q$yw6aHZW_?yLCQFIIhiopCL06{H6ScU+3kGd-mm{IvO<7%i9+P`8y~p zBud4-Erbl)Ny%R{d+5v0Z%VTgs>&7^$N^6r<;gT`<2m$!nP#*JafO5zS?7 zsQU!O-Xov0OafUy@No;GqA`S_u}Mfob~dj7qCT4kW|UpKNvv)BExSShHULcx`mz0W zQ2%`giMGCv;ugARoBrn#@8>c2{k`0#2g`CqtJcqP0PXO=-ZNzI9%t`sNvpr$l!Ab# zB>2|baJadlfVPr&!AXhuGUf%!W+#t>1{MQX^HL~nU%gp8P^s@}T4iu2}Ce)x0CgM{4NvL(9{N85zv+qqq+HOZTE!`|{;msM-u(i zp^LL>rZMsK=>gxV&WDxk`%{r|Vb3CW#wTAYX*B%m|7Mnq{&v~*Vy$wvdGPNGr%2r5 FzW^`6x{?3@ diff --git a/code/data/picture/default/4.jpg b/code/data/picture/default/4.jpg deleted file mode 100644 index 0b124d8e6d72230f44f651a8fe524f8e3cdd569f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7498 zcmeHLXH-+$w%&mN0Rf40DTV;jApvPoN{}ufy-1VLdkbBWF494o2vVd5R62rsq)6{A zbdcT=R74QSL*Kdgj`#2We`k)d$6kBSwdObHH`dtm+lw$sSR~hWz+yd6A|h_y!d5o! z7+Ya$cUKXAD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2y^~`NVaPG^)vy0P&yKhwbcGWEQJZHaoNIt@N zD?GbxRjpJ4?O2;ljv{zBEdEm_s{^<&c`?CnR7?Ye=R6#T!EsnMA|x>b(Gy)4ulY6ask|e4cg~ z%*qUTy29_iKlt*|<0=AxIZrF9sD4ea<1?;fi`U+&s4fwW!QrB4OABzU8a{N=pA 15 : - + # 超时判断,15秒没连接成功判定为超时 + if time.time() - start_time > 15: wlan.active(False) - - #点亮LED表示没连接上WiFi + + # 点亮LED表示没连接上WiFi WIFI_LED.value(1) - + print('WIFI Connected Timeout!') - + return False - - #连接成功,熄灭LED + + # 连接成功,熄灭LED WIFI_LED.value(0) - #串口打印信息 + # 串口打印信息 print('network information:', wlan.ifconfig()) - + return True - -#设置NTP时间偏移量,就是我们所谓的时区,中国在UTC +8 的时区计算方式: 3155673600 - 8*3600 = 3155644800 -#3155673600 是默认的UTC,以秒计算偏移量。 + +# 设置NTP时间偏移量,就是我们所谓的时区,中国在UTC +8 的时区计算方式: 3155673600 - 8*3600 = 3155644800 +# 3155673600 是默认的UTC,以秒计算偏移量。 ntptime.NTP_DELTA = 3155644800 ntptime.host = 'ntp1.aliyun.com' -#获取网络时间 + +# 获取网络时间 def ntp_get(): - - for i in range(10): #最多尝试获取10次 - - try: - ntptime.settime() #获取网络时间 - print("ntp time(BeiJing): ",rtc.datetime()) + for i in range(10): # 最多尝试获取10次 + + try: + ntptime.settime() # 获取网络时间 + print("ntp time(BeiJing): ", rtc.datetime()) return True except: print("Can not get time!") - + time.sleep_ms(500) -#记录天气爬虫次数,用于调试 + +# 记录天气爬虫次数,用于调试 total = 0 -lost = 0 +lost = 0 + -#网页获取天气数据 +# 网页获取天气数据 def weather_get(datetime): - - global weather,lost,total,city + global weather, lost, total, city + + for i in range(5): # 失败会重试,最多5次 - for i in range(5):#失败会重试,最多5次 - try: - - myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/"+city[1]+".shtml") - text = myURL.read(39000+100*i).decode('utf-8') #抓取约前4W个字符,节省内存。 - - #获取当日天气、高低温 - text1=re.search('id="hidden_title" value="' + '(.*?)' + '°C',text).group(1) - weather[0] = text1.split()[2] #当日天气 - weather[1] = str(min(list(map(int,text1.split()[3].split('/'))))) #当天最低温 - weather[2] = str(max(list(map(int,text1.split()[3].split('/'))))) #当天最高温 - - #获取实时天气 - text2 = json.loads(re.search('var hour3data=' + '(.*?)' + '',text).group(1)) + + myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") + text = myURL.read(39000 + 100 * i).decode('utf-8') # 抓取约前4W个字符,节省内存。 + + # 获取当日天气、高低温 + text1 = re.search('id="hidden_title" value="' + '(.*?)' + '°C', text).group(1) + weather[0] = text1.split()[2] # 当日天气 + weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 + weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 + + # 获取实时天气 + text2 = json.loads(re.search('var hour3data=' + '(.*?)' + '', text).group(1)) for i in range(len(text2['1d'])): - - if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]:#日期相同 - - if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): #小时 + + if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 + + if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): - - weather[3] = text2['1d'][i].split(',')[2] #实时天气 + + weather[3] = text2['1d'][i].split(',')[2] # 实时天气 else: - - weather[3] = text2['1d'][i-1].split(',')[2] #实时天气 + + weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 break - #获取实时空气质量、风向风力、温湿度 - text3 = json.loads(re.search('var observe24h_data = ' + '(.*?)' + ';',text).group(1)) + # 获取实时空气质量、风向风力、温湿度 + text3 = json.loads(re.search('var observe24h_data = ' + '(.*?)' + ';', text).group(1)) for i in range(len(text3['od']['od2'])): - weather[4] = text3['od']['od2'][i]['od28'] #空气质量 + weather[4] = text3['od']['od2'][i]['od28'] # 空气质量 if weather[4] != '': break - + for i in range(len(text3['od']['od2'])): - weather[5] = text3['od']['od2'][i]['od24'] #实时风向 + weather[5] = text3['od']['od2'][i]['od24'] # 实时风向 if weather[5] != '': break for i in range(len(text3['od']['od2'])): - weather[6] = text3['od']['od2'][i]['od25'] #实时风力级数 + weather[6] = text3['od']['od2'][i]['od25'] # 实时风力级数 if weather[6] != '': break for i in range(len(text3['od']['od2'])): - weather[8] = text3['od']['od2'][i]['od27'] #相对湿度 + weather[8] = text3['od']['od2'][i]['od27'] # 相对湿度 if weather[8] != '': break for i in range(len(text3['od']['od2'])): - weather[7] = text3['od']['od2'][i]['od22'] #温度 + weather[7] = text3['od']['od2'][i]['od22'] # 温度 if weather[7] != '': - break - - total = total+1 - + break + + total = total + 1 + return None - + except: - - print("Can not get weather!",i) + + print("Can not get weather!", i) lost = lost + 1 - gc.collect() #内存回收 - + gc.collect() # 内存回收 + time.sleep_ms(1000) -#信息打印 + +# 信息打印 def info_print(): - - global city,weather + global city, weather print(rtc.datetime()) - - print('城市:',city[0],city[1]) - - print('当日天气:',weather[0]) - print('当日最低温:',weather[1]) - print('当日最高温:',weather[2]) - print('实时天气:',weather[3]) - print('实时空气质量:',weather[4]) - print('实时风向:',weather[5]) - print('实时风力级数:',weather[6]) - print('实时温度:',weather[7]) - print('实时湿度:',weather[8]) - - print('total:',total) - print('lost:',lost) - -#获取城市信息 + + print('城市:', city[0], city[1]) + + print('当日天气:', weather[0]) + print('当日最低温:', weather[1]) + print('当日最高温:', weather[2]) + print('实时天气:', weather[3]) + print('实时空气质量:', weather[4]) + print('实时风向:', weather[5]) + print('实时风力级数:', weather[6]) + print('实时温度:', weather[7]) + print('实时湿度:', weather[8]) + + print('total:', total) + print('lost:', lost) + + +# 获取城市信息 def city_get(): - global city - - #获取城市编码 - f = open('wifi.txt', 'r') #获取账号密码 - info = json.loads(f.read()) - f.close() - - city[0] = info['CITY'] - - #获取城市名称 + + # 获取城市编码 + with open('wifi.txt', 'r') as f: + info = json.loads(f.read()) + f.close() + + city[0] = info['CITY'] + + # 获取城市名称 f = open('/data/CityCode.txt', 'r') num = 0 while True: - text = f.readline() - if city[0] in text: - - if city[0] == re.match(r'"(.+?)"',text).group(1): #城市名称完全一样 - - city[1] = re.match(r'"(.+?)"',text.split(': ')[1]).group(1) #"获取城市编码" - + if city[0] == re.match(r'"(.+?)"', text).group(1): # 城市名称完全一样 + city[1] = re.match(r'"(.+?)"', text.split(': ')[1]).group(1) # "获取城市编码" break - - elif '}' in text: #结束,没这个城市。 + elif '}' in text: # 结束,没这个城市。 print('No City Name!') break - + num = num + 1 - + if num == 300: - - gc.collect() #内存回收 + gc.collect() # 内存回收 num = 0 - + f.close() - city_node = 0 - - #city.txt文件存在,判断文件是否已经有当前城市字库 - if 'city.txt' in os.listdir('/data/'): - + + # city.txt文件存在,判断文件是否已经有当前城市字库 + if 'city.txt' in os.listdir('/data/'): f = open('/data/city.txt', 'r') - city_text = f.read() - for i in range(len(city[0])): - + if city[0][i] in city_text: - - if i == len(city[0])-1: #全部字体都有 - - city_node = 1 #标记字符信息正常 - f.close() - - #城市字库正常,无需制作 + + if i == len(city[0]) - 1: # 全部字体都有 + + city_node = 1 # 标记字符信息正常 + f.close() + + # 城市字库正常,无需制作 if city_node == 1: - pass - - else: #获取字库文件并保存 - - #生成城市字模文件 - city_font= {} - + + else: # 获取字库文件并保存 + # 生成城市字模文件 + city_font = {} + for i in range(len(city[0])): - - f = open('/data/Fonts/fonts_city.py', 'r') - + + f = open('/data/Fonts/fonts_city.py', 'r') + while True: - + text = f.readline() - + if city[0][i] in text: - + while True: - + text = text + f.readline() if ')' in text: - a = re.search('[(]' + '(.*?)' + '[)]',text).group(1).replace('\r\n','').replace(' ','').split(',') + a = re.search('[(]' + '(.*?)' + '[)]', text).group(1) \ + .replace('\r\n', '') \ + .replace(' ', '').split(',') for j in range(len(a)): a[j] = int(a[j]) - + city_font[city[0][i]] = a break break - - if not text: #读完 + + if not text: # 读完 print("No City Fonts.") break - + f.close() - - - f = open('/data/city.txt', 'w') #以写的方式打开一个文件,没有该文件就自动新建 - f.write((json.dumps(city_font))) #写入数据 - f.close() #每次操作完记得关闭文件 - - gc.collect() #内存回收 - -#按键 -KEY=Pin(9,Pin.IN,Pin.PULL_UP) #构建KEY对象 - -#按键中断触发 + + f = open('/data/city.txt', 'w') # 以写的方式打开一个文件,没有该文件就自动新建 + f.write((json.dumps(city_font))) # 写入数据 + f.close() # 每次操作完记得关闭文件 + + gc.collect() # 内存回收 + + +# 按键 +KEY = Pin(9, Pin.IN, Pin.PULL_UP) # 构建KEY对象 + + +# 按键中断触发 def key(KEY): - - global ui_choice,ui_qty - time.sleep_ms(10) #消除抖动 - if KEY.value() == 0: #确认按键被按下 - - #短按切换UI + global ui_choice, ui_qty + time.sleep_ms(10) # 消除抖动 + if KEY.value() == 0: # 确认按键被按下 + + # 短按切换UI global_var.UI_Change = 1 ui_choice = ui_choice + 1 - if ui_choice == ui_qty : #UI数量 - ui_choice =0 - - #出厂模式 + if ui_choice == ui_qty: # UI数量 + ui_choice = 0 + + # 出厂模式 start = time.ticks_ms() while KEY.value() == 0: - - if time.ticks_ms() - start >5000: #长按按键5秒 - - WIFI_LED.value(1) #指示灯亮 + + if time.ticks_ms() - start > 5000: # 长按按键5秒 + + WIFI_LED.value(1) # 指示灯亮 print("Factory Mode!") try: os.remove('wifi.txt') print('Remove wifi.txt') except: print('no wifi.txt') - - machine.reset() #重启开发板。 - -KEY.irq(key,Pin.IRQ_FALLING) #定义中断,下降沿触发 + machine.reset() # 重启开发板。 + + +KEY.irq(key, Pin.IRQ_FALLING) # 定义中断,下降沿触发 ################ # 主程序 # ################ +if __name__ == '__main__': + # 没有WiFi配置文件,出厂模式 + while 'wifi.txt' not in os.listdir(): + ap.startAP() # 启动AP配网模式 + + # 启动看门狗,超时30秒。 + wdt = WDT(timeout=30000) + + # 连接WiFi + while not WIFI_Connect(): # 等待wifi连接 + pass + + wdt.feed() # 喂狗 + + # 获取城市名称和编码 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('City Data', 10, 120, WHITE, size=3) + city_get() + + # 同步网络时钟 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('Date & Time', 10, 120, WHITE, size=3) + ntp_get() + + # 同步天气信息 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('Weather Data', 10, 120, WHITE, size=3) + weather_get(rtc.datetime()) + + # 信息打印 + info_print() + + tick = 61 # 每秒刷新标志位 + + while True: + + # 获取时间 + datetime = rtc.datetime() + + # 30分钟在线获取一次天气信息,顺便检测wifi是否掉线 + if datetime[5] % 30 == 0 and datetime[6] == 0: + WIFI_Connect() # 检查WiFi,掉线的话自动重连 + + weather_get(datetime) # 获取天气信息 + + info_print() # 打印相关信息 + + # 每秒刷新一次UI + if tick != datetime[6]: + + tick = datetime[6] + + wdt.feed() # 喂狗 + + if ui_choice == 0: + default.UI_Display(city, weather, datetime) # 默认UI + + elif ui_choice == 1: + dial.UI_Display(datetime) # 极简表盘 + + elif ui_choice == 2: + photo_album.UI_Display(datetime) # 相册主图 + + # print('gc2:',gc.mem_free()) #内存监测 -#没有WiFi配置文件,出厂模式 -while 'wifi.txt' not in os.listdir(): - - ap.startAP() #启动AP配网模式 - -#启动看门狗,超时30秒。 -wdt = WDT(timeout=30000) - -#连接WiFi -while not WIFI_Connect(): #等待wifi连接 - - pass - -wdt.feed() #喂狗 - -#获取城市名称和编码 -d.fill(BLACK) -d.printStr('Getting...', 10, 60, RED, size=3) -d.printStr('City Data', 10, 120, WHITE, size=3) -city_get() - -#同步网络时钟 -d.fill(BLACK) -d.printStr('Getting...', 10, 60, RED, size=3) -d.printStr('Date & Time', 10, 120, WHITE, size=3) -ntp_get() - -#同步天气信息 -d.fill(BLACK) -d.printStr('Getting...', 10, 60, RED, size=3) -d.printStr('Weather Data', 10, 120, WHITE, size=3) -weather_get(rtc.datetime()) - -#信息打印 -info_print() - -tick = 61 #每秒刷新标志位 - -while True: - - #获取时间 - datetime = rtc.datetime() - - #30分钟在线获取一次天气信息,顺便检测wifi是否掉线 - if datetime[5]%30 == 0 and datetime[6] == 0: - - WIFI_Connect() #检查WiFi,掉线的话自动重连 - - weather_get(datetime) #获取天气信息 - - info_print() #打印相关信息 - - #每秒刷新一次UI - if tick != datetime[6]: - - tick = datetime[6] - - wdt.feed() #喂狗 - - if ui_choice == 0 : - default.UI_Display(city,weather,datetime) #默认UI - - elif ui_choice == 1 : - dial.UI_Display(datetime) #极简表盘 - - elif ui_choice == 2 : - photo_album.UI_Display(datetime) #相册主图 - -# print('gc2:',gc.mem_free()) #内存监测 - - time.sleep_ms(200) \ No newline at end of file + time.sleep_ms(200) diff --git a/code/t1/main.py b/code/t1/main.py new file mode 100644 index 0000000..3c11ec8 --- /dev/null +++ b/code/t1/main.py @@ -0,0 +1,123 @@ +''' +实验名称:Socket通信 +版本:v1.0 +日期:2022.5 +作者:01Studio +说明:通过Socket编程实现pyController与电脑服务器助手建立TCP连接,相互收发数据。 +''' +import gc +import json + +# 导入相关模块 +import network +import time +from libs.urllib import urequest +from machine import Pin, RTC +from tftlcd import LCD15 + +# 定义常用颜色 +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) + +######################## +# 构建1.5寸LCD对象并初始化 +######################## +d = LCD15(portrait=1) # 默认方向竖屏 + +# 填充白色 +d.fill(WHITE) + + +# WIFI连接函数 +def WIFI_Connect(): + WIFI_LED = Pin(2, Pin.OUT) # 初始化WIFI指示灯 + wlan = network.WLAN(network.STA_IF) # STA模式 + wlan.active(True) # 激活接口 + start_time = time.time() # 记录时间做超时判断 + + if not wlan.isconnected(): + print('Connecting to network...') + f = open('wifi.txt', 'r') # 获取账号密码 + info = json.loads(f.read()) + f.close() + + print(info) + d.fill(BLACK) + d.printStr('Connecting...', 10, 50, RED, size=2) + d.printStr(info['SSID'], 10, 110, WHITE, size=2) + d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) + wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 + + while not wlan.isconnected(): + + # LED闪烁提示 + WIFI_LED.value(1) + time.sleep_ms(300) + WIFI_LED.value(0) + time.sleep_ms(300) + + # 超时判断,15秒没连接成功判定为超时 + if time.time() - start_time > 15: + wlan.active(False) + # 点亮LED表示没连接上WiFi + WIFI_LED.value(1) + print('WIFI Connected Timeout!') + return False + + # 连接成功,熄灭LED + WIFI_LED.value(0) + + # 串口打印信息 + print('network information:', wlan.ifconfig()) + # 显示IP信息 + d.printStr('IP/Subnet/GW:', 10, 10, color=BLUE, size=2) + d.printStr(wlan.ifconfig()[0], 10, 50, color=WHITE, size=2) + d.printStr(wlan.ifconfig()[1], 10, 80, color=WHITE, size=2) + d.printStr(wlan.ifconfig()[2], 10, 110, color=WHITE, size=2) + return True + + +# 记录天气爬虫次数,用于调试 +total = 0 +lost = 0 + + +# 网页获取天气数据 +def weather_get(datetime): + global lost, total + + for i in range(5): # 失败会重试,最多5次 + + try: + + myURL = urequest.urlopen( + "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?adCode=440100&limit=1") + text = myURL.read(39000 + 100 * i).decode('utf-8') # 抓取约前4W个字符,节省内存。 + + # 获取当日天气、高低温 + # text1 = json.loads(text) + print(text) + total = total + 1 + + return None + + except: + + print("Can not get weather!", i) + lost = lost + 1 + gc.collect() # 内存回收 + + time.sleep_ms(1000) + + +# 判断WIFI是否连接成功 +if WIFI_Connect(): + # 构建RTC时钟对象 + rtc = RTC() + weather_get(rtc.datetime()) + # 开启RTOS定时器,编号为-1,周期300ms,执行socket通信接收任务 + # tim = Timer(-1) + # tim.init(period=300, mode=Timer.PERIODIC, callback=Socket_fun) diff --git a/code/ui/default.py b/code/ui/default.py index 7318ac7..e400329 100644 --- a/code/ui/default.py +++ b/code/ui/default.py @@ -6,12 +6,12 @@ 说明:天气时钟信息 ''' -#导入相关模块 -import time,gc,json +# 导入相关模块 +import time, gc, json from libs import global_var from data.Fonts import fonts -#动态信息显示 +# 动态信息显示 message_num = 0 ######################## @@ -20,70 +20,68 @@ d = global_var.LCD # d = tftlcd.LCD15(portrait=1) -#定义常用颜色 -RED = (255,0,0) -GREEN = (0,255,0) -BLUE = (0,0,255) -BLACK = (0,0,0) -WHITE = (255,255,255) -YELLOW = (255,255,0) -DEEPGREEN = (1,179,105) +# 定义常用颜色 +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +YELLOW = (255, 255, 0) +DEEPGREEN = (1, 179, 105) -#空气质量颜色 -YOU = (156,202,127) #优 -LIANG = (249,218,101) #良 -QINGDU = (242,159,57) #轻度 -ZHONGDU = (219,85,94) #中度 -ZDU = (186,55,121) #重度 -YANZHONG = (136,11,32) #严重 +# 空气质量颜色 +YOU = (156, 202, 127) # 优 +LIANG = (249, 218, 101) # 良 +QINGDU = (242, 159, 57) # 轻度 +ZHONGDU = (219, 85, 94) # 中度 +ZDU = (186, 55, 121) # 重度 +YANZHONG = (136, 11, 32) # 严重 -week_list=['一','二','三','四','五','六','日'] +week_list = ['一', '二', '三', '四', '五', '六', '日'] -air_quality=['优','良','轻度','中度','重度','严重'] +air_quality = ['优', '良', '轻度', '中度', '重度', '严重'] +# 中文显示 +def printChinese(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=1): + font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 -#中文显示 -def printChinese(text,x,y,color=(0,0,0),backcolor=(255,255,255),size=1): - - font_size = [0,16,24,32,40,48] #分别对应size=1,2,3,4,5的字体尺寸,0无效。 - chinese_dict = {} - - #获取对应的字模 - if size==1: + + # 获取对应的字模 + if size == 1: chinese_dict = fonts.hanzi_16x16_dict - - elif size==2: + + elif size == 2: chinese_dict = fonts.hanzi_24x24_dict - - elif size==3: + + elif size == 3: chinese_dict = fonts.hanzi_32x32_dict - - elif size==4: + + elif size == 4: chinese_dict = fonts.hanzi_40x40_dict - - elif size==5: - chinese_dict = fonts.hanzi_48x48_dict - + + elif size == 5: + chinese_dict = fonts.hanzi_48x48_dict + xs = x ys = y - - #定义字体颜色,RGB888转RGB565 - fc = ((color[0]>>3)<<11) + ((color[1]>>2)<<5) + (color[2]>>3) # 字体 - bc = ((backcolor[0]>>3)<<11) + ((backcolor[1]>>2)<<5) + (backcolor[2]>>3) # 字体背景颜色 - + + # 定义字体颜色,RGB888转RGB565 + fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 + bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 + for i in range(0, len(text)): - - ch_buf =chinese_dict[text[i]] #汉子对应码表 - + + ch_buf = chinese_dict[text[i]] # 汉子对应码表 + rgb_buf = [] - + t1 = font_size[size] // 8 t2 = font_size[size] % 8 for i in range(0, len(ch_buf)): - + for j in range(0, 8): if (ch_buf[i] << j) & 0x80 == 0x00: rgb_buf.append(bc & 0xff) @@ -92,37 +90,37 @@ def printChinese(text,x,y,color=(0,0,0),backcolor=(255,255,255),size=1): rgb_buf.append(fc & 0xff) rgb_buf.append(fc >> 8) - d.write_buf(bytearray(rgb_buf),xs,y,font_size[size],font_size[size]) - + d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) + xs += font_size[size] -#城市显示 -def printCity(text,x,y,color=(0,0,0),backcolor=(255,255,255),size=2): - - font_size = [0,16,24,32,40,48] #分别对应size=1,2,3,4,5的字体尺寸,0无效。 - - f = open('/data/city.txt', 'r') + +# 城市显示 +def printCity(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=2): + font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 + + f = open('/data/city.txt', 'r') chinese_dict = json.loads(f.read()) - f.close() - + f.close() + xs = x ys = y - - #定义字体颜色,RGB888转RGB565 - fc = ((color[0]>>3)<<11) + ((color[1]>>2)<<5) + (color[2]>>3) # 字体 - bc = ((backcolor[0]>>3)<<11) + ((backcolor[1]>>2)<<5) + (backcolor[2]>>3) # 字体背景颜色 - + + # 定义字体颜色,RGB888转RGB565 + fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 + bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 + for i in range(0, len(text)): - - ch_buf =chinese_dict[text[i]] #汉子对应码表 - + + ch_buf = chinese_dict[text[i]] # 汉子对应码表 + rgb_buf = [] - + t1 = font_size[size] // 8 t2 = font_size[size] % 8 for i in range(0, len(ch_buf)): - + for j in range(0, 8): if (ch_buf[i] << j) & 0x80 == 0x00: rgb_buf.append(bc & 0xff) @@ -131,251 +129,250 @@ def printCity(text,x,y,color=(0,0,0),backcolor=(255,255,255),size=2): rgb_buf.append(fc & 0xff) rgb_buf.append(fc >> 8) - d.write_buf(bytearray(rgb_buf),xs,y,font_size[size],font_size[size]) - + d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) + xs += font_size[size] + ''' weather[9]: [0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度, -''' -def weather_display(city,weather): - +''' + + +def weather_display(city, weather): try: - - #城市信息,名称超出4个只显示前4个 - if len(city[0])<5: - #printChinese(city[0],25-(len(city[0])-2)*10,5,color=WHITE,backcolor=BLACK,size=2) - printCity(city[0],25-(len(city[0])-2)*10,5,color=WHITE,backcolor=BLACK,size=2) - - else: - #printChinese(city[0][:4],5,5,color=WHITE,backcolor=BLACK,size=2) - printCity(city[0][:4],5,5,color=WHITE,backcolor=BLACK,size=2) - + + # 城市信息,名称超出4个只显示前4个 + if len(city[0]) < 5: + # printChinese(city[0],25-(len(city[0])-2)*10,5,color=WHITE,backcolor=BLACK,size=2) + printCity(city[0], 25 - (len(city[0]) - 2) * 10, 5, color=WHITE, backcolor=BLACK, size=2) + + else: + # printChinese(city[0][:4],5,5,color=WHITE,backcolor=BLACK,size=2) + printCity(city[0][:4], 5, 5, color=WHITE, backcolor=BLACK, size=2) + except: - - #如果城市中文无法显示,那么就显示城市编码。 - d.printStr(city[1],5, 5, WHITE, size=2) - - #空气质量 - #优[0-50],良[50-100],轻度[100-150],中度[150-200],重度[200-300],严重[300-500] + + # 如果城市中文无法显示,那么就显示城市编码。 + d.printStr(city[1], 5, 5, WHITE, size=2) + + # 空气质量 + # 优[0-50],良[50-100],轻度[100-150],中度[150-200],重度[200-300],严重[300-500] try: - if 0 <= int(weather[4]) < 50: #优 - d.drawRect(115, 5, 50, 24, GREEN, border=1,fillcolor=GREEN) - printChinese('优',129,5,color=BLACK,backcolor=GREEN,size=2) - - elif 50 <= int(weather[4]) < 100:#良 - d.drawRect(115, 5, 50, 24, LIANG, border=1,fillcolor=LIANG) - printChinese('良',129,5,color=BLACK,backcolor=LIANG,size=2) - - elif 100 <= int(weather[4]) < 150:#轻度 - d.drawRect(115, 5, 50, 24, QINGDU, border=1,fillcolor=QINGDU) - printChinese('轻度',117,5,color=BLACK,backcolor=QINGDU,size=2) - - elif 150 <= int(weather[4]) < 200:#中度 - d.drawRect(115, 5, 50, 24, ZHONGDU, border=1,fillcolor=ZHONGDU) - printChinese('中度',117,5,color=BLACK,backcolor=ZHONGDU,size=2) - - elif 200 <= int(weather[4]) < 300:#重度 - d.drawRect(115, 5, 50, 24, ZHONGDU, border=1,fillcolor=ZHONGDU) - printChinese('重度',117,5,color=BLACK,backcolor=ZHONGDU,size=2) - - elif 300 <= int(weather[4]) < 500:#严重 - d.drawRect(115, 5, 50, 24, YANZHONG, border=1,fillcolor=YANZHONG) - printChinese('严重',117,5,color=BLACK,backcolor=YANZHONG,size=2) + if 0 <= int(weather[4]) < 50: # 优 + d.drawRect(115, 5, 50, 24, GREEN, border=1, fillcolor=GREEN) + printChinese('优', 129, 5, color=BLACK, backcolor=GREEN, size=2) + + elif 50 <= int(weather[4]) < 100: # 良 + d.drawRect(115, 5, 50, 24, LIANG, border=1, fillcolor=LIANG) + printChinese('良', 129, 5, color=BLACK, backcolor=LIANG, size=2) + + elif 100 <= int(weather[4]) < 150: # 轻度 + d.drawRect(115, 5, 50, 24, QINGDU, border=1, fillcolor=QINGDU) + printChinese('轻度', 117, 5, color=BLACK, backcolor=QINGDU, size=2) + + elif 150 <= int(weather[4]) < 200: # 中度 + d.drawRect(115, 5, 50, 24, ZHONGDU, border=1, fillcolor=ZHONGDU) + printChinese('中度', 117, 5, color=BLACK, backcolor=ZHONGDU, size=2) + + elif 200 <= int(weather[4]) < 300: # 重度 + d.drawRect(115, 5, 50, 24, ZHONGDU, border=1, fillcolor=ZHONGDU) + printChinese('重度', 117, 5, color=BLACK, backcolor=ZHONGDU, size=2) + + elif 300 <= int(weather[4]) < 500: # 严重 + d.drawRect(115, 5, 50, 24, YANZHONG, border=1, fillcolor=YANZHONG) + printChinese('严重', 117, 5, color=BLACK, backcolor=YANZHONG, size=2) except: print("No air quality data!") - - - #实时温度 - d.Picture(10,175,"/data/picture/default/temp.jpg") - d.drawRect(44, 185, 48, 10, WHITE, border=2,fillcolor=BLACK) - d.drawRect(46, 187, 25, 6, RED, border=2,fillcolor=RED) - d.printStr(weather[7], 115-len(weather[7]*5), 177, RED, size=2) - printChinese('℃',135,177,color=WHITE,backcolor=BLACK,size=2) - - #实时湿度 - d.Picture(10,205,"/data/picture/default/humi.jpg") - d.drawRect(44, 215, 48, 10, WHITE, border=2,fillcolor=BLACK) - d.drawRect(46, 217, 30, 6, DEEPGREEN, border=2,fillcolor=DEEPGREEN) + + # 实时温度 + d.Picture(10, 175, "/data/picture/default/temp.jpg") + d.drawRect(44, 185, 48, 10, WHITE, border=2, fillcolor=BLACK) + d.drawRect(46, 187, 25, 6, RED, border=2, fillcolor=RED) + d.printStr(weather[7], 115 - len(weather[7] * 5), 177, RED, size=2) + printChinese('℃', 135, 177, color=WHITE, backcolor=BLACK, size=2) + + # 实时湿度 + d.Picture(10, 205, "/data/picture/default/humi.jpg") + d.drawRect(44, 215, 48, 10, WHITE, border=2, fillcolor=BLACK) + d.drawRect(46, 217, 30, 6, DEEPGREEN, border=2, fillcolor=DEEPGREEN) d.printStr('100', 100, 207, DEEPGREEN, size=2) time.sleep(1) if weather[8] == '100': d.printStr(weather[8], 100, 207, DEEPGREEN, size=2) else: - d.printStr(' ', 100, 207, BLACK, size=2) #消除100%的重影 + d.printStr(' ', 100, 207, BLACK, size=2) # 消除100%的重影 d.printStr(weather[8], 105, 207, DEEPGREEN, size=2) - printChinese('%',135,207,color=WHITE,backcolor=BLACK,size=2) + printChinese('%', 135, 207, color=WHITE, backcolor=BLACK, size=2) + -def message_display(weather,datetime): - +def message_display(weather, datetime): global message_num - - #今天天气 + + # 今天天气 if message_num == 0: - printChinese(' ',5,40,color=WHITE,backcolor=BLACK,size=2) #清除显示残留 - if len(weather[3])<3:#2个文字以内 - printChinese('实时天气 '+weather[3],5,40,color=WHITE,backcolor=BLACK,size=2) - else: - printChinese('实时 '+weather[3],5,40,color=WHITE,backcolor=BLACK,size=2) - + printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 + if len(weather[3]) < 3: # 2个文字以内 + printChinese('实时天气 ' + weather[3], 5, 40, color=WHITE, backcolor=BLACK, size=2) + else: + printChinese('实时 ' + weather[3], 5, 40, color=WHITE, backcolor=BLACK, size=2) + if weather[3] == '晴': - if 7 <= datetime[4] < 19: #白天7点~19点 - d.Picture(175,5,"/data/picture/default/weather/qing.jpg") + if 7 <= datetime[4] < 19: # 白天7点~19点 + d.Picture(175, 5, "/data/picture/default/weather/qing.jpg") else: - d.Picture(175,5,"/data/picture/default/weather/qing_night.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/qing_night.jpg") + elif weather[3] == '阴': - if 7 <= datetime[4] < 19: #白天7点~19点 - d.Picture(175,5,"/data/picture/default/weather/yin.jpg") + if 7 <= datetime[4] < 19: # 白天7点~19点 + d.Picture(175, 5, "/data/picture/default/weather/yin.jpg") else: - d.Picture(175,5,"/data/picture/default/weather/yin_night.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/yin_night.jpg") + elif weather[3] == '多云': - d.Picture(175,5,"/data/picture/default/weather/duoyun.jpg") + d.Picture(175, 5, "/data/picture/default/weather/duoyun.jpg") elif weather[3] == '小雨': - d.Picture(175,5,"/data/picture/default/weather/xiaoyu.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/xiaoyu.jpg") + elif weather[3] == '中雨': - d.Picture(175,5,"/data/picture/default/weather/zhongyu.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/zhongyu.jpg") + elif weather[3] == '大雨': - d.Picture(175,5,"/data/picture/default/weather/dayu.jpg") + d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") elif weather[3] == '暴雨': - d.Picture(175,5,"/data/picture/default/weather/dayu.jpg") + d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") elif weather[3] == '雷阵雨': - d.Picture(175,5,"/data/picture/default/weather/dayu.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") + elif weather[3] == '阵雨': - d.Picture(175,5,"/data/picture/default/weather/zhongyu.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/zhongyu.jpg") + elif weather[3] == '雾': - d.Picture(175,5,"/data/picture/default/weather/wu.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/wu.jpg") + else: - d.Picture(175,5,"/data/picture/default/weather/no.jpg") + d.Picture(175, 5, "/data/picture/default/weather/no.jpg") - #今天天气 + # 今天天气 elif message_num == 1: - printChinese(' ',5,40,color=WHITE,backcolor=BLACK,size=2) #清除显示残留 - if len(weather[0])<3: #2个字以内 - printChinese('今天天气 '+ weather[0],5,40,color=WHITE,backcolor=BLACK,size=2) - elif len(weather[0])<5: #4个字以内 - printChinese('今天 '+ weather[0],5,40,color=WHITE,backcolor=BLACK,size=2) - elif len(weather[0])<8: #7个字以内 - printChinese(weather[0],41-(len(weather[0])-4)*12,40,color=WHITE,backcolor=BLACK,size=2) - else:#8个字以上,显示前7个 - printChinese(weather[0][:7],5,40,color=WHITE,backcolor=BLACK,size=2) - #风向 + printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 + if len(weather[0]) < 3: # 2个字以内 + printChinese('今天天气 ' + weather[0], 5, 40, color=WHITE, backcolor=BLACK, size=2) + elif len(weather[0]) < 5: # 4个字以内 + printChinese('今天 ' + weather[0], 5, 40, color=WHITE, backcolor=BLACK, size=2) + elif len(weather[0]) < 8: # 7个字以内 + printChinese(weather[0], 41 - (len(weather[0]) - 4) * 12, 40, color=WHITE, backcolor=BLACK, size=2) + else: # 8个字以上,显示前7个 + printChinese(weather[0][:7], 5, 40, color=WHITE, backcolor=BLACK, size=2) + # 风向 elif message_num == 2: - printChinese(' ',5,40,color=WHITE,backcolor=BLACK,size=2) #清除显示残留 - printChinese(weather[5],30,40,color=WHITE,backcolor=BLACK,size=2) - d.printStr(weather[6],110, 40, WHITE, size=2) - printChinese('级',125,40,color=WHITE,backcolor=BLACK,size=2) - - #最高温度 + printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 + printChinese(weather[5], 30, 40, color=WHITE, backcolor=BLACK, size=2) + d.printStr(weather[6], 110, 40, WHITE, size=2) + printChinese('级', 125, 40, color=WHITE, backcolor=BLACK, size=2) + + # 最高温度 elif message_num == 3: - printChinese(' ',5,40,color=WHITE,backcolor=BLACK,size=2) #清除显示残留 - printChinese('最低温度 ',5,40,color=WHITE,backcolor=BLACK,size=2) - d.printStr(weather[1], 140-len(weather[1])*10, 40, WHITE, size=2) - printChinese('℃',148,40,color=WHITE,backcolor=BLACK,size=2) - - #最低温度 + printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 + printChinese('最低温度 ', 5, 40, color=WHITE, backcolor=BLACK, size=2) + d.printStr(weather[1], 140 - len(weather[1]) * 10, 40, WHITE, size=2) + printChinese('℃', 148, 40, color=WHITE, backcolor=BLACK, size=2) + + # 最低温度 elif message_num == 4: - printChinese(' ',5,40,color=WHITE,backcolor=BLACK,size=2) #清除显示残留 - printChinese('最高温度 ',5,40,color=WHITE,backcolor=BLACK,size=2) - d.printStr(weather[2], 140-len(weather[2])*10, 40, WHITE, size=2) - printChinese('℃',148,40,color=WHITE,backcolor=BLACK,size=2) - - #动态信息显示选择 + printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 + printChinese('最高温度 ', 5, 40, color=WHITE, backcolor=BLACK, size=2) + d.printStr(weather[2], 140 - len(weather[2]) * 10, 40, WHITE, size=2) + printChinese('℃', 148, 40, color=WHITE, backcolor=BLACK, size=2) + + # 动态信息显示选择 message_num = message_num + 1 if message_num == 5: message_num = 0 - + + def datetime_display(datetime): - #日期显示 + # 日期显示 year = datetime[0] month = datetime[1] day = datetime[2] week = datetime[3] - + if month > 9: d.printStr(str(month), 5, 140, WHITE, size=2) else: d.printStr(str(month), 13, 140, WHITE, size=2) - - printChinese('月',30,140,color=WHITE,backcolor=BLACK,size=2) - + + printChinese('月', 30, 140, color=WHITE, backcolor=BLACK, size=2) + if day > 9: d.printStr(str(day), 55, 140, WHITE, size=2) else: d.printStr(str(day), 63, 140, WHITE, size=2) - printChinese('日',80,140,color=WHITE,backcolor=BLACK,size=2) + printChinese('日', 80, 140, color=WHITE, backcolor=BLACK, size=2) - printChinese('周'+week_list[week],115,140,color=WHITE,backcolor=BLACK,size=2) - - - #时间显示 + printChinese('周' + week_list[week], 115, 140, color=WHITE, backcolor=BLACK, size=2) + + # 时间显示 second = datetime[6] minute = datetime[5] hour = datetime[4] - if hour > 9: d.printStr(str(hour), 20, 80, WHITE, size=4) else: - d.printStr('0'+str(hour), 20, 80, WHITE, size=4) - + d.printStr('0' + str(hour), 20, 80, WHITE, size=4) + d.printStr(':', 68, 80, WHITE, size=4) - + if minute > 9: d.printStr(str(minute), 92, 80, YELLOW, size=4) else: - d.printStr('0'+str(minute), 92, 80, YELLOW, size=4) - + d.printStr('0' + str(minute), 92, 80, YELLOW, size=4) + d.printStr(':', 140, 80, WHITE, size=4) - + if second > 9: d.printStr(str(second), 164, 80, WHITE, size=4) else: - d.printStr('0'+str(second), 164, 80, WHITE, size=4) + d.printStr('0' + str(second), 164, 80, WHITE, size=4) + -#用于显示动画 +# 用于显示动画 second2 = 61 -#显示图片 -def UI_Display(city,weather,datetime): - - global second2,message_num - - if global_var.UI_Change: #首次显示 - + +# 显示图片 +def UI_Display(city, weather, datetime): + global second2, message_num + + if global_var.UI_Change: # 首次显示 + global_var.UI_Change = 0 message_num = 0 - - d.fill(BLACK) #清屏 - weather_display(city,weather) - message_display(weather,datetime) + + d.fill(BLACK) # 清屏 + weather_display(city, weather) + message_display(weather, datetime) datetime_display(datetime) - #logo动态显示 + # logo动态显示 if second2 != datetime[6]: - if gc.mem_free() < 15000: #内存不足 - gc.collect() #回收内存 - d.Picture(165,165,"/data/picture/default/"+str(datetime[6]%4+1)+".jpg") + if gc.mem_free() < 15000: # 内存不足 + gc.collect() # 回收内存 + # d.Picture(165,165,"/data/picture/default/"+str(datetime[6]%4+1)+".jpg") second2 = datetime[6] - - #动态信息显示刷新时间5秒 - if datetime[6]%5 == 0: - - message_display(weather,datetime) - - #天气信息显示刷新时间10分钟 - if datetime[5]%10 == 0 and datetime[6]==0: - - weather_display(city,weather) + + # 动态信息显示刷新时间5秒 + if datetime[6] % 5 == 0: + message_display(weather, datetime) + + # 天气信息显示刷新时间10分钟 + if datetime[5] % 10 == 0 and datetime[6] == 0: + weather_display(city, weather) From 6727c4476fbec86d92558b069696a8c1eab3c05c Mon Sep 17 00:00:00 2001 From: kyle <573984425@qq.com> Date: Mon, 28 Nov 2022 13:57:06 +0800 Subject: [PATCH 02/13] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=8C=E5=87=86=E5=A4=87?= =?UTF-8?q?=E7=BC=96=E5=86=99=E7=96=AB=E6=83=85=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/t1/t2.py | 18 ++++++++++++++++++ code/t1/t3.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 code/t1/t2.py create mode 100644 code/t1/t3.py diff --git a/code/t1/t2.py b/code/t1/t2.py new file mode 100644 index 0000000..19a2930 --- /dev/null +++ b/code/t1/t2.py @@ -0,0 +1,18 @@ +import re + +def getIdCardCode(cityName: str): + city = None + with open('D:\python\pyClock\code\data\IdCard.txt', 'r') as f: + while True: + text = f.readline() + if cityName in text: + city = re.match(r'"(.+?)"', text.split(':')[1]).group(1) # "获取城市编码" + break + elif '}' in text: # 结束,没这个城市。 + print('No City Name!') + break + return city + + +if __name__ == '__main__': + print(getIdCardCode("广州")) diff --git a/code/t1/t3.py b/code/t1/t3.py new file mode 100644 index 0000000..54437ee --- /dev/null +++ b/code/t1/t3.py @@ -0,0 +1,38 @@ +import json + +import requests + + +# adcode: "440100" +# city: "广州" +# 全省确诊 confirm: 19392 +# 全省确诊新增 confirm_add: "1129" +# date: "11.27" +# 死亡 dead: 0 +# 治愈 heal: 0 +# is_show_wzz_add: 1 +# suspect: 0 +# 本日新增 today_confirm_add: 0 +# 本日无症状新增 today_wzz_add: 0 +# y: "2022" +# 昨日确诊新增 yes_confirm_add: 1129 +# 昨日无症状新增 yes_wzz_add: 7166 +def getDailyEpidemicData(adCode: str = '440100'): + url = "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list" + data = {'adCode': adCode, 'limit': '1'} + r = requests.get(url, params=data) # 发get请求 + print(r.json()) # 将返回的json串转为字典 + info = json.loads(r.text) + if info['ret'] == 0: + return info['data'][0] + else: + return None + + +if __name__ == '__main__': + data = getDailyEpidemicData() + print(data) + # 昨日确诊新增 yes_confirm_add: 1129 + # 昨日无症状新增 yes_wzz_add: 7166 + print('昨日确诊新增', data['yes_confirm_add']) + print('昨日无症状新增', data['yes_wzz_add']) From 2520341aeaccb9ba11b7739322fe79a5bd960bf4 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Sat, 3 Dec 2022 10:05:43 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=96=AB=E6=83=85?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/data/Fonts/fonts.py | 706 +++++++++++++++++++++------------------ code/main.py | 109 +++--- code/t1/GenerateFont.py | 26 ++ code/t1/main.py | 148 ++++---- code/ui/default.py | 46 ++- 5 files changed, 547 insertions(+), 488 deletions(-) create mode 100644 code/t1/GenerateFont.py diff --git a/code/data/Fonts/fonts.py b/code/data/Fonts/fonts.py index b16cf78..e67c3a0 100644 --- a/code/data/Fonts/fonts.py +++ b/code/data/Fonts/fonts.py @@ -8,337 +8,377 @@ 宋体、阴码,逐行式,顺向(高位在前) ''' hanzi_24x24_dict = { + "确": ( + 0x0, 0x3, 0x80, 0x0, 0x3, 0xc0, 0x7f, 0xf7, 0xe4, 0x7f, 0xff, 0xfe, 0x7f, 0xff, 0xfc, 0xe, 0x3e, 0x38, 0xe, + 0x7f, + 0xff, 0xe, 0x3f, 0xff, 0x1f, 0xdf, 0xff, 0x1f, 0xec, 0xe7, 0x3f, 0xec, 0xe7, 0x3c, 0xef, 0xff, 0x7c, 0xef, 0xff, + 0xfc, 0xec, 0xe7, 0x7c, 0xec, 0xe7, 0x7c, 0xff, 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 0x1c, 0x71, 0xc0, 0x1c, 0x71, 0xc0, 0x3c, 0x71, 0xc0, + 0x7b, 0xff, 0xff, 0x7b, 0xff, 0xff, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0,), + "状": ( + 0x7, 0x83, 0xc0, 0x7, 0x83, 0xc0, 0x7, 0x3, 0xb8, 0x7, 0x3, 0xbc, 0xe7, 0x3, 0x9c, 0xf7, 0x3, 0x9e, 0x77, 0x3, + 0x98, + 0x7f, 0x7f, 0xff, 0x3f, 0x7f, 0xff, 0x3f, 0x7f, 0xff, 0x7, 0x3, 0x80, 0xf, 0x3, 0x80, 0x1f, 0x7, 0xc0, 0x3f, + 0x7, + 0xc0, 0x7f, 0x7, 0xc0, 0xff, 0x7, 0xe0, 0xf7, 0xe, 0xe0, 0xe7, 0xe, 0xf0, 0x47, 0x1e, 0x78, 0x7, 0x3c, 0x7c, + 0x7, + 0x78, 0x3f, 0x7, 0xf8, 0x1f, 0x7, 0x70, 0xe, 0x7, 0xa0, 0x0,), + # 空气质量 + "优": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x07, 0x06, 0x60, 0x06, 0x04, 0x30, 0x06, + 0x04, 0x30, 0x0C, 0x04, 0x00, 0x0C, 0x04, 0x00, 0x1D, 0xFF, 0xFC, 0x1D, 0xFF, 0xFC, 0x34, 0x0C, + 0x80, 0x74, 0x0C, 0x80, 0x64, 0x0C, 0x80, 0x04, 0x0C, 0x80, 0x04, 0x0C, 0x80, 0x04, 0x1C, 0x80, + 0x04, 0x18, 0x80, 0x04, 0x18, 0x80, 0x04, 0x30, 0x84, 0x04, 0x70, 0x86, 0x04, 0x60, 0xC6, 0x05, + 0xC0, 0xFC, 0x04, 0xC0, 0x38, 0x00, 0x00, 0x00), - '零' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x07,0xFF,0xE0,0x00,0x18,0x00,0x1F, - 0xFF,0xFC,0x10,0x18,0x0C,0x37,0x9B,0xE8,0x30,0x18,0x10,0x00,0x10,0x00,0x07,0x9B, - 0xE0,0x00,0x38,0x00,0x00,0xC4,0x00,0x01,0x83,0x00,0x06,0x18,0xFE,0x38,0x08,0x1C, - 0x07,0xFF,0x80,0x00,0x01,0x80,0x00,0x06,0x00,0x00,0xE8,0x00,0x00,0x1C,0x00,0x00, - 0x06,0x00,0x00,0x03,0x00,0x00,0x00,0x00,), - - '一' : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x08,0x7F,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,), - - '科' : (0x00,0x00,0x00,0x00,0x00,0x20,0x00,0xE0,0x30,0x1F,0x00,0x20,0x03,0x00,0x20,0x03, - 0x06,0x20,0x03,0x03,0x20,0x03,0x00,0x20,0x7F,0xE0,0x20,0x03,0x00,0x20,0x03,0x04, - 0x20,0x07,0x06,0x20,0x07,0xC2,0x20,0x0F,0x62,0x24,0x0B,0x22,0x2E,0x13,0x01,0xF0, - 0x13,0x1E,0x20,0x23,0x20,0x20,0x43,0x00,0x20,0x03,0x00,0x20,0x03,0x00,0x20,0x03, - 0x00,0x20,0x03,0x00,0x20,0x02,0x00,0x20,), - - '技' : (0x00,0x00,0x00,0x04,0x01,0x00,0x06,0x01,0x80,0x06,0x01,0x00,0x06,0x01,0x00,0x06, - 0x01,0x00,0x7F,0xFF,0xFC,0x06,0x01,0x00,0x06,0x01,0x00,0x06,0x01,0x00,0x06,0x41, - 0x00,0x07,0xBF,0xF8,0x0E,0x08,0x10,0x76,0x08,0x30,0x26,0x04,0x20,0x06,0x04,0x60, - 0x06,0x02,0x40,0x06,0x02,0xC0,0x06,0x01,0x80,0x06,0x02,0xC0,0x26,0x0C,0x70,0x1E, - 0x30,0x3E,0x04,0xC0,0x08,0x00,0x00,0x00,), - - "深" : (0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x0C,0x7F,0xFC,0x04,0x40,0x08,0x05, - 0xC0,0x10,0x01,0x0C,0x40,0x42,0x10,0x30,0x22,0x20,0x18,0x32,0x43,0x18,0x12,0x83, - 0x00,0x14,0x03,0x00,0x04,0xFF,0xFC,0x04,0x07,0x80,0x08,0x0F,0x80,0x08,0x0B,0x40, - 0x78,0x13,0x60,0x18,0x33,0x30,0x18,0x63,0x18,0x18,0x83,0x1E,0x19,0x03,0x08,0x18, - 0x03,0x00,0x00,0x02,0x00,0x00,0x00,0x00), - - "圳" : (0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x06,0x18,0x0C,0x04,0x10,0x8C,0x04, - 0x10,0x8C,0x04,0x10,0x8C,0x04,0x10,0x8C,0x7F,0xD0,0x8C,0x04,0x10,0x8C,0x04,0x10, - 0x8C,0x04,0x10,0x8C,0x04,0x10,0x8C,0x04,0x10,0x8C,0x04,0x10,0x8C,0x04,0x50,0x8C, - 0x07,0xB0,0x8C,0x1C,0x20,0x8C,0x70,0x20,0x8C,0x20,0x40,0x8C,0x00,0x81,0x8C,0x01, - 0x00,0x0C,0x02,0x00,0x08,0x00,0x00,0x00), - - #空气质量 - "优" : (0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x06,0x00,0x07,0x06,0x60,0x06,0x04,0x30,0x06, - 0x04,0x30,0x0C,0x04,0x00,0x0C,0x04,0x00,0x1D,0xFF,0xFC,0x1D,0xFF,0xFC,0x34,0x0C, - 0x80,0x74,0x0C,0x80,0x64,0x0C,0x80,0x04,0x0C,0x80,0x04,0x0C,0x80,0x04,0x1C,0x80, - 0x04,0x18,0x80,0x04,0x18,0x80,0x04,0x30,0x84,0x04,0x70,0x86,0x04,0x60,0xC6,0x05, - 0xC0,0xFC,0x04,0xC0,0x38,0x00,0x00,0x00), - - "良" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x10,0x00,0x07, - 0xFF,0xE0,0x06,0x00,0x60,0x06,0x00,0x60,0x07,0xFF,0xE0,0x07,0xFF,0xE0,0x06,0x00, - 0x60,0x06,0x00,0x60,0x07,0xFF,0xE0,0x07,0xFF,0xE0,0x06,0x18,0x20,0x06,0x18,0x70, - 0x06,0x0C,0xE0,0x06,0x0F,0xC0,0x06,0x07,0x00,0x06,0xE3,0x80,0x07,0xC1,0xF0,0x0F, - 0x00,0x7E,0x0C,0x00,0x1C,0x00,0x00,0x00), - - "轻" : (0x00,0x00,0x00,0x04,0x00,0x00,0x06,0x00,0x00,0x06,0x1F,0xF0,0x06,0x1F,0xF0,0x7F, - 0xE0,0x60,0x0C,0x00,0xE0,0x0C,0x00,0xC0,0x0D,0x81,0xF0,0x19,0x83,0x38,0x19,0x0E, - 0x1C,0x31,0x1C,0x04,0x3F,0xE8,0x00,0x21,0x00,0x00,0x01,0x0F,0xFC,0x01,0x00,0xC0, - 0x01,0xE0,0xC0,0x7F,0xC0,0xC0,0x39,0x00,0xC0,0x01,0x00,0xC0,0x01,0x00,0xC0,0x01, - 0x1F,0xFE,0x01,0x00,0x00,0x01,0x80,0x00), - - "度" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x00,0x00,0x0C,0x00,0x1F,0xFF,0xF8,0x1F, - 0xFF,0xF8,0x18,0x60,0xC0,0x18,0x60,0xC0,0x18,0x60,0xC0,0x1B,0xFF,0xF8,0x18,0x60, - 0xC0,0x18,0x60,0xC0,0x18,0x7F,0xC0,0x18,0x7F,0xC0,0x18,0x00,0x00,0x19,0xFF,0xE0, - 0x18,0x60,0xC0,0x18,0x30,0xC0,0x10,0x19,0x80,0x30,0x1F,0x00,0x30,0x0F,0x00,0x60, - 0xFB,0xF8,0x27,0xE0,0x7C,0x00,0x00,0x00), - - "中" : (0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0x18,0x00,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, - 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x18,0x18,0x18, - 0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00), - - "重" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xFF,0xF0,0x0F,0xF8,0x00,0x00, - 0x18,0x00,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x00,0x18,0x00,0x00,0x18,0x00,0x07,0xFF, - 0xE0,0x06,0x18,0x60,0x07,0xFF,0xE0,0x07,0xFF,0xE0,0x06,0x18,0x60,0x07,0xFF,0xE0, - 0x07,0xFF,0xE0,0x00,0x18,0x00,0x0F,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x18,0x00,0x3F, - 0xFF,0xFC,0x3F,0xFF,0xFC,0x00,0x00,0x00), - - "严" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFC,0x00,0x63,0x00,0x00, - 0x63,0x00,0x0C,0x63,0x30,0x06,0x63,0x30,0x06,0x63,0x60,0x04,0x63,0x20,0x00,0x63, - 0x04,0x0F,0xFF,0xFC,0x08,0x00,0x00,0x08,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x70, - 0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00), - - "温" : (0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x38,0xFF,0xF0,0x0C,0x40,0x30,0x04, - 0x40,0x30,0x00,0x7F,0xF0,0x00,0x7F,0xF0,0x70,0x40,0x30,0x38,0x40,0x30,0x08,0xFF, - 0xF0,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xFF,0xF8,0x09,0x89,0x98, - 0x19,0x89,0x98,0x19,0x89,0x98,0x11,0x89,0x98,0x31,0x89,0x98,0x31,0x89,0x98,0x67, - 0xFF,0xFE,0x07,0xFF,0xFE,0x00,0x00,0x00), - - "至" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF8,0x1F,0xFF,0xF8,0x00, - 0x20,0x00,0x00,0x70,0x00,0x00,0xE1,0x00,0x00,0xC1,0x80,0x01,0x80,0xC0,0x07,0x00, - 0x60,0x0F,0xFF,0xF0,0x04,0x18,0x10,0x00,0x18,0x00,0x00,0x18,0x00,0x08,0x18,0x10, - 0x0F,0xFF,0xF0,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x3F, - 0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00), - - "最" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x06,0x00,0x60,0x07, - 0xFF,0xE0,0x06,0x00,0x60,0x06,0x00,0x60,0x07,0xFF,0xE0,0x00,0x00,0x00,0x3F,0xFF, - 0xFC,0x3F,0xFF,0xFC,0x0C,0x20,0x00,0x0F,0xEF,0xF0,0x0F,0xEF,0xF0,0x0C,0x26,0x30, - 0x0F,0xE2,0x20,0x0F,0xE3,0x60,0x0C,0x39,0x40,0x0F,0xF9,0xC0,0x3F,0x21,0xF0,0x20, - 0x27,0x3C,0x00,0x3C,0x08,0x00,0x00,0x00), - - "高" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x3F,0xFF,0xFC,0x00, - 0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xC0,0x06,0x00,0x40,0x06,0x00,0x40,0x07,0xFF, - 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFC,0x30,0x00,0x0C,0x30,0x00,0x0C, - 0x31,0xFF,0x8C,0x31,0x81,0x8C,0x31,0x81,0x8C,0x31,0xFF,0x8C,0x30,0x00,0x0C,0x30, - 0x00,0x3C,0x30,0x00,0x38,0x00,0x00,0x00), - - "低" : (0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x10,0x06,0x01,0xF8,0x06,0x7F,0xE0,0x0C, - 0x41,0x00,0x0C,0x41,0x00,0x1C,0x41,0x00,0x1C,0x41,0x00,0x3C,0x41,0x00,0x3C,0x7F, - 0xFC,0x6C,0x7F,0xFC,0x2C,0x41,0x80,0x0C,0x41,0x80,0x0C,0x41,0x80,0x0C,0x40,0x80, - 0x0C,0x44,0xC0,0x0C,0x4C,0xC0,0x0C,0x5C,0xC4,0x0C,0x78,0x66,0x0C,0xEC,0x36,0x0C, - 0x46,0x3C,0x0C,0x02,0x1C,0x00,0x00,0x00), - - " " : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00), - - #风力 - "东" : (0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x60,0x00,0x00, - 0x60,0x00,0x1F,0xFF,0xF8,0x01,0xC0,0x00,0x01,0x80,0x00,0x03,0x0C,0x00,0x07,0x0C, - 0x00,0x0E,0x0C,0x00,0x1F,0xFF,0xF8,0x0F,0xFF,0xF8,0x00,0x0C,0x00,0x00,0x0C,0x00, - 0x03,0x0C,0x40,0x03,0x0C,0xE0,0x06,0x0C,0x70,0x0C,0x0C,0x38,0x18,0x0C,0x1C,0x30, - 0x7C,0x08,0x00,0x78,0x00,0x00,0x00,0x00), - - "南" : (0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x3F,0xFF,0xFE,0x30, - 0x18,0x02,0x00,0x10,0x00,0x00,0x30,0x00,0x3F,0xFF,0xFC,0x30,0x00,0x0C,0x30,0x82, - 0x08,0x30,0xC3,0x08,0x30,0x46,0x08,0x32,0x06,0x08,0x33,0xFF,0xC8,0x30,0x18,0x08, - 0x30,0x18,0x08,0x37,0xFF,0xE8,0x30,0x18,0x08,0x30,0x18,0x08,0x30,0x18,0x08,0x30, - 0x18,0x78,0x30,0x00,0x38,0x00,0x00,0x00), - - "西" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFC,0x3F,0xFF,0xFC,0x00, - 0x66,0x00,0x00,0x66,0x00,0x00,0x66,0x00,0x0F,0xFF,0xF0,0x0F,0xFF,0xF0,0x08,0x46, - 0x10,0x08,0x46,0x10,0x08,0x46,0x10,0x08,0xC6,0x10,0x08,0xC6,0x10,0x09,0x83,0xD0, - 0x0B,0x83,0xD0,0x09,0x00,0x10,0x08,0x00,0x10,0x08,0x00,0x10,0x0F,0xFF,0xF0,0x08, - 0x00,0x10,0x08,0x00,0x10,0x00,0x00,0x00), - - "北" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x00,0x00,0xC6,0x00,0x00,0xC6,0x00,0x00, - 0xC6,0x00,0x00,0xC6,0x00,0x00,0xC6,0x0C,0x00,0xC6,0x1C,0x3F,0xC6,0x78,0x3F,0xC7, - 0xE0,0x00,0xC7,0x80,0x00,0xC6,0x00,0x00,0xC6,0x00,0x00,0xC6,0x00,0x00,0xC6,0x00, - 0x00,0xC6,0x00,0x00,0xC6,0x00,0x0F,0xC6,0x04,0x7E,0xC6,0x06,0x30,0xC3,0x0E,0x00, - 0xC3,0xFC,0x00,0xC0,0x00,0x00,0x00,0x00), - - "风" : (0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xE0,0x0F,0xFF,0xE0,0x0C,0x00,0x60,0x0C, - 0x00,0x60,0x0C,0x00,0x60,0x0C,0x83,0x60,0x0D,0xC6,0x60,0x0C,0xC6,0x60,0x0C,0x64, - 0x60,0x0C,0x3C,0x60,0x08,0x38,0x60,0x08,0x18,0x60,0x08,0x3C,0x60,0x08,0x7C,0x60, - 0x18,0x66,0x20,0x18,0xC3,0x30,0x1B,0x83,0x34,0x31,0x00,0x36,0x30,0x00,0x3E,0x70, - 0x00,0x1E,0x60,0x00,0x0C,0x00,0x00,0x00), - - "级" : (0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x06,0x7F,0xF0,0x0C,0x7F,0xF0,0x0C, - 0x08,0x20,0x18,0xC8,0x60,0x31,0x88,0x60,0x31,0x88,0x60,0x7F,0x08,0x40,0x22,0x08, - 0xFC,0x06,0x0C,0x08,0x0C,0x0C,0x18,0x18,0x1E,0x18,0x3F,0x9A,0x10,0x3F,0x9B,0x30, - 0x20,0x11,0xB0,0x00,0xB1,0xE0,0x0F,0xA0,0xE0,0x3E,0x61,0xE0,0x20,0xC3,0xB0,0x01, - 0x8F,0x1C,0x00,0x1C,0x0C,0x00,0x00,0x00), - - "月" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF0,0x06,0x00,0x30,0x06, - 0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x07,0xFF,0xF0,0x07,0xFF,0xF0,0x06,0x00, - 0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x07,0xFF,0xF0,0x07,0xFF,0xF0,0x06,0x00,0x30, - 0x06,0x00,0x30,0x04,0x00,0x30,0x0C,0x00,0x30,0x0C,0x00,0x30,0x18,0x00,0x60,0x38, - 0x03,0xE0,0x30,0x01,0xC0,0x00,0x00,0x00), - - "日" : (0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF0,0x07,0xFF,0xF0,0x06,0x00,0x30,0x06, - 0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x07,0xFF, - 0xF0,0x07,0xFF,0xF0,0x06,0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30, - 0x06,0x00,0x30,0x06,0x00,0x30,0x06,0x00,0x30,0x07,0xFF,0xF0,0x06,0x00,0x30,0x06, - 0x00,0x30,0x06,0x00,0x30,0x00,0x00,0x00), - - "二" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F, - 0xFF,0xF0,0x0F,0xFF,0xF0,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x7F,0xFF,0xFE,0x7F,0xFF,0xFE,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00), - - "三" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF8,0x1F, - 0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x07,0xFF,0xE0,0x07,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFE,0x7F, - 0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00), - - "四" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFC,0x3F,0xFF,0xFC,0x30, - 0x66,0x08,0x30,0x66,0x08,0x30,0x66,0x08,0x30,0x46,0x08,0x30,0x46,0x08,0x30,0xC6, - 0x08,0x30,0xC6,0x08,0x31,0x86,0x08,0x31,0x86,0x08,0x33,0x07,0xC8,0x36,0x00,0x08, - 0x30,0x00,0x08,0x30,0x00,0x08,0x30,0x00,0x08,0x3F,0xFF,0xF8,0x3F,0xFF,0xFC,0x30, - 0x00,0x0C,0x30,0x00,0x0C,0x00,0x00,0x00), - - "五" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF8,0x00, - 0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x20,0x00,0x00,0x20,0x00,0x0F,0xFF, - 0xE0,0x0F,0xFF,0xC0,0x00,0x60,0x40,0x00,0x60,0x40,0x00,0x60,0xC0,0x00,0x60,0xC0, - 0x00,0x40,0xC0,0x00,0xC0,0xC0,0x00,0xC0,0xC0,0x00,0xC0,0xC0,0x3F,0xFF,0xFE,0x3F, - 0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00), - - "六" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x70,0x00,0x00,0x38,0x00,0x00, - 0x18,0x00,0x00,0x1C,0x00,0x00,0x10,0x00,0x3F,0xFF,0xFC,0x3F,0xFF,0xFC,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0xC3,0x80,0x01,0xC1,0x80,0x01,0x81,0xC0, - 0x03,0x80,0xE0,0x07,0x00,0x70,0x0E,0x00,0x30,0x1C,0x00,0x38,0x1C,0x00,0x1C,0x38, - 0x00,0x08,0x10,0x00,0x00,0x00,0x00,0x00), - - "周" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF8,0x0C,0x00,0x18,0x0C, - 0x18,0x18,0x0C,0x18,0x18,0x0D,0xFF,0x98,0x0C,0x18,0x18,0x0C,0x18,0x18,0x0F,0xFF, - 0xD8,0x0F,0xFF,0xD8,0x0C,0x00,0x18,0x08,0x00,0x18,0x08,0xFF,0x18,0x18,0xC1,0x18, - 0x18,0xC1,0x18,0x18,0xC1,0x18,0x18,0xFF,0x18,0x30,0xFF,0x18,0x30,0x00,0x18,0x70, - 0x00,0xF8,0x20,0x00,0xF0,0x00,0x00,0x00), - - "实" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x1F, - 0xFF,0xFC,0x18,0x00,0x1C,0x18,0x04,0x1C,0x19,0x86,0x1C,0x01,0xC6,0x00,0x00,0x76, - 0x00,0x0C,0x26,0x00,0x0F,0x06,0x00,0x03,0x86,0x00,0x01,0x06,0x00,0x3F,0xFF,0xFC, - 0x3F,0xFF,0xFC,0x00,0x0C,0x00,0x00,0x19,0x00,0x00,0x73,0xC0,0x01,0xE0,0xF0,0x0F, - 0x80,0x3C,0x1E,0x00,0x1C,0x10,0x00,0x00), - - "时" : (0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x30,0x00,0x00,0x30,0x3F,0x80,0x30,0x31, - 0x80,0x30,0x31,0x80,0x30,0x31,0xBF,0xFE,0x31,0x80,0x30,0x31,0x80,0x30,0x3F,0x80, - 0x30,0x31,0x8C,0x30,0x31,0x8C,0x30,0x31,0x86,0x30,0x31,0x86,0x30,0x31,0x80,0x30, - 0x3F,0x80,0x30,0x3F,0x80,0x30,0x31,0x80,0x30,0x31,0x80,0x30,0x30,0x00,0x30,0x00, - 0x00,0xF0,0x00,0x00,0xE0,0x00,0x00,0x00), - - "今" : (0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x38,0x00,0x00,0x3C,0x00,0x00, - 0x66,0x00,0x00,0xC3,0x00,0x01,0x81,0x80,0x03,0x01,0xC0,0x06,0x30,0xE0,0x0C,0x38, - 0x78,0x38,0x1C,0x1E,0x30,0x08,0x0C,0x00,0x00,0x00,0x07,0xFF,0xF0,0x07,0xFF,0xF0, - 0x00,0x00,0xE0,0x00,0x01,0xC0,0x00,0x01,0x80,0x00,0x03,0x00,0x00,0x06,0x00,0x00, - 0x0E,0x00,0x00,0x0C,0x00,0x00,0x04,0x00), - - "天" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x3F,0xFF,0xFC,0x3F,0xFF, - 0xFC,0x00,0x18,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x36,0x00,0x00,0x66,0x00, - 0x00,0xE3,0x00,0x01,0xC1,0x80,0x03,0x81,0xC0,0x07,0x00,0xF0,0x1E,0x00,0x3C,0x7C, - 0x00,0x1C,0x30,0x00,0x04,0x00,0x00,0x00), - - "气" : (0x00,0x00,0x00,0x02,0x00,0x00,0x03,0x00,0x00,0x03,0x00,0x00,0x07,0xFF,0xF8,0x0E, - 0x00,0x08,0x0C,0x00,0x00,0x18,0x00,0x00,0x3B,0xFF,0xE0,0x30,0x00,0x00,0x00,0x00, - 0x00,0x1F,0xFF,0xE0,0x1F,0xFF,0xE0,0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x60, - 0x00,0x00,0x60,0x00,0x00,0x60,0x00,0x00,0x64,0x00,0x00,0x66,0x00,0x00,0x7E,0x00, - 0x00,0x3C,0x00,0x00,0x18,0x00,0x00,0x00), - - "转" : (0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x01,0x80,0x0C,0x01,0x80,0x0C,0x01,0x00,0x7F, - 0xDF,0xFC,0x7F,0xDF,0xFC,0x18,0x03,0x00,0x1B,0x03,0x00,0x13,0x22,0x02,0x33,0x3F, - 0xFE,0x63,0x06,0x00,0x7F,0xC6,0x00,0x23,0x04,0x00,0x03,0x0F,0xF8,0x03,0x00,0x38, - 0x03,0xC0,0x30,0x7F,0x80,0x60,0x63,0x0C,0xC0,0x03,0x07,0x80,0x03,0x03,0xC0,0x03, - 0x00,0xE0,0x03,0x00,0x60,0x00,0x00,0x00), - - "到" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x3F,0xFC,0x0C,0x01,0x80,0x0C,0x01, - 0x80,0x8C,0x02,0x00,0x8C,0x04,0x30,0x8C,0x08,0x18,0x8C,0x1F,0xFC,0x8C,0x19,0x8C, - 0x8C,0x01,0x84,0x8C,0x01,0x80,0x8C,0x01,0x88,0x8C,0x3F,0xFC,0x8C,0x01,0x80,0x8C, - 0x01,0x80,0x8C,0x01,0x80,0x8C,0x01,0x84,0x0C,0x01,0xF8,0x0C,0x1F,0x00,0x0C,0x38, - 0x00,0x78,0x00,0x00,0x18,0x00,0x00,0x00), - - "晴" : (0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x01,0x80,0x00,0x3F,0xFC,0x3F,0x3F,0xFC,0x23, - 0x01,0x80,0x23,0x3F,0xFC,0x23,0x3F,0xFC,0x23,0x01,0x80,0x23,0x7F,0xFE,0x3F,0x7F, - 0xFE,0x3F,0x00,0x00,0x23,0x1F,0xF8,0x23,0x10,0x08,0x23,0x10,0x08,0x23,0x1F,0xF8, - 0x23,0x10,0x08,0x3F,0x10,0x08,0x23,0x1F,0xF8,0x23,0x1F,0xF8,0x20,0x10,0x08,0x00, - 0x10,0x18,0x00,0x10,0x38,0x00,0x00,0x00), - - "阴" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xCF,0xFC,0x30,0xCC,0x08,0x30, - 0x8C,0x08,0x31,0x8C,0x08,0x31,0x8C,0x08,0x31,0x0F,0xF8,0x33,0x0F,0xF8,0x33,0x0C, - 0x08,0x33,0x0C,0x08,0x31,0x8C,0x08,0x31,0x8F,0xF8,0x30,0xCF,0xF8,0x30,0xCC,0x08, - 0x30,0xC8,0x08,0x37,0x98,0x08,0x33,0x18,0x08,0x30,0x30,0x08,0x30,0x70,0x08,0x30, - 0x60,0x78,0x30,0xC0,0x78,0x00,0x00,0x00), - - "雨" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFE,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x1F,0xFF,0xFC,0x1F,0xFF,0xFC,0x18,0x18,0x0C,0x19,0x19, - 0x0C,0x19,0x99,0x8C,0x18,0xD8,0xCC,0x18,0x18,0x4C,0x18,0x18,0x0C,0x19,0x18,0x0C, - 0x1B,0x99,0x8C,0x19,0xD9,0xCC,0x18,0x98,0x0C,0x18,0x18,0x0C,0x18,0x18,0x0C,0x18, - 0x18,0x3C,0x18,0x00,0x38,0x00,0x00,0x00), - - "雷" : (0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xF8,0x18,0x18,0x18,0x00,0x18,0x00,0x7F, - 0xFF,0xFE,0x7F,0xFF,0xFE,0x60,0x18,0x06,0x67,0x9B,0xE6,0x00,0x18,0x00,0x07,0x99, - 0xE0,0x07,0x99,0xE0,0x00,0x18,0x00,0x0F,0xFF,0xF0,0x0F,0xFF,0xF0,0x0C,0x18,0x30, - 0x0C,0x18,0x30,0x0F,0xFF,0xF0,0x0C,0x18,0x30,0x0C,0x18,0x30,0x0C,0x18,0x30,0x0F, - 0xFF,0xF0,0x0C,0x00,0x30,0x00,0x00,0x00), - - "阵" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x3F,0x07,0x00,0x33,0x06,0x00,0x33, - 0x7F,0xFC,0x32,0x7F,0xFC,0x36,0x0C,0x00,0x36,0x08,0x00,0x34,0x19,0x80,0x36,0x31, - 0x80,0x32,0x31,0x80,0x33,0x7F,0xFC,0x31,0x31,0x80,0x31,0x81,0x80,0x31,0x81,0x80, - 0x3F,0x01,0x80,0x36,0x7F,0xFE,0x30,0x7F,0xFE,0x30,0x01,0x80,0x30,0x01,0x80,0x30, - 0x01,0x80,0x30,0x01,0x80,0x00,0x00,0x00), - - "多" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0xC0,0x00,0x01,0xFF,0xE0,0x03, - 0x00,0xC0,0x0E,0x00,0xC0,0x1C,0xC3,0x80,0x00,0x67,0x00,0x00,0x3C,0x00,0x00,0x3A, - 0x00,0x01,0xE7,0x00,0x3F,0x8F,0xFC,0x18,0x1F,0xFC,0x00,0x70,0x18,0x01,0xF0,0x18, - 0x07,0x98,0x30,0x06,0x0C,0x60,0x00,0x07,0xC0,0x00,0x07,0x80,0x00,0x1E,0x00,0x07, - 0xF8,0x00,0x1F,0xC0,0x00,0x00,0x00,0x00), - - "云" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xF0,0x07,0xFF,0xF0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF, - 0xFC,0x00,0x40,0x00,0x00,0x70,0x00,0x00,0x60,0x00,0x00,0xC0,0x00,0x01,0xC1,0x80, - 0x01,0x81,0x80,0x03,0x00,0xC0,0x06,0x00,0x60,0x0E,0x00,0xF0,0x1F,0xFF,0xF8,0x0F, - 0xC0,0x18,0x00,0x00,0x00,0x00,0x00,0x00), - - "小" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x07,0x18,0xC0,0x06,0x18,0xE0,0x06,0x18, - 0x60,0x0E,0x18,0x70,0x0C,0x18,0x30,0x0C,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x1C, - 0x38,0x18,0x0C,0x10,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0xF8,0x00,0x00,0x70,0x00,0x00,0x00,0x00), - - "大" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x00, - 0x18,0x00,0x00,0x18,0x00,0x00,0x18,0x00,0x3F,0xFF,0xFC,0x3F,0xFF,0xFC,0x00,0x18, - 0x00,0x00,0x38,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x66,0x00,0x00,0x67,0x00, - 0x00,0xC3,0x00,0x01,0xC1,0x80,0x03,0x80,0xC0,0x0F,0x00,0xF0,0x1E,0x00,0x38,0x78, - 0x00,0x1C,0x30,0x00,0x08,0x00,0x00,0x00), - - "暴" : (0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xE0,0x04,0x00,0x20,0x04,0x00,0x20,0x07, - 0xFF,0xE0,0x04,0x00,0x20,0x07,0xFF,0xE0,0x00,0xC3,0x00,0x00,0xC3,0x00,0x1F,0xFF, - 0xF8,0x00,0xC3,0x00,0x00,0xC3,0x00,0x3F,0xFF,0xFC,0x01,0x81,0x80,0x07,0x18,0xE0, - 0x3D,0x18,0xBC,0x33,0x9D,0xCC,0x00,0xFF,0x00,0x03,0xDB,0xC0,0x1F,0x18,0xF0,0x08, - 0x78,0x30,0x00,0x30,0x10,0x00,0x00,0x00), - - "雾" : (0x00,0x00,0x00,0x00,0x00,0x40,0x07,0xFF,0xE0,0x00,0x18,0x00,0x0F,0xFF,0xF8,0x10, - 0x18,0x08,0x13,0xDB,0xD0,0x00,0x18,0x00,0x03,0xDB,0xC0,0x00,0x80,0x00,0x01,0xFF, - 0x80,0x02,0x81,0x80,0x0C,0x62,0x00,0x10,0x1C,0x00,0x00,0xE7,0xFE,0x1F,0x20,0x78, - 0x20,0x10,0x00,0x07,0xFF,0xE0,0x00,0x20,0x40,0x00,0x60,0x40,0x00,0xC0,0x80,0x03, - 0x07,0x80,0x1C,0x03,0x00,0x00,0x00,0x00), - - "雪" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x0F,0xFF,0xF0,0x00,0x10,0x00,0x10, - 0x10,0x00,0x1F,0xFF,0xFC,0x10,0x10,0x08,0x37,0xD3,0xF0,0x20,0x10,0x00,0x00,0x10, - 0x00,0x07,0xD3,0xE0,0x00,0x10,0x20,0x0F,0xFF,0xF0,0x00,0x00,0x20,0x00,0x00,0x20, - 0x00,0x00,0x20,0x07,0xFF,0xE0,0x00,0x00,0x20,0x00,0x00,0x20,0x1F,0xFF,0xE0,0x00, - 0x00,0x20,0x00,0x00,0x20,0x00,0x00,0x00), - - "夹" : (0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x18,0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x1F, - 0xFF,0xF0,0x00,0x10,0x00,0x00,0x10,0x00,0x04,0x10,0xC0,0x02,0x10,0x80,0x03,0x11, - 0x80,0x01,0x11,0x00,0x01,0x32,0x08,0x7F,0xFF,0xFC,0x00,0x24,0x00,0x00,0x24,0x00, - 0x00,0x62,0x00,0x00,0x42,0x00,0x00,0x81,0x80,0x01,0x00,0xC0,0x06,0x00,0x70,0x18, - 0x00,0x1E,0x60,0x00,0x08,0x00,0x00,0x00), - - "℃" : (0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x24,0x00,0x00,0x24,0x03,0x00,0x24, - 0x1F,0xE0,0x18,0x38,0x70,0x00,0x60,0x18,0x00,0xC0,0x1C,0x00,0xC0,0x00,0x00,0xC0, - 0x00,0x00,0x80,0x00,0x01,0x80,0x00,0x01,0x80,0x00,0x01,0x80,0x00,0x00,0xC0,0x00, - 0x00,0xC0,0x0C,0x00,0xC0,0x18,0x00,0x60,0x38,0x00,0x38,0xF0,0x00,0x1F,0xE0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00), - - "%" : (0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x0F, - 0x80,0x18,0x18,0xC0,0x30,0x18,0xC0,0x60,0x18,0x40,0xC0,0x18,0xC3,0x80,0x18,0xC7, - 0x00,0x0D,0x8E,0x00,0x07,0x1C,0x00,0x00,0x39,0xF0,0x00,0x73,0x10,0x00,0xE3,0x18, - 0x01,0xC2,0x18,0x03,0x02,0x18,0x06,0x03,0x18,0x0C,0x03,0x10,0x08,0x01,0xF0,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00), - -} \ No newline at end of file + "良": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x10, 0x00, 0x07, + 0xFF, 0xE0, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 0x07, 0xFF, 0xE0, 0x07, 0xFF, 0xE0, 0x06, 0x00, + 0x60, 0x06, 0x00, 0x60, 0x07, 0xFF, 0xE0, 0x07, 0xFF, 0xE0, 0x06, 0x18, 0x20, 0x06, 0x18, 0x70, + 0x06, 0x0C, 0xE0, 0x06, 0x0F, 0xC0, 0x06, 0x07, 0x00, 0x06, 0xE3, 0x80, 0x07, 0xC1, 0xF0, 0x0F, + 0x00, 0x7E, 0x0C, 0x00, 0x1C, 0x00, 0x00, 0x00), + + "轻": (0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x06, 0x1F, 0xF0, 0x06, 0x1F, 0xF0, 0x7F, + 0xE0, 0x60, 0x0C, 0x00, 0xE0, 0x0C, 0x00, 0xC0, 0x0D, 0x81, 0xF0, 0x19, 0x83, 0x38, 0x19, 0x0E, + 0x1C, 0x31, 0x1C, 0x04, 0x3F, 0xE8, 0x00, 0x21, 0x00, 0x00, 0x01, 0x0F, 0xFC, 0x01, 0x00, 0xC0, + 0x01, 0xE0, 0xC0, 0x7F, 0xC0, 0xC0, 0x39, 0x00, 0xC0, 0x01, 0x00, 0xC0, 0x01, 0x00, 0xC0, 0x01, + 0x1F, 0xFE, 0x01, 0x00, 0x00, 0x01, 0x80, 0x00), + + "度": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x0C, 0x00, 0x1F, 0xFF, 0xF8, 0x1F, + 0xFF, 0xF8, 0x18, 0x60, 0xC0, 0x18, 0x60, 0xC0, 0x18, 0x60, 0xC0, 0x1B, 0xFF, 0xF8, 0x18, 0x60, + 0xC0, 0x18, 0x60, 0xC0, 0x18, 0x7F, 0xC0, 0x18, 0x7F, 0xC0, 0x18, 0x00, 0x00, 0x19, 0xFF, 0xE0, + 0x18, 0x60, 0xC0, 0x18, 0x30, 0xC0, 0x10, 0x19, 0x80, 0x30, 0x1F, 0x00, 0x30, 0x0F, 0x00, 0x60, + 0xFB, 0xF8, 0x27, 0xE0, 0x7C, 0x00, 0x00, 0x00), + + "中": (0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x1F, 0xFF, 0xF8, 0x1F, 0xFF, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0xFF, 0xF8, 0x1F, 0xFF, 0xF8, 0x18, 0x18, 0x18, + 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00), + + "重": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0xFF, 0xF0, 0x0F, 0xF8, 0x00, 0x00, + 0x18, 0x00, 0x7F, 0xFF, 0xFE, 0x7F, 0xFF, 0xFE, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x07, 0xFF, + 0xE0, 0x06, 0x18, 0x60, 0x07, 0xFF, 0xE0, 0x07, 0xFF, 0xE0, 0x06, 0x18, 0x60, 0x07, 0xFF, 0xE0, + 0x07, 0xFF, 0xE0, 0x00, 0x18, 0x00, 0x0F, 0xFF, 0xF8, 0x0F, 0xFF, 0xF8, 0x00, 0x18, 0x00, 0x3F, + 0xFF, 0xFC, 0x3F, 0xFF, 0xFC, 0x00, 0x00, 0x00), + + "严": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xFC, 0x00, 0x63, 0x00, 0x00, + 0x63, 0x00, 0x0C, 0x63, 0x30, 0x06, 0x63, 0x30, 0x06, 0x63, 0x60, 0x04, 0x63, 0x20, 0x00, 0x63, + 0x04, 0x0F, 0xFF, 0xFC, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x70, + 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00), + + "温": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x38, 0xFF, 0xF0, 0x0C, 0x40, 0x30, 0x04, + 0x40, 0x30, 0x00, 0x7F, 0xF0, 0x00, 0x7F, 0xF0, 0x70, 0x40, 0x30, 0x38, 0x40, 0x30, 0x08, 0xFF, + 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xFF, 0xF8, 0x09, 0x89, 0x98, + 0x19, 0x89, 0x98, 0x19, 0x89, 0x98, 0x11, 0x89, 0x98, 0x31, 0x89, 0x98, 0x31, 0x89, 0x98, 0x67, + 0xFF, 0xFE, 0x07, 0xFF, 0xFE, 0x00, 0x00, 0x00), + + "至": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x1F, 0xFF, 0xF8, 0x00, + 0x20, 0x00, 0x00, 0x70, 0x00, 0x00, 0xE1, 0x00, 0x00, 0xC1, 0x80, 0x01, 0x80, 0xC0, 0x07, 0x00, + 0x60, 0x0F, 0xFF, 0xF0, 0x04, 0x18, 0x10, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x08, 0x18, 0x10, + 0x0F, 0xFF, 0xF0, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x3F, + 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "最": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xE0, 0x06, 0x00, 0x60, 0x07, + 0xFF, 0xE0, 0x06, 0x00, 0x60, 0x06, 0x00, 0x60, 0x07, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x3F, 0xFF, + 0xFC, 0x3F, 0xFF, 0xFC, 0x0C, 0x20, 0x00, 0x0F, 0xEF, 0xF0, 0x0F, 0xEF, 0xF0, 0x0C, 0x26, 0x30, + 0x0F, 0xE2, 0x20, 0x0F, 0xE3, 0x60, 0x0C, 0x39, 0x40, 0x0F, 0xF9, 0xC0, 0x3F, 0x21, 0xF0, 0x20, + 0x27, 0x3C, 0x00, 0x3C, 0x08, 0x00, 0x00, 0x00), + + "高": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x3F, 0xFF, 0xFC, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xC0, 0x06, 0x00, 0x40, 0x06, 0x00, 0x40, 0x07, 0xFF, + 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFC, 0x30, 0x00, 0x0C, 0x30, 0x00, 0x0C, + 0x31, 0xFF, 0x8C, 0x31, 0x81, 0x8C, 0x31, 0x81, 0x8C, 0x31, 0xFF, 0x8C, 0x30, 0x00, 0x0C, 0x30, + 0x00, 0x3C, 0x30, 0x00, 0x38, 0x00, 0x00, 0x00), + + "低": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x06, 0x01, 0xF8, 0x06, 0x7F, 0xE0, 0x0C, + 0x41, 0x00, 0x0C, 0x41, 0x00, 0x1C, 0x41, 0x00, 0x1C, 0x41, 0x00, 0x3C, 0x41, 0x00, 0x3C, 0x7F, + 0xFC, 0x6C, 0x7F, 0xFC, 0x2C, 0x41, 0x80, 0x0C, 0x41, 0x80, 0x0C, 0x41, 0x80, 0x0C, 0x40, 0x80, + 0x0C, 0x44, 0xC0, 0x0C, 0x4C, 0xC0, 0x0C, 0x5C, 0xC4, 0x0C, 0x78, 0x66, 0x0C, 0xEC, 0x36, 0x0C, + 0x46, 0x3C, 0x0C, 0x02, 0x1C, 0x00, 0x00, 0x00), + + " ": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + # 风力 + "东": (0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, + 0x60, 0x00, 0x1F, 0xFF, 0xF8, 0x01, 0xC0, 0x00, 0x01, 0x80, 0x00, 0x03, 0x0C, 0x00, 0x07, 0x0C, + 0x00, 0x0E, 0x0C, 0x00, 0x1F, 0xFF, 0xF8, 0x0F, 0xFF, 0xF8, 0x00, 0x0C, 0x00, 0x00, 0x0C, 0x00, + 0x03, 0x0C, 0x40, 0x03, 0x0C, 0xE0, 0x06, 0x0C, 0x70, 0x0C, 0x0C, 0x38, 0x18, 0x0C, 0x1C, 0x30, + 0x7C, 0x08, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00), + + "南": (0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x3F, 0xFF, 0xFE, 0x30, + 0x18, 0x02, 0x00, 0x10, 0x00, 0x00, 0x30, 0x00, 0x3F, 0xFF, 0xFC, 0x30, 0x00, 0x0C, 0x30, 0x82, + 0x08, 0x30, 0xC3, 0x08, 0x30, 0x46, 0x08, 0x32, 0x06, 0x08, 0x33, 0xFF, 0xC8, 0x30, 0x18, 0x08, + 0x30, 0x18, 0x08, 0x37, 0xFF, 0xE8, 0x30, 0x18, 0x08, 0x30, 0x18, 0x08, 0x30, 0x18, 0x08, 0x30, + 0x18, 0x78, 0x30, 0x00, 0x38, 0x00, 0x00, 0x00), + + "西": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFC, 0x3F, 0xFF, 0xFC, 0x00, + 0x66, 0x00, 0x00, 0x66, 0x00, 0x00, 0x66, 0x00, 0x0F, 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x08, 0x46, + 0x10, 0x08, 0x46, 0x10, 0x08, 0x46, 0x10, 0x08, 0xC6, 0x10, 0x08, 0xC6, 0x10, 0x09, 0x83, 0xD0, + 0x0B, 0x83, 0xD0, 0x09, 0x00, 0x10, 0x08, 0x00, 0x10, 0x08, 0x00, 0x10, 0x0F, 0xFF, 0xF0, 0x08, + 0x00, 0x10, 0x08, 0x00, 0x10, 0x00, 0x00, 0x00), + + "北": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x00, + 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x0C, 0x00, 0xC6, 0x1C, 0x3F, 0xC6, 0x78, 0x3F, 0xC7, + 0xE0, 0x00, 0xC7, 0x80, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, + 0x00, 0xC6, 0x00, 0x00, 0xC6, 0x00, 0x0F, 0xC6, 0x04, 0x7E, 0xC6, 0x06, 0x30, 0xC3, 0x0E, 0x00, + 0xC3, 0xFC, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00), + + "风": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0x0F, 0xFF, 0xE0, 0x0C, 0x00, 0x60, 0x0C, + 0x00, 0x60, 0x0C, 0x00, 0x60, 0x0C, 0x83, 0x60, 0x0D, 0xC6, 0x60, 0x0C, 0xC6, 0x60, 0x0C, 0x64, + 0x60, 0x0C, 0x3C, 0x60, 0x08, 0x38, 0x60, 0x08, 0x18, 0x60, 0x08, 0x3C, 0x60, 0x08, 0x7C, 0x60, + 0x18, 0x66, 0x20, 0x18, 0xC3, 0x30, 0x1B, 0x83, 0x34, 0x31, 0x00, 0x36, 0x30, 0x00, 0x3E, 0x70, + 0x00, 0x1E, 0x60, 0x00, 0x0C, 0x00, 0x00, 0x00), + + "级": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x7F, 0xF0, 0x0C, 0x7F, 0xF0, 0x0C, + 0x08, 0x20, 0x18, 0xC8, 0x60, 0x31, 0x88, 0x60, 0x31, 0x88, 0x60, 0x7F, 0x08, 0x40, 0x22, 0x08, + 0xFC, 0x06, 0x0C, 0x08, 0x0C, 0x0C, 0x18, 0x18, 0x1E, 0x18, 0x3F, 0x9A, 0x10, 0x3F, 0x9B, 0x30, + 0x20, 0x11, 0xB0, 0x00, 0xB1, 0xE0, 0x0F, 0xA0, 0xE0, 0x3E, 0x61, 0xE0, 0x20, 0xC3, 0xB0, 0x01, + 0x8F, 0x1C, 0x00, 0x1C, 0x0C, 0x00, 0x00, 0x00), + + "月": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, + 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x07, 0xFF, 0xF0, 0x07, 0xFF, 0xF0, 0x06, 0x00, + 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x07, 0xFF, 0xF0, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, + 0x06, 0x00, 0x30, 0x04, 0x00, 0x30, 0x0C, 0x00, 0x30, 0x0C, 0x00, 0x30, 0x18, 0x00, 0x60, 0x38, + 0x03, 0xE0, 0x30, 0x01, 0xC0, 0x00, 0x00, 0x00), + + "日": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, + 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x07, 0xFF, + 0xF0, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, + 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, + 0x00, 0x30, 0x06, 0x00, 0x30, 0x00, 0x00, 0x00), + + "二": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, + 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7F, 0xFF, 0xFE, 0x7F, 0xFF, 0xFE, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "三": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x1F, + 0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0xFF, 0xE0, 0x07, 0xFF, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFE, 0x7F, + 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "四": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFC, 0x3F, 0xFF, 0xFC, 0x30, + 0x66, 0x08, 0x30, 0x66, 0x08, 0x30, 0x66, 0x08, 0x30, 0x46, 0x08, 0x30, 0x46, 0x08, 0x30, 0xC6, + 0x08, 0x30, 0xC6, 0x08, 0x31, 0x86, 0x08, 0x31, 0x86, 0x08, 0x33, 0x07, 0xC8, 0x36, 0x00, 0x08, + 0x30, 0x00, 0x08, 0x30, 0x00, 0x08, 0x30, 0x00, 0x08, 0x3F, 0xFF, 0xF8, 0x3F, 0xFF, 0xFC, 0x30, + 0x00, 0x0C, 0x30, 0x00, 0x0C, 0x00, 0x00, 0x00), + + "五": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x00, + 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x0F, 0xFF, + 0xE0, 0x0F, 0xFF, 0xC0, 0x00, 0x60, 0x40, 0x00, 0x60, 0x40, 0x00, 0x60, 0xC0, 0x00, 0x60, 0xC0, + 0x00, 0x40, 0xC0, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, 0x3F, 0xFF, 0xFE, 0x3F, + 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "六": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x70, 0x00, 0x00, 0x38, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x00, 0x3F, 0xFF, 0xFC, 0x3F, 0xFF, 0xFC, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xC3, 0x80, 0x01, 0xC1, 0x80, 0x01, 0x81, 0xC0, + 0x03, 0x80, 0xE0, 0x07, 0x00, 0x70, 0x0E, 0x00, 0x30, 0x1C, 0x00, 0x38, 0x1C, 0x00, 0x1C, 0x38, + 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00), + + "周": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xF8, 0x0C, 0x00, 0x18, 0x0C, + 0x18, 0x18, 0x0C, 0x18, 0x18, 0x0D, 0xFF, 0x98, 0x0C, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x0F, 0xFF, + 0xD8, 0x0F, 0xFF, 0xD8, 0x0C, 0x00, 0x18, 0x08, 0x00, 0x18, 0x08, 0xFF, 0x18, 0x18, 0xC1, 0x18, + 0x18, 0xC1, 0x18, 0x18, 0xC1, 0x18, 0x18, 0xFF, 0x18, 0x30, 0xFF, 0x18, 0x30, 0x00, 0x18, 0x70, + 0x00, 0xF8, 0x20, 0x00, 0xF0, 0x00, 0x00, 0x00), + + "实": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x1F, + 0xFF, 0xFC, 0x18, 0x00, 0x1C, 0x18, 0x04, 0x1C, 0x19, 0x86, 0x1C, 0x01, 0xC6, 0x00, 0x00, 0x76, + 0x00, 0x0C, 0x26, 0x00, 0x0F, 0x06, 0x00, 0x03, 0x86, 0x00, 0x01, 0x06, 0x00, 0x3F, 0xFF, 0xFC, + 0x3F, 0xFF, 0xFC, 0x00, 0x0C, 0x00, 0x00, 0x19, 0x00, 0x00, 0x73, 0xC0, 0x01, 0xE0, 0xF0, 0x0F, + 0x80, 0x3C, 0x1E, 0x00, 0x1C, 0x10, 0x00, 0x00), + + "时": (0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x3F, 0x80, 0x30, 0x31, + 0x80, 0x30, 0x31, 0x80, 0x30, 0x31, 0xBF, 0xFE, 0x31, 0x80, 0x30, 0x31, 0x80, 0x30, 0x3F, 0x80, + 0x30, 0x31, 0x8C, 0x30, 0x31, 0x8C, 0x30, 0x31, 0x86, 0x30, 0x31, 0x86, 0x30, 0x31, 0x80, 0x30, + 0x3F, 0x80, 0x30, 0x3F, 0x80, 0x30, 0x31, 0x80, 0x30, 0x31, 0x80, 0x30, 0x30, 0x00, 0x30, 0x00, + 0x00, 0xF0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00), + + "今": (0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x00, 0x3C, 0x00, 0x00, + 0x66, 0x00, 0x00, 0xC3, 0x00, 0x01, 0x81, 0x80, 0x03, 0x01, 0xC0, 0x06, 0x30, 0xE0, 0x0C, 0x38, + 0x78, 0x38, 0x1C, 0x1E, 0x30, 0x08, 0x0C, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x07, 0xFF, 0xF0, + 0x00, 0x00, 0xE0, 0x00, 0x01, 0xC0, 0x00, 0x01, 0x80, 0x00, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, + 0x0E, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x04, 0x00), + + "天": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xF0, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x3F, 0xFF, 0xFC, 0x3F, 0xFF, + 0xFC, 0x00, 0x18, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x36, 0x00, 0x00, 0x66, 0x00, + 0x00, 0xE3, 0x00, 0x01, 0xC1, 0x80, 0x03, 0x81, 0xC0, 0x07, 0x00, 0xF0, 0x1E, 0x00, 0x3C, 0x7C, + 0x00, 0x1C, 0x30, 0x00, 0x04, 0x00, 0x00, 0x00), + + "气": (0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x07, 0xFF, 0xF8, 0x0E, + 0x00, 0x08, 0x0C, 0x00, 0x00, 0x18, 0x00, 0x00, 0x3B, 0xFF, 0xE0, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x1F, 0xFF, 0xE0, 0x1F, 0xFF, 0xE0, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x60, 0x00, 0x00, 0x60, 0x00, 0x00, 0x64, 0x00, 0x00, 0x66, 0x00, 0x00, 0x7E, 0x00, + 0x00, 0x3C, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00), + + "转": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x80, 0x0C, 0x01, 0x80, 0x0C, 0x01, 0x00, 0x7F, + 0xDF, 0xFC, 0x7F, 0xDF, 0xFC, 0x18, 0x03, 0x00, 0x1B, 0x03, 0x00, 0x13, 0x22, 0x02, 0x33, 0x3F, + 0xFE, 0x63, 0x06, 0x00, 0x7F, 0xC6, 0x00, 0x23, 0x04, 0x00, 0x03, 0x0F, 0xF8, 0x03, 0x00, 0x38, + 0x03, 0xC0, 0x30, 0x7F, 0x80, 0x60, 0x63, 0x0C, 0xC0, 0x03, 0x07, 0x80, 0x03, 0x03, 0xC0, 0x03, + 0x00, 0xE0, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00), + + "到": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3F, 0xFC, 0x0C, 0x01, 0x80, 0x0C, 0x01, + 0x80, 0x8C, 0x02, 0x00, 0x8C, 0x04, 0x30, 0x8C, 0x08, 0x18, 0x8C, 0x1F, 0xFC, 0x8C, 0x19, 0x8C, + 0x8C, 0x01, 0x84, 0x8C, 0x01, 0x80, 0x8C, 0x01, 0x88, 0x8C, 0x3F, 0xFC, 0x8C, 0x01, 0x80, 0x8C, + 0x01, 0x80, 0x8C, 0x01, 0x80, 0x8C, 0x01, 0x84, 0x0C, 0x01, 0xF8, 0x0C, 0x1F, 0x00, 0x0C, 0x38, + 0x00, 0x78, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00), + + "晴": (0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x01, 0x80, 0x00, 0x3F, 0xFC, 0x3F, 0x3F, 0xFC, 0x23, + 0x01, 0x80, 0x23, 0x3F, 0xFC, 0x23, 0x3F, 0xFC, 0x23, 0x01, 0x80, 0x23, 0x7F, 0xFE, 0x3F, 0x7F, + 0xFE, 0x3F, 0x00, 0x00, 0x23, 0x1F, 0xF8, 0x23, 0x10, 0x08, 0x23, 0x10, 0x08, 0x23, 0x1F, 0xF8, + 0x23, 0x10, 0x08, 0x3F, 0x10, 0x08, 0x23, 0x1F, 0xF8, 0x23, 0x1F, 0xF8, 0x20, 0x10, 0x08, 0x00, + 0x10, 0x18, 0x00, 0x10, 0x38, 0x00, 0x00, 0x00), + + "阴": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xCF, 0xFC, 0x30, 0xCC, 0x08, 0x30, + 0x8C, 0x08, 0x31, 0x8C, 0x08, 0x31, 0x8C, 0x08, 0x31, 0x0F, 0xF8, 0x33, 0x0F, 0xF8, 0x33, 0x0C, + 0x08, 0x33, 0x0C, 0x08, 0x31, 0x8C, 0x08, 0x31, 0x8F, 0xF8, 0x30, 0xCF, 0xF8, 0x30, 0xCC, 0x08, + 0x30, 0xC8, 0x08, 0x37, 0x98, 0x08, 0x33, 0x18, 0x08, 0x30, 0x30, 0x08, 0x30, 0x70, 0x08, 0x30, + 0x60, 0x78, 0x30, 0xC0, 0x78, 0x00, 0x00, 0x00), + + "雨": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFE, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x1F, 0xFF, 0xFC, 0x1F, 0xFF, 0xFC, 0x18, 0x18, 0x0C, 0x19, 0x19, + 0x0C, 0x19, 0x99, 0x8C, 0x18, 0xD8, 0xCC, 0x18, 0x18, 0x4C, 0x18, 0x18, 0x0C, 0x19, 0x18, 0x0C, + 0x1B, 0x99, 0x8C, 0x19, 0xD9, 0xCC, 0x18, 0x98, 0x0C, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x0C, 0x18, + 0x18, 0x3C, 0x18, 0x00, 0x38, 0x00, 0x00, 0x00), + + "雷": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x7F, + 0xFF, 0xFE, 0x7F, 0xFF, 0xFE, 0x60, 0x18, 0x06, 0x67, 0x9B, 0xE6, 0x00, 0x18, 0x00, 0x07, 0x99, + 0xE0, 0x07, 0x99, 0xE0, 0x00, 0x18, 0x00, 0x0F, 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x0C, 0x18, 0x30, + 0x0C, 0x18, 0x30, 0x0F, 0xFF, 0xF0, 0x0C, 0x18, 0x30, 0x0C, 0x18, 0x30, 0x0C, 0x18, 0x30, 0x0F, + 0xFF, 0xF0, 0x0C, 0x00, 0x30, 0x00, 0x00, 0x00), + + "阵": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x3F, 0x07, 0x00, 0x33, 0x06, 0x00, 0x33, + 0x7F, 0xFC, 0x32, 0x7F, 0xFC, 0x36, 0x0C, 0x00, 0x36, 0x08, 0x00, 0x34, 0x19, 0x80, 0x36, 0x31, + 0x80, 0x32, 0x31, 0x80, 0x33, 0x7F, 0xFC, 0x31, 0x31, 0x80, 0x31, 0x81, 0x80, 0x31, 0x81, 0x80, + 0x3F, 0x01, 0x80, 0x36, 0x7F, 0xFE, 0x30, 0x7F, 0xFE, 0x30, 0x01, 0x80, 0x30, 0x01, 0x80, 0x30, + 0x01, 0x80, 0x30, 0x01, 0x80, 0x00, 0x00, 0x00), + + "多": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xC0, 0x00, 0x01, 0xFF, 0xE0, 0x03, + 0x00, 0xC0, 0x0E, 0x00, 0xC0, 0x1C, 0xC3, 0x80, 0x00, 0x67, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3A, + 0x00, 0x01, 0xE7, 0x00, 0x3F, 0x8F, 0xFC, 0x18, 0x1F, 0xFC, 0x00, 0x70, 0x18, 0x01, 0xF0, 0x18, + 0x07, 0x98, 0x30, 0x06, 0x0C, 0x60, 0x00, 0x07, 0xC0, 0x00, 0x07, 0x80, 0x00, 0x1E, 0x00, 0x07, + 0xF8, 0x00, 0x1F, 0xC0, 0x00, 0x00, 0x00, 0x00), + + "云": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x07, 0xFF, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, + 0xFC, 0x00, 0x40, 0x00, 0x00, 0x70, 0x00, 0x00, 0x60, 0x00, 0x00, 0xC0, 0x00, 0x01, 0xC1, 0x80, + 0x01, 0x81, 0x80, 0x03, 0x00, 0xC0, 0x06, 0x00, 0x60, 0x0E, 0x00, 0xF0, 0x1F, 0xFF, 0xF8, 0x0F, + 0xC0, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "小": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x07, 0x18, 0xC0, 0x06, 0x18, 0xE0, 0x06, 0x18, + 0x60, 0x0E, 0x18, 0x70, 0x0C, 0x18, 0x30, 0x0C, 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1C, + 0x38, 0x18, 0x0C, 0x10, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0xF8, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00), + + "大": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x3F, 0xFF, 0xFC, 0x3F, 0xFF, 0xFC, 0x00, 0x18, + 0x00, 0x00, 0x38, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x66, 0x00, 0x00, 0x67, 0x00, + 0x00, 0xC3, 0x00, 0x01, 0xC1, 0x80, 0x03, 0x80, 0xC0, 0x0F, 0x00, 0xF0, 0x1E, 0x00, 0x38, 0x78, + 0x00, 0x1C, 0x30, 0x00, 0x08, 0x00, 0x00, 0x00), + + "暴": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xE0, 0x04, 0x00, 0x20, 0x04, 0x00, 0x20, 0x07, + 0xFF, 0xE0, 0x04, 0x00, 0x20, 0x07, 0xFF, 0xE0, 0x00, 0xC3, 0x00, 0x00, 0xC3, 0x00, 0x1F, 0xFF, + 0xF8, 0x00, 0xC3, 0x00, 0x00, 0xC3, 0x00, 0x3F, 0xFF, 0xFC, 0x01, 0x81, 0x80, 0x07, 0x18, 0xE0, + 0x3D, 0x18, 0xBC, 0x33, 0x9D, 0xCC, 0x00, 0xFF, 0x00, 0x03, 0xDB, 0xC0, 0x1F, 0x18, 0xF0, 0x08, + 0x78, 0x30, 0x00, 0x30, 0x10, 0x00, 0x00, 0x00), + + "雾": (0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x07, 0xFF, 0xE0, 0x00, 0x18, 0x00, 0x0F, 0xFF, 0xF8, 0x10, + 0x18, 0x08, 0x13, 0xDB, 0xD0, 0x00, 0x18, 0x00, 0x03, 0xDB, 0xC0, 0x00, 0x80, 0x00, 0x01, 0xFF, + 0x80, 0x02, 0x81, 0x80, 0x0C, 0x62, 0x00, 0x10, 0x1C, 0x00, 0x00, 0xE7, 0xFE, 0x1F, 0x20, 0x78, + 0x20, 0x10, 0x00, 0x07, 0xFF, 0xE0, 0x00, 0x20, 0x40, 0x00, 0x60, 0x40, 0x00, 0xC0, 0x80, 0x03, + 0x07, 0x80, 0x1C, 0x03, 0x00, 0x00, 0x00, 0x00), + + "雪": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0F, 0xFF, 0xF0, 0x00, 0x10, 0x00, 0x10, + 0x10, 0x00, 0x1F, 0xFF, 0xFC, 0x10, 0x10, 0x08, 0x37, 0xD3, 0xF0, 0x20, 0x10, 0x00, 0x00, 0x10, + 0x00, 0x07, 0xD3, 0xE0, 0x00, 0x10, 0x20, 0x0F, 0xFF, 0xF0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x20, 0x07, 0xFF, 0xE0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x1F, 0xFF, 0xE0, 0x00, + 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00), + + "夹": (0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x18, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x1F, + 0xFF, 0xF0, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x04, 0x10, 0xC0, 0x02, 0x10, 0x80, 0x03, 0x11, + 0x80, 0x01, 0x11, 0x00, 0x01, 0x32, 0x08, 0x7F, 0xFF, 0xFC, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, + 0x00, 0x62, 0x00, 0x00, 0x42, 0x00, 0x00, 0x81, 0x80, 0x01, 0x00, 0xC0, 0x06, 0x00, 0x70, 0x18, + 0x00, 0x1E, 0x60, 0x00, 0x08, 0x00, 0x00, 0x00), + + "℃": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x03, 0x00, 0x24, + 0x1F, 0xE0, 0x18, 0x38, 0x70, 0x00, 0x60, 0x18, 0x00, 0xC0, 0x1C, 0x00, 0xC0, 0x00, 0x00, 0xC0, + 0x00, 0x00, 0x80, 0x00, 0x01, 0x80, 0x00, 0x01, 0x80, 0x00, 0x01, 0x80, 0x00, 0x00, 0xC0, 0x00, + 0x00, 0xC0, 0x0C, 0x00, 0xC0, 0x18, 0x00, 0x60, 0x38, 0x00, 0x38, 0xF0, 0x00, 0x1F, 0xE0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + + "%": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0F, + 0x80, 0x18, 0x18, 0xC0, 0x30, 0x18, 0xC0, 0x60, 0x18, 0x40, 0xC0, 0x18, 0xC3, 0x80, 0x18, 0xC7, + 0x00, 0x0D, 0x8E, 0x00, 0x07, 0x1C, 0x00, 0x00, 0x39, 0xF0, 0x00, 0x73, 0x10, 0x00, 0xE3, 0x18, + 0x01, 0xC2, 0x18, 0x03, 0x02, 0x18, 0x06, 0x03, 0x18, 0x0C, 0x03, 0x10, 0x08, 0x01, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), + +} + +hanzi_16x16_dict = { + "确": ( + 0x0, 0x70, 0x7f, 0x7f, 0x7f, 0xfe, 0x19, 0xce, 0x1b, 0xff, 0x3e, 0xff, 0x3e, 0xd9, 0x76, 0xff, 0xf6, 0xff, 0xf6, + 0xd9, 0x76, 0xff, 0x3e, 0xff, 0x3f, 0xd9, 0x37, 0x9f, 0x37, 0x9f, 0x3, 0x1f,), + "诊": ( + 0x0, 0x70, 0x30, 0x70, 0x38, 0xf0, 0x38, 0xd8, 0x19, 0xdc, 0xf3, 0xaf, 0xff, 0x77, 0xf6, 0xe9, 0x33, 0xdc, 0x33, + 0xb8, 0x31, 0x76, 0x35, 0xef, 0x3f, 0xdc, 0x3c, 0x78, 0x3b, 0xf0, 0x3, 0xc0,), + "新": ( + 0xe, 0x0, 0xe, 0x3f, 0x7f, 0xff, 0x7f, 0xb0, 0x3b, 0xb0, 0x5b, 0x3f, 0x7f, 0xff, 0x6c, 0xbf, 0x7f, 0xf6, 0x7f, + 0xf6, 0x3f, 0x66, 0x3f, 0xe6, 0x7d, 0xe6, 0xfd, 0xe6, 0x1d, 0xc6, 0x18, 0xc6,), + "增": ( + 0x38, 0xe6, 0x38, 0x6e, 0x3b, 0xff, 0x3b, 0xff, 0xff, 0xdf, 0xff, 0xff, 0x3b, 0xfd, 0x3b, 0xff, 0x3b, 0xff, + 0x39, 0xff, 0x3f, 0xff, 0x7f, 0xff, 0xfd, 0xff, 0x61, 0xff, 0x1, 0xff, 0x1, 0x83,), + "无": ( + 0x1f, 0xfe, 0x1f, 0xfe, 0x11, 0xc2, 0x1, 0x80, 0x1, 0x80, 0x7f, 0xff, 0x7f, 0xff, 0x1, 0xe0, 0x3, 0xe0, 0x3, + 0x60, 0x7, 0x60, 0xe, 0x63, 0x1c, 0x63, 0x78, 0x7f, 0x70, 0x3f, 0x0, 0x0,), + "症": ( + 0x0, 0x60, 0x1f, 0xff, 0x1f, 0xff, 0x7c, 0x0, 0x7c, 0x0, 0x7f, 0xff, 0x7f, 0xff, 0x1c, 0x38, 0x7f, 0xbf, 0x7d, + 0xbf, 0x59, 0xb9, 0x19, 0xb8, 0x39, 0xb8, 0x37, 0xff, 0x77, 0xff, 0x20, 0x0,), + "状": ( + 0xc, 0x30, 0xc, 0x34, 0xc, 0x3e, 0x6c, 0x37, 0x7c, 0x36, 0x3f, 0xff, 0x3f, 0xff, 0xc, 0x70, 0x1c, 0x70, 0x3c, + 0x78, 0xfc, 0x78, 0x6c, 0xfc, 0x4c, 0xce, 0xd, 0xcf, 0xf, 0x87, 0xd, 0x2,), + " ": ( + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,), +} diff --git a/code/main.py b/code/main.py index 47808cf..a87006d 100644 --- a/code/main.py +++ b/code/main.py @@ -43,15 +43,15 @@ ''' 城市信息: -[0]城市,[1]编码 +[0]城市,[1]天气编码,[2]身份证编码 ''' -city = ['', ''] +city = ['', '', ''] ''' 天气信息: -[0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度, +[0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度,[9]昨日确诊新增,[10]昨日无症状新增 ''' -weather = [''] * 9 # 定义一个长度为9的字符列表 +weather = [''] * 11 # 定义一个长度为9的字符列表 # 构建RTC时钟对象 rtc = RTC() @@ -70,35 +70,30 @@ def WIFI_Connect(): print('Connecting to network...') - f = open('wifi.txt', 'r') # 获取账号密码 - info = json.loads(f.read()) - f.close() - - print(info) - d.fill(BLACK) - d.printStr('Connecting...', 10, 50, RED, size=2) - d.printStr(info['SSID'], 10, 110, WHITE, size=2) - d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) - wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 - - while not wlan.isconnected(): + with open('wifi.txt', 'r') as f: # 获取账号密码 + info = json.loads(f.read()) + print(info) + d.fill(BLACK) + d.printStr('Connecting...', 10, 50, RED, size=2) + d.printStr(info['SSID'], 10, 110, WHITE, size=2) + d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) + wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 - # LED闪烁提示 - WIFI_LED.value(1) - time.sleep_ms(300) - WIFI_LED.value(0) - time.sleep_ms(300) + while not wlan.isconnected(): - # 超时判断,15秒没连接成功判定为超时 - if time.time() - start_time > 15: - wlan.active(False) - - # 点亮LED表示没连接上WiFi + # LED闪烁提示 WIFI_LED.value(1) - - print('WIFI Connected Timeout!') - - return False + time.sleep_ms(300) + WIFI_LED.value(0) + time.sleep_ms(300) + + # 超时判断,15秒没连接成功判定为超时 + if time.time() - start_time > 15: + wlan.active(False) + # 点亮LED表示没连接上WiFi + WIFI_LED.value(1) + print('WIFI Connected Timeout!') + return False # 连接成功,熄灭LED WIFI_LED.value(0) @@ -156,16 +151,11 @@ def weather_get(datetime): text2 = json.loads(re.search('var hour3data=' + '(.*?)' + '', text).group(1)) for i in range(len(text2['1d'])): - if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 - if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 - if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): - weather[3] = text2['1d'][i].split(',')[2] # 实时天气 else: - weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 break @@ -227,7 +217,8 @@ def info_print(): print('实时风力级数:', weather[6]) print('实时温度:', weather[7]) print('实时湿度:', weather[8]) - + print('昨日确诊新增:', weather[9]) + print('昨日无症状新增:', weather[10]) print('total:', total) print('lost:', lost) @@ -360,6 +351,42 @@ def key(KEY): KEY.irq(key, Pin.IRQ_FALLING) # 定义中断,下降沿触发 + +def getIdCardCode(cityName: str): + city = None + with open('/data/IdCard.txt', 'r') as f: + while True: + text = f.readline() + if cityName in text: + city = re.match(r'"(.+?)"', text.split(':')[1]).group(1) # "获取城市编码" + break + elif '}' in text: # 结束,没这个城市。 + print('No City Name!') + break + return city + + +def getDailyEpidemicData(adCode: str = '440100'): + gc.collect() # 内存回收 + r = urequest.urlopen( + r"https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?limit=1&adCode=" + adCode) # 发get请求 + text = r.read(444).decode('utf-8') # 抓取约前4W个字符,节省内存。 + print(text) + info = json.loads(text) + if info['ret'] == 0: + return info['data'][0] + else: + return None + + +def epidemic_situation_get(): + global weather, city + city[2] = getIdCardCode("广州") + data = getDailyEpidemicData() + weather[9] = str(data['yes_confirm_add']) + weather[10] = str(data['yes_wzz_add']) + + ################ # 主程序 # ################ @@ -395,6 +422,13 @@ def key(KEY): d.printStr('Weather Data', 10, 120, WHITE, size=3) weather_get(rtc.datetime()) + # 获取疫情新增人数信息 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('Epidemic Situation', 10, 120, WHITE, size=3) + d.printStr('Data', 10, 180, WHITE, size=3) + epidemic_situation_get() + # 信息打印 info_print() @@ -408,9 +442,8 @@ def key(KEY): # 30分钟在线获取一次天气信息,顺便检测wifi是否掉线 if datetime[5] % 30 == 0 and datetime[6] == 0: WIFI_Connect() # 检查WiFi,掉线的话自动重连 - weather_get(datetime) # 获取天气信息 - + epidemic_situation_get() # 获取疫情信息 info_print() # 打印相关信息 # 每秒刷新一次UI diff --git a/code/t1/GenerateFont.py b/code/t1/GenerateFont.py new file mode 100644 index 0000000..963ea57 --- /dev/null +++ b/code/t1/GenerateFont.py @@ -0,0 +1,26 @@ +font = [ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] +if __name__ == '__main__': + print('确') + for i in range(int(len(font) / 8)): + b = 8 - 8 + for j in range(8 - 8, 8): + bit = font[i * 8 + j] + move = 7 - j + b = b + (bit << move) + print('%#x' % b, end=",") diff --git a/code/t1/main.py b/code/t1/main.py index 3c11ec8..d9dbeea 100644 --- a/code/t1/main.py +++ b/code/t1/main.py @@ -1,123 +1,89 @@ ''' -实验名称:Socket通信 +实验名称:1.5寸LCD液晶显示屏(240x240) 版本:v1.0 -日期:2022.5 +日期:2022.4 作者:01Studio -说明:通过Socket编程实现pyController与电脑服务器助手建立TCP连接,相互收发数据。 +实验平台:pyController +说明:通过编程实现LCD的各种显示功能,包括填充、画点、线、矩形、圆形、显示英文、显示图片等。 ''' -import gc -import json -# 导入相关模块 -import network -import time -from libs.urllib import urequest -from machine import Pin, RTC +#导入相关模块 from tftlcd import LCD15 - -# 定义常用颜色 -RED = (255, 0, 0) -GREEN = (0, 255, 0) -BLUE = (0, 0, 255) -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) +import time +from data.Fonts import fonts +import gc +#定义常用颜色 +RED = (255,0,0) +GREEN = (0,255,0) +BLUE = (0,0,255) +BLACK = (0,0,0) +WHITE = (255,255,255) ######################## # 构建1.5寸LCD对象并初始化 ######################## -d = LCD15(portrait=1) # 默认方向竖屏 - -# 填充白色 -d.fill(WHITE) - +d = LCD15(portrait=1) #默认方向竖屏 +gc.collect() +def printChinese(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=1): + font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 -# WIFI连接函数 -def WIFI_Connect(): - WIFI_LED = Pin(2, Pin.OUT) # 初始化WIFI指示灯 - wlan = network.WLAN(network.STA_IF) # STA模式 - wlan.active(True) # 激活接口 - start_time = time.time() # 记录时间做超时判断 + chinese_dict = {} - if not wlan.isconnected(): - print('Connecting to network...') - f = open('wifi.txt', 'r') # 获取账号密码 - info = json.loads(f.read()) - f.close() + # 获取对应的字模 + if size == 1: + chinese_dict = fonts.hanzi_16x16_dict - print(info) - d.fill(BLACK) - d.printStr('Connecting...', 10, 50, RED, size=2) - d.printStr(info['SSID'], 10, 110, WHITE, size=2) - d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) - wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 + elif size == 2: + chinese_dict = fonts.hanzi_24x24_dict - while not wlan.isconnected(): + elif size == 3: + chinese_dict = fonts.hanzi_32x32_dict - # LED闪烁提示 - WIFI_LED.value(1) - time.sleep_ms(300) - WIFI_LED.value(0) - time.sleep_ms(300) + elif size == 4: + chinese_dict = fonts.hanzi_40x40_dict - # 超时判断,15秒没连接成功判定为超时 - if time.time() - start_time > 15: - wlan.active(False) - # 点亮LED表示没连接上WiFi - WIFI_LED.value(1) - print('WIFI Connected Timeout!') - return False + elif size == 5: + chinese_dict = fonts.hanzi_48x48_dict - # 连接成功,熄灭LED - WIFI_LED.value(0) + xs = x + ys = y - # 串口打印信息 - print('network information:', wlan.ifconfig()) - # 显示IP信息 - d.printStr('IP/Subnet/GW:', 10, 10, color=BLUE, size=2) - d.printStr(wlan.ifconfig()[0], 10, 50, color=WHITE, size=2) - d.printStr(wlan.ifconfig()[1], 10, 80, color=WHITE, size=2) - d.printStr(wlan.ifconfig()[2], 10, 110, color=WHITE, size=2) - return True + # 定义字体颜色,RGB888转RGB565 + fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 + bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 + for i in range(0, len(text)): -# 记录天气爬虫次数,用于调试 -total = 0 -lost = 0 + ch_buf = chinese_dict[text[i]] # 汉子对应码表 + rgb_buf = [] -# 网页获取天气数据 -def weather_get(datetime): - global lost, total + t1 = font_size[size] // 8 + t2 = font_size[size] % 8 - for i in range(5): # 失败会重试,最多5次 + for i in range(0, len(ch_buf)): - try: + for j in range(0, 8): + if (ch_buf[i] << j) & 0x80 == 0x00: + rgb_buf.append(bc & 0xff) + rgb_buf.append(bc >> 8) + else: + rgb_buf.append(fc & 0xff) + rgb_buf.append(fc >> 8) - myURL = urequest.urlopen( - "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?adCode=440100&limit=1") - text = myURL.read(39000 + 100 * i).decode('utf-8') # 抓取约前4W个字符,节省内存。 + d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) - # 获取当日天气、高低温 - # text1 = json.loads(text) - print(text) - total = total + 1 + xs += font_size[size] - return None +#填充白色 +d.fill(BLACK) - except: +#写字符,4种尺寸 - print("Can not get weather!", i) - lost = lost + 1 - gc.collect() # 内存回收 +printChinese('确诊新增', 160, 176, color=WHITE, backcolor=BLACK, size=1) # 清除显示残留 +d.printStr('12', 160, 192, WHITE, size=1) +printChinese('无症状新增', 160, 208, color=WHITE, backcolor=BLACK, size=1) +d.printStr('13', 160, 224, WHITE, size=1) - time.sleep_ms(1000) -# 判断WIFI是否连接成功 -if WIFI_Connect(): - # 构建RTC时钟对象 - rtc = RTC() - weather_get(rtc.datetime()) - # 开启RTOS定时器,编号为-1,周期300ms,执行socket通信接收任务 - # tim = Timer(-1) - # tim.init(period=300, mode=Timer.PERIODIC, callback=Socket_fun) diff --git a/code/ui/default.py b/code/ui/default.py index f993415..238559f 100644 --- a/code/ui/default.py +++ b/code/ui/default.py @@ -7,9 +7,12 @@ ''' # 导入相关模块 -import time, gc, json -from libs import global_var +import gc +import json +import time + from data.Fonts import fonts +from libs import global_var # 动态信息显示 message_num = 0 @@ -142,18 +145,14 @@ def printCity(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=2): def weather_display(city, weather): try: - # 城市信息,名称超出4个只显示前4个 if len(city[0]) < 5: # printChinese(city[0],25-(len(city[0])-2)*10,5,color=WHITE,backcolor=BLACK,size=2) printCity(city[0], 25 - (len(city[0]) - 2) * 10, 5, color=WHITE, backcolor=BLACK, size=2) - else: # printChinese(city[0][:4],5,5,color=WHITE,backcolor=BLACK,size=2) printCity(city[0][:4], 5, 5, color=WHITE, backcolor=BLACK, size=2) - except: - # 如果城市中文无法显示,那么就显示城市编码。 d.printStr(city[1], 5, 5, WHITE, size=2) @@ -190,7 +189,7 @@ def weather_display(city, weather): d.Picture(10, 175, "/data/picture/default/temp.jpg") d.drawRect(44, 185, 48, 10, WHITE, border=2, fillcolor=BLACK) d.drawRect(46, 187, 25, 6, RED, border=2, fillcolor=RED) - d.printStr(' ', 100, 177, BLACK, size=2) #消除重影 + d.printStr(' ', 100, 177, BLACK, size=2) # 消除重影 d.printStr(weather[7], 115 - len(weather[7] * 5), 177, RED, size=2) printChinese('℃', 135, 177, color=WHITE, backcolor=BLACK, size=2) @@ -198,6 +197,8 @@ def weather_display(city, weather): d.Picture(10, 205, "/data/picture/default/humi.jpg") d.drawRect(44, 215, 48, 10, WHITE, border=2, fillcolor=BLACK) d.drawRect(46, 217, 30, 6, DEEPGREEN, border=2, fillcolor=DEEPGREEN) + d.printStr('100', 100, 207, DEEPGREEN, size=2) + time.sleep(1) if weather[8] == '100': d.printStr(weather[8], 100, 207, DEEPGREEN, size=2) @@ -206,11 +207,17 @@ def weather_display(city, weather): d.printStr(weather[8], 105, 207, DEEPGREEN, size=2) printChinese('%', 135, 207, color=WHITE, backcolor=BLACK, size=2) + # 新冠疫情感染人数新增 + printChinese('确诊新增', 160, 176, color=WHITE, backcolor=BLACK, size=1) + d.printStr(weather[9], 160, 192, WHITE, size=1) + printChinese('无症状新增', 160, 208, color=WHITE, backcolor=BLACK, size=1) + d.printStr(weather[10], 160, 224, WHITE, size=1) + def message_display(weather, datetime): global message_num - # 实时天气 + # 今天天气 if message_num == 0: printChinese(' ', 5, 40, color=WHITE, backcolor=BLACK, size=2) # 清除显示残留 if len(weather[3]) < 3: # 2个文字以内 @@ -223,48 +230,35 @@ def message_display(weather, datetime): d.Picture(175, 5, "/data/picture/default/weather/qing.jpg") else: d.Picture(175, 5, "/data/picture/default/weather/qing_night.jpg") - elif weather[3] == '阴': if 7 <= datetime[4] < 19: # 白天7点~19点 d.Picture(175, 5, "/data/picture/default/weather/yin.jpg") else: d.Picture(175, 5, "/data/picture/default/weather/yin_night.jpg") - elif weather[3] == '多云': d.Picture(175, 5, "/data/picture/default/weather/duoyun.jpg") - elif weather[3] == '小雨': d.Picture(175, 5, "/data/picture/default/weather/xiaoyu.jpg") - elif weather[3] == '中雨': d.Picture(175, 5, "/data/picture/default/weather/zhongyu.jpg") - elif weather[3] == '大雨': d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") - elif weather[3] == '暴雨': d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") - elif weather[3] == '雷阵雨': d.Picture(175, 5, "/data/picture/default/weather/dayu.jpg") - elif weather[3] == '阵雨': d.Picture(175, 5, "/data/picture/default/weather/zhongyu.jpg") - elif weather[3] == '雾': d.Picture(175, 5, "/data/picture/default/weather/wu.jpg") -elif weather[3] == '雨夹雪': - d.Picture(175,5,"/data/picture/default/weather/yujiaxue.jpg") - + elif weather[3] == '雨夹雪': + d.Picture(175, 5, "/data/picture/default/weather/yujiaxue.jpg") elif weather[3] == '小雪': - d.Picture(175,5,"/data/picture/default/weather/xiaoxue.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/xiaoxue.jpg") elif weather[3] == '中雪': - d.Picture(175,5,"/data/picture/default/weather/daxue.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/daxue.jpg") elif weather[3] == '大雪': - d.Picture(175,5,"/data/picture/default/weather/daxue.jpg") - + d.Picture(175, 5, "/data/picture/default/weather/daxue.jpg") else: d.Picture(175, 5, "/data/picture/default/weather/no.jpg") From f924fee486ed510996f64d76628d75e00fe51563 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Sat, 3 Dec 2022 10:09:34 +0800 Subject: [PATCH 04/13] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=E7=82=B9?= =?UTF-8?q?=E9=98=B5=E6=96=87=E5=AD=97=E5=88=B6=E4=BD=9C=E7=BD=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/README.md b/code/README.md index 28b0ee1..e06140f 100644 --- a/code/README.md +++ b/code/README.md @@ -29,7 +29,8 @@ ui:UI主题库 (用户可以自定义UI主题并在这里添加,通过主函数按键切换,添加过多主题可能导致内存不足。) - +点阵文字制作: +http://www.jiqie.com/5/m1.htm ## 版本说明 From 9f2f36a67c5cbc0d7007a194cd52e6a0cf3bd50e Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Sat, 3 Dec 2022 10:17:46 +0800 Subject: [PATCH 05/13] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A0=E6=B6=88?= =?UTF-8?q?=E9=99=A4=E6=AE=8B=E5=BD=B1=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/t1/GenerateFont.py | 1 - code/t1/t3.py | 1 + code/ui/default.py | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/t1/GenerateFont.py b/code/t1/GenerateFont.py index 963ea57..b904d3a 100644 --- a/code/t1/GenerateFont.py +++ b/code/t1/GenerateFont.py @@ -16,7 +16,6 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,] if __name__ == '__main__': - print('确') for i in range(int(len(font) / 8)): b = 8 - 8 for j in range(8 - 8, 8): diff --git a/code/t1/t3.py b/code/t1/t3.py index 54437ee..2de71a6 100644 --- a/code/t1/t3.py +++ b/code/t1/t3.py @@ -36,3 +36,4 @@ def getDailyEpidemicData(adCode: str = '440100'): # 昨日无症状新增 yes_wzz_add: 7166 print('昨日确诊新增', data['yes_confirm_add']) print('昨日无症状新增', data['yes_wzz_add']) + print(len("2134")) diff --git a/code/ui/default.py b/code/ui/default.py index 238559f..0cf1840 100644 --- a/code/ui/default.py +++ b/code/ui/default.py @@ -209,8 +209,10 @@ def weather_display(city, weather): # 新冠疫情感染人数新增 printChinese('确诊新增', 160, 176, color=WHITE, backcolor=BLACK, size=1) + d.printStr(" " * len(weather[9]), 160, 192, BLACK, size=1) # 消除残影 d.printStr(weather[9], 160, 192, WHITE, size=1) printChinese('无症状新增', 160, 208, color=WHITE, backcolor=BLACK, size=1) + d.printStr(" " * len(weather[9]), 160, 224, BLACK, size=1) # 消除残影 d.printStr(weather[10], 160, 224, WHITE, size=1) From 8542b82fe1affe6ae3b4162232eb82f4bc7baab6 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Sat, 3 Dec 2022 13:05:33 +0800 Subject: [PATCH 06/13] =?UTF-8?q?refactor:=20=E5=A2=9E=E5=8A=A030=E6=97=A5?= =?UTF-8?q?=E7=96=AB=E6=83=85=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/libs/tool.py | 54 ++++++ code/main.py | 22 ++- code/t1/main.py | 372 ++++++++++++++++++++++++++++++++------ code/t1/main3.py | 63 +++++++ code/t1/t3.py | 20 +- code/t1/t4.py | 63 +++++++ code/ui/daily_epidemic.py | 106 +++++++++++ code/ui/default.py | 55 +----- 8 files changed, 627 insertions(+), 128 deletions(-) create mode 100644 code/libs/tool.py create mode 100644 code/t1/main3.py create mode 100644 code/t1/t4.py create mode 100644 code/ui/daily_epidemic.py diff --git a/code/libs/tool.py b/code/libs/tool.py new file mode 100644 index 0000000..a235dcd --- /dev/null +++ b/code/libs/tool.py @@ -0,0 +1,54 @@ +from libs import global_var +from data.Fonts import fonts +d = global_var.LCD +# 中文显示 +def printChinese(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=1): + font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 + + chinese_dict = {} + + # 获取对应的字模 + if size == 1: + chinese_dict = fonts.hanzi_16x16_dict + + elif size == 2: + chinese_dict = fonts.hanzi_24x24_dict + + elif size == 3: + chinese_dict = fonts.hanzi_32x32_dict + + elif size == 4: + chinese_dict = fonts.hanzi_40x40_dict + + elif size == 5: + chinese_dict = fonts.hanzi_48x48_dict + + xs = x + ys = y + + # 定义字体颜色,RGB888转RGB565 + fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 + bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 + + for i in range(0, len(text)): + + ch_buf = chinese_dict[text[i]] # 汉子对应码表 + + rgb_buf = [] + + t1 = font_size[size] // 8 + t2 = font_size[size] % 8 + + for i in range(0, len(ch_buf)): + + for j in range(0, 8): + if (ch_buf[i] << j) & 0x80 == 0x00: + rgb_buf.append(bc & 0xff) + rgb_buf.append(bc >> 8) + else: + rgb_buf.append(fc & 0xff) + rgb_buf.append(fc >> 8) + + d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) + + xs += font_size[size] diff --git a/code/main.py b/code/main.py index a87006d..d7860c8 100644 --- a/code/main.py +++ b/code/main.py @@ -19,12 +19,13 @@ from libs import global_var, ap from libs.urllib import urequest +from ui import daily_epidemic # 30天疫情主题 # 导入主题 from ui import default # 默认经典主题 from ui import dial # 极简表盘主题 from ui import photo_album # 相册主题 -ui_qty = 3 # UI总数量 +ui_qty = 4 # UI总数量 ui_choice = 0 # 初始UI标志位 ######################## @@ -233,6 +234,7 @@ def city_get(): f.close() city[0] = info['CITY'] + city[2] = getIdCardCode(city[0]) # 获取城市名称 f = open('/data/CityCode.txt', 'r') @@ -381,8 +383,7 @@ def getDailyEpidemicData(adCode: str = '440100'): def epidemic_situation_get(): global weather, city - city[2] = getIdCardCode("广州") - data = getDailyEpidemicData() + data = getDailyEpidemicData(city[2]) weather[9] = str(data['yes_confirm_add']) weather[10] = str(data['yes_wzz_add']) @@ -409,18 +410,20 @@ def epidemic_situation_get(): d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('City Data', 10, 120, WHITE, size=3) city_get() - + wdt.feed() # 喂狗 # 同步网络时钟 d.fill(BLACK) d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('Date & Time', 10, 120, WHITE, size=3) ntp_get() + wdt.feed() # 喂狗 # 同步天气信息 d.fill(BLACK) d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('Weather Data', 10, 120, WHITE, size=3) weather_get(rtc.datetime()) + wdt.feed() # 喂狗 # 获取疫情新增人数信息 d.fill(BLACK) @@ -428,7 +431,8 @@ def epidemic_situation_get(): d.printStr('Epidemic Situation', 10, 120, WHITE, size=3) d.printStr('Data', 10, 180, WHITE, size=3) epidemic_situation_get() - + wdt.feed() # 喂狗 + # 信息打印 info_print() @@ -454,12 +458,12 @@ def epidemic_situation_get(): wdt.feed() # 喂狗 if ui_choice == 0: - default.UI_Display(city, weather, datetime) # 默认UI - + daily_epidemic.UI_Display(city, datetime) # 30天疫情 elif ui_choice == 1: - dial.UI_Display(datetime) # 极简表盘 - + default.UI_Display(city, weather, datetime) # 默认UI elif ui_choice == 2: + dial.UI_Display(datetime) # 极简表盘 + elif ui_choice == 3: photo_album.UI_Display(datetime) # 相册主图 # print('gc2:',gc.mem_free()) #内存监测 diff --git a/code/t1/main.py b/code/t1/main.py index d9dbeea..f32c073 100644 --- a/code/t1/main.py +++ b/code/t1/main.py @@ -1,89 +1,347 @@ ''' -实验名称:1.5寸LCD液晶显示屏(240x240) +实验名称:pyClock天气时钟-出厂例程 版本:v1.0 -日期:2022.4 +日期:2022.5 作者:01Studio -实验平台:pyController -说明:通过编程实现LCD的各种显示功能,包括填充、画点、线、矩形、圆形、显示英文、显示图片等。 ''' -#导入相关模块 -from tftlcd import LCD15 -import time -from data.Fonts import fonts import gc -#定义常用颜色 -RED = (255,0,0) -GREEN = (0,255,0) -BLUE = (0,0,255) -BLACK = (0,0,0) -WHITE = (255,255,255) +# 导入相关模块 +import json +import os +import re +import time + +import machine +import network +import ntptime +from machine import Pin, RTC, WDT + +from libs import global_var, ap +from libs.urllib import urequest +# 导入主题 +from ui import default # 默认经典主题 +from ui import dial # 极简表盘主题 +from ui import photo_album # 相册主题 + +ui_qty = 3 # UI总数量 +ui_choice = 0 # 初始UI标志位 ######################## # 构建1.5寸LCD对象并初始化 ######################## -d = LCD15(portrait=1) #默认方向竖屏 -gc.collect() -def printChinese(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=1): - font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 +d = global_var.LCD + +# 定义常用颜色 +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +YELLOW = (255, 255, 0) +DEEPGREEN = (1, 179, 105) + +''' +城市信息: +[0]城市,[1]天气编码,[2]身份证编码 +''' +city = ['', '', ''] + +''' +天气信息: +[0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度,[9]昨日确诊新增,[10]昨日无症状新增 +''' +weather = [''] * 11 # 定义一个长度为9的字符列表 + +# 构建RTC时钟对象 +rtc = RTC() + +# 初始化WIFI指示灯 +WIFI_LED = Pin(2, Pin.OUT) + + +# WIFI连接函数 +def WIFI_Connect(): + wlan = network.WLAN(network.STA_IF) # STA模式 + wlan.active(True) # 激活接口 + start_time = time.time() # 记录时间做超时判断 + + if not wlan.isconnected(): + + print('Connecting to network...') + + with open('wifi.txt', 'r') as f: # 获取账号密码 + info = json.loads(f.read()) + print(info) + d.fill(BLACK) + d.printStr('Connecting...', 10, 50, RED, size=2) + d.printStr(info['SSID'], 10, 110, WHITE, size=2) + d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) + wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 + + while not wlan.isconnected(): + + # LED闪烁提示 + WIFI_LED.value(1) + time.sleep_ms(300) + WIFI_LED.value(0) + time.sleep_ms(300) + + # 超时判断,15秒没连接成功判定为超时 + if time.time() - start_time > 15: + wlan.active(False) + # 点亮LED表示没连接上WiFi + WIFI_LED.value(1) + print('WIFI Connected Timeout!') + return False + + # 连接成功,熄灭LED + WIFI_LED.value(0) + + # 串口打印信息 + print('network information:', wlan.ifconfig()) + + return True + + +# 设置NTP时间偏移量,就是我们所谓的时区,中国在UTC +8 的时区计算方式: 3155673600 - 8*3600 = 3155644800 +# 3155673600 是默认的UTC,以秒计算偏移量。 +ntptime.NTP_DELTA = 3155644800 +ntptime.host = 'ntp1.aliyun.com' + + +# 获取网络时间 +def ntp_get(): + for i in range(10): # 最多尝试获取10次 + + try: + ntptime.settime() # 获取网络时间 + print("ntp time(BeiJing): ", rtc.datetime()) + return True + + except: + print("Can not get time!") + + time.sleep_ms(500) + + + +# 信息打印 +def info_print(): + global city, weather + + print(rtc.datetime()) + + print('城市:', city[0], city[1]) + + print('当日天气:', weather[0]) + print('当日最低温:', weather[1]) + print('当日最高温:', weather[2]) + print('实时天气:', weather[3]) + print('实时空气质量:', weather[4]) + print('实时风向:', weather[5]) + print('实时风力级数:', weather[6]) + print('实时温度:', weather[7]) + print('实时湿度:', weather[8]) + print('昨日确诊新增:', weather[9]) + print('昨日无症状新增:', weather[10]) + + +# 获取城市信息 +def city_get(): + global city + + # 获取城市编码 + with open('wifi.txt', 'r') as f: + info = json.loads(f.read()) + f.close() + + city[0] = info['CITY'] + city[2] = getIdCardCode("广州") + + # 获取城市名称 + f = open('/data/CityCode.txt', 'r') + num = 0 + while True: + text = f.readline() + if city[0] in text: + if city[0] == re.match(r'"(.+?)"', text).group(1): # 城市名称完全一样 + city[1] = re.match(r'"(.+?)"', text.split(': ')[1]).group(1) # "获取城市编码" + break + elif '}' in text: # 结束,没这个城市。 + print('No City Name!') + break + + num = num + 1 + + if num == 300: + gc.collect() # 内存回收 + num = 0 + + f.close() + city_node = 0 + + # city.txt文件存在,判断文件是否已经有当前城市字库 + if 'city.txt' in os.listdir('/data/'): + f = open('/data/city.txt', 'r') + city_text = f.read() + for i in range(len(city[0])): + + if city[0][i] in city_text: + + if i == len(city[0]) - 1: # 全部字体都有 + + city_node = 1 # 标记字符信息正常 + f.close() + + # 城市字库正常,无需制作 + if city_node == 1: + pass + + else: # 获取字库文件并保存 + # 生成城市字模文件 + city_font = {} + + for i in range(len(city[0])): + + f = open('/data/Fonts/fonts_city.py', 'r') + + while True: + + text = f.readline() + + if city[0][i] in text: + + while True: + + text = text + f.readline() + + if ')' in text: + a = re.search('[(]' + '(.*?)' + '[)]', text).group(1) \ + .replace('\r\n', '') \ + .replace(' ', '').split(',') + + for j in range(len(a)): + a[j] = int(a[j]) + + city_font[city[0][i]] = a + break + break + + if not text: # 读完 + print("No City Fonts.") + break + + f.close() + + f = open('/data/city.txt', 'w') # 以写的方式打开一个文件,没有该文件就自动新建 + f.write((json.dumps(city_font))) # 写入数据 + f.close() # 每次操作完记得关闭文件 + + gc.collect() # 内存回收 + + +# 按键 +KEY = Pin(9, Pin.IN, Pin.PULL_UP) # 构建KEY对象 + + +# 按键中断触发 +def key(KEY): + global ui_choice, ui_qty + time.sleep_ms(10) # 消除抖动 + if KEY.value() == 0: # 确认按键被按下 + + # 短按切换UI + global_var.UI_Change = 1 + ui_choice = ui_choice + 1 + if ui_choice == ui_qty: # UI数量 + ui_choice = 0 + + # 出厂模式 + start = time.ticks_ms() + while KEY.value() == 0: + + if time.ticks_ms() - start > 5000: # 长按按键5秒 - chinese_dict = {} + WIFI_LED.value(1) # 指示灯亮 + print("Factory Mode!") + try: + os.remove('wifi.txt') + print('Remove wifi.txt') + except: + print('no wifi.txt') - # 获取对应的字模 - if size == 1: - chinese_dict = fonts.hanzi_16x16_dict + machine.reset() # 重启开发板。 - elif size == 2: - chinese_dict = fonts.hanzi_24x24_dict - elif size == 3: - chinese_dict = fonts.hanzi_32x32_dict +KEY.irq(key, Pin.IRQ_FALLING) # 定义中断,下降沿触发 - elif size == 4: - chinese_dict = fonts.hanzi_40x40_dict - elif size == 5: - chinese_dict = fonts.hanzi_48x48_dict +def getIdCardCode(cityName: str): + city = None + with open('/data/IdCard.txt', 'r') as f: + while True: + text = f.readline() + if cityName in text: + city = re.match(r'"(.+?)"', text.split(':')[1]).group(1) # "获取城市编码" + break + elif '}' in text: # 结束,没这个城市。 + print('No City Name!') + break + return city - xs = x - ys = y +################ +# 主程序 # +################ +if __name__ == '__main__': + # 没有WiFi配置文件,出厂模式 + while 'wifi.txt' not in os.listdir(): + ap.startAP() # 启动AP配网模式 - # 定义字体颜色,RGB888转RGB565 - fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 - bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 + # 启动看门狗,超时30秒。 + wdt = WDT(timeout=30000) - for i in range(0, len(text)): + # 连接WiFi + while not WIFI_Connect(): # 等待wifi连接 + pass - ch_buf = chinese_dict[text[i]] # 汉子对应码表 + wdt.feed() # 喂狗 - rgb_buf = [] + # 获取城市名称和编码 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('City Data', 10, 120, WHITE, size=3) + city_get() - t1 = font_size[size] // 8 - t2 = font_size[size] % 8 + # 同步网络时钟 + d.fill(BLACK) + d.printStr('Getting...', 10, 60, RED, size=3) + d.printStr('Date & Time', 10, 120, WHITE, size=3) + ntp_get() - for i in range(0, len(ch_buf)): + # 信息打印 + info_print() - for j in range(0, 8): - if (ch_buf[i] << j) & 0x80 == 0x00: - rgb_buf.append(bc & 0xff) - rgb_buf.append(bc >> 8) - else: - rgb_buf.append(fc & 0xff) - rgb_buf.append(fc >> 8) + tick = 61 # 每秒刷新标志位 - d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) + while True: - xs += font_size[size] + # 获取时间 + datetime = rtc.datetime() -#填充白色 -d.fill(BLACK) + # 30分钟在线获取一次天气信息,顺便检测wifi是否掉线 + if datetime[5] % 30 == 0 and datetime[6] == 0: + WIFI_Connect() # 检查WiFi,掉线的话自动重连 + info_print() # 打印相关信息 -#写字符,4种尺寸 + # 每秒刷新一次UI + if tick != datetime[6]: -printChinese('确诊新增', 160, 176, color=WHITE, backcolor=BLACK, size=1) # 清除显示残留 -d.printStr('12', 160, 192, WHITE, size=1) -printChinese('无症状新增', 160, 208, color=WHITE, backcolor=BLACK, size=1) -d.printStr('13', 160, 224, WHITE, size=1) + tick = datetime[6] + wdt.feed() # 喂狗 + if ui_choice == 0: + pass + time.sleep_ms(200) diff --git a/code/t1/main3.py b/code/t1/main3.py new file mode 100644 index 0000000..328a2b2 --- /dev/null +++ b/code/t1/main3.py @@ -0,0 +1,63 @@ +''' +实验名称:1.5寸LCD液晶显示屏(240x240) +版本:v1.0 +日期:2022.4 +作者:01Studio +实验平台:pyController +说明:通过编程实现LCD的各种显示功能,包括填充、画点、线、矩形、圆形、显示英文、显示图片等。 +''' +import gc +import json + +from libs import global_var +from libs.tool import printChinese +from libs.urllib import urequest + +# 导入相关模块 + +######################## +# 构建1.5寸LCD对象并初始化 +######################## +d = global_var.LCD + +# 定义常用颜色 +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) + +rollCount = 0 +data = None + + +def getDailyEpidemicData(adCode: str = '440100'): + r = urequest.urlopen( + r"https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?limit=30&adCode=" + adCode) # 发get请求 + text = r.read(39000).decode('utf-8') # 抓取约前4W个字符,节省内存。 + info = json.loads(text) + if info['ret'] == 0: + return info['data'] + else: + return None + + +# 用于显示动画 +second2 = 61 + + +def message_display(second): + global data + d.fill(BLACK) # 清屏 + printChinese('日 ', 0, 0, color=WHITE, backcolor=BLACK, size=2) + printChinese('确诊 ', 72, 0, color=WHITE, backcolor=BLACK, size=2) + printChinese('无症状', 144, 0, color=WHITE, backcolor=BLACK, size=2) + for i in range(len(data)): + d.printStr(data[i]['date'], 0, 24 + 16 * i + second, WHITE, size=1) + d.printStr(data[i]['yes_confirm_add'], 72, 24 + 16 * i + second, RED, size=1) + d.printStr(data[i]['yes_wzz_add'], 144, 24 + 16 * i + second, RED, size=1) + +if __name__=='__main__': + global data + data=getDailyEpidemicData() + message_display(0) \ No newline at end of file diff --git a/code/t1/t3.py b/code/t1/t3.py index 2de71a6..80d735a 100644 --- a/code/t1/t3.py +++ b/code/t1/t3.py @@ -17,23 +17,25 @@ # y: "2022" # 昨日确诊新增 yes_confirm_add: 1129 # 昨日无症状新增 yes_wzz_add: 7166 -def getDailyEpidemicData(adCode: str = '440100'): +def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): url = "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list" - data = {'adCode': adCode, 'limit': '1'} + data = {'adCode': adCode, 'limit': limit} r = requests.get(url, params=data) # 发get请求 - print(r.json()) # 将返回的json串转为字典 + print(len(r.text)) info = json.loads(r.text) if info['ret'] == 0: - return info['data'][0] + return info['data'] else: return None if __name__ == '__main__': - data = getDailyEpidemicData() - print(data) + data = getDailyEpidemicData(limit=40) + # data = None # 昨日确诊新增 yes_confirm_add: 1129 # 昨日无症状新增 yes_wzz_add: 7166 - print('昨日确诊新增', data['yes_confirm_add']) - print('昨日无症状新增', data['yes_wzz_add']) - print(len("2134")) + if data != None: + for i in range(len(data)): + print('日期', data[i]['date'], end=":") + print('昨日确诊新增', data[i]['yes_confirm_add'], end=" ") + print('昨日无症状新增', data[i]['yes_wzz_add']) diff --git a/code/t1/t4.py b/code/t1/t4.py new file mode 100644 index 0000000..c860e4b --- /dev/null +++ b/code/t1/t4.py @@ -0,0 +1,63 @@ +import json + +import requests + + +# adcode: "440100" +# city: "广州" +# 全省确诊 confirm: 19392 +# 全省确诊新增 confirm_add: "1129" +# date: "11.27" +# 死亡 dead: 0 +# 治愈 heal: 0 +# is_show_wzz_add: 1 +# suspect: 0 +# 本日新增 today_confirm_add: 0 +# 本日无症状新增 today_wzz_add: 0 +# y: "2022" +# 昨日确诊新增 yes_confirm_add: 1129 +# 昨日无症状新增 yes_wzz_add: 7166 +def getHeight(head: int = 24, row: int = 0, rowHeight: int = 16): + fixedHeight = head + rowHeight * row + return fixedHeight + + +def getDailyEpidemicData(adCode: str = '440100'): + url = "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list" + data = {'adCode': adCode, 'limit': '30'} + r = requests.get(url, params=data) # 发get请求 + print(len(r.text)) + print(r.json()) # 将返回的json串转为字典 + info = json.loads(r.text) + if info['ret'] == 0: + return info['data'] + else: + return None + + +# 最多能显示的行数 +screenHeight = 240 +titleHeight = 24 +rowHeight = 16 +rowCount = (screenHeight - titleHeight) / rowHeight + + +def getRowOffset(second: int): + row_offset_start = int(second / 44 * rowCount) + row_offset_end = -1 if row_offset_start + 13 > 30 else row_offset_start + 13 + return row_offset_start, row_offset_end + + +if __name__ == '__main__': + + data = getDailyEpidemicData() + for i in range(60): + second = i + row_offset_start, row_offset_end = getRowOffset(i) + print("data" * 60) + if data != None: + for i, item in enumerate(data[row_offset_start:row_offset_end]): + print(i, getHeight(row=i)) + print('日期', item['date'], end=":") + print('昨日确诊新增', item['yes_confirm_add'], end=" ") + print('昨日无症状新增', item['yes_wzz_add']) diff --git a/code/ui/daily_epidemic.py b/code/ui/daily_epidemic.py new file mode 100644 index 0000000..8115c91 --- /dev/null +++ b/code/ui/daily_epidemic.py @@ -0,0 +1,106 @@ +''' +实验名称:疫情30天滚动信息 +版本:v1.0 +日期:2022.12 +作者:Kyle Luo +说明:查询近30天疫情数据,轮播 +''' +import gc +import json + +from libs import global_var +from libs.tool import printChinese +from libs.urllib import urequest + +# 导入相关模块 + +######################## +# 构建1.5寸LCD对象并初始化 +######################## +d = global_var.LCD + +# 定义常用颜色 +RED = (255, 0, 0) +GREEN = (0, 255, 0) +BLUE = (0, 0, 255) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +# 最多能显示的行数 +screenHeight = 240 +titleHeight = 24 +rowHeight = 16 +limit = 30 +rowCount = (screenHeight - titleHeight) / rowHeight + + +def getRowOffset(second: int): + global limit + row_offset_start = int(second / 44 * rowCount) + row_offset_end = limit if row_offset_start + 13 > limit else row_offset_start + 13 + return row_offset_start, row_offset_end + + +data = [] + + +def getHeight(head: int = 24, row: int = 0, rowHeight: int = 16): + fixedHeight = head + rowHeight * row + return fixedHeight + + +def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): + gc.collect() + r = urequest.urlopen( + r"https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?limit=" + str(limit) + "&adCode=" + adCode) # 发get请求 + text = r.read(7000).decode('utf-8') # 抓取约前4W个字符,节省内存。 + info = json.loads(text) + if info['ret'] == 0: + return info['data'] + else: + return None + + +# 用于显示动画 +second2 = 61 + + +def message_display(second): + global data + if data != None: + row_offset_start, row_offset_end = getRowOffset(second) + for i, item in enumerate(data[row_offset_start:row_offset_end]): + height = getHeight(row=i) + d.printStr(item['date'], 0, height, WHITE, size=1) + d.printStr(str(item['yes_confirm_add']), 72, height, RED, size=1) + d.printStr(str(item['yes_wzz_add']), 144, height, RED, size=1) + + +def printTitle(): + d.fill(BLACK) # 清屏 + printChinese('日 ', 0, 0, color=WHITE, backcolor=BLACK, size=2) + printChinese('确诊 ', 72, 0, color=WHITE, backcolor=BLACK, size=2) + printChinese('无症状', 144, 0, color=WHITE, backcolor=BLACK, size=2) + + +def UI_Display(city, datetime): + global second2, data, limit + if global_var.UI_Change: # 首次画表盘 + global_var.UI_Change = 0 + d.fill(BLACK) # 清屏 + printTitle() + data = getDailyEpidemicData(city[2], limit) + message_display(datetime[6]) + + # 定期回收内存 + if second2 != datetime[6]: + if gc.mem_free() < 15000: # 内存不足 + gc.collect() # 回收内存 + second2 = datetime[6] + + if datetime[6] % 5 == 0: + message_display(datetime[6]) + + # 疫情刷新时间30分钟 + if datetime[5] % 30 == 0 and datetime[6] == 0: + printTitle() + data = getDailyEpidemicData(city[2], limit) diff --git a/code/ui/default.py b/code/ui/default.py index 0cf1840..96c2e4b 100644 --- a/code/ui/default.py +++ b/code/ui/default.py @@ -11,9 +11,10 @@ import json import time -from data.Fonts import fonts from libs import global_var +from libs.tool import printChinese + # 动态信息显示 message_num = 0 @@ -45,58 +46,6 @@ air_quality = ['优', '良', '轻度', '中度', '重度', '严重'] -# 中文显示 -def printChinese(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=1): - font_size = [0, 16, 24, 32, 40, 48] # 分别对应size=1,2,3,4,5的字体尺寸,0无效。 - - chinese_dict = {} - - # 获取对应的字模 - if size == 1: - chinese_dict = fonts.hanzi_16x16_dict - - elif size == 2: - chinese_dict = fonts.hanzi_24x24_dict - - elif size == 3: - chinese_dict = fonts.hanzi_32x32_dict - - elif size == 4: - chinese_dict = fonts.hanzi_40x40_dict - - elif size == 5: - chinese_dict = fonts.hanzi_48x48_dict - - xs = x - ys = y - - # 定义字体颜色,RGB888转RGB565 - fc = ((color[0] >> 3) << 11) + ((color[1] >> 2) << 5) + (color[2] >> 3) # 字体 - bc = ((backcolor[0] >> 3) << 11) + ((backcolor[1] >> 2) << 5) + (backcolor[2] >> 3) # 字体背景颜色 - - for i in range(0, len(text)): - - ch_buf = chinese_dict[text[i]] # 汉子对应码表 - - rgb_buf = [] - - t1 = font_size[size] // 8 - t2 = font_size[size] % 8 - - for i in range(0, len(ch_buf)): - - for j in range(0, 8): - if (ch_buf[i] << j) & 0x80 == 0x00: - rgb_buf.append(bc & 0xff) - rgb_buf.append(bc >> 8) - else: - rgb_buf.append(fc & 0xff) - rgb_buf.append(fc >> 8) - - d.write_buf(bytearray(rgb_buf), xs, y, font_size[size], font_size[size]) - - xs += font_size[size] - # 城市显示 def printCity(text, x, y, color=(0, 0, 0), backcolor=(255, 255, 255), size=2): From ba8b6c732dfffe782feec47843ebe6c08806325f Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 10:13:52 +0800 Subject: [PATCH 07/13] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E5=88=B7?= =?UTF-8?q?=E5=B1=8F=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 增加汉字“期” 2. 调整title为RGB随机 3. 重新调整数据偏移算法 --- code/data/Fonts/fonts.py | 18 ++++++++- code/libs/color.py | 25 ++++++++++++ code/main.py | 35 ++++++++-------- code/t1/GenerateFont.py | 33 ++++++++------- code/t1/t4.py | 60 ++++++++++++++++++++------- code/ui/daily_epidemic.py | 85 ++++++++++++++++++++++++--------------- 6 files changed, 173 insertions(+), 83 deletions(-) create mode 100644 code/libs/color.py diff --git a/code/data/Fonts/fonts.py b/code/data/Fonts/fonts.py index e67c3a0..45add0f 100644 --- a/code/data/Fonts/fonts.py +++ b/code/data/Fonts/fonts.py @@ -58,6 +58,13 @@ 0xc0, 0x7f, 0x7, 0xc0, 0xff, 0x7, 0xe0, 0xf7, 0xe, 0xe0, 0xe7, 0xe, 0xf0, 0x47, 0x1e, 0x78, 0x7, 0x3c, 0x7c, 0x7, 0x78, 0x3f, 0x7, 0xf8, 0x1f, 0x7, 0x70, 0xe, 0x7, 0xa0, 0x0,), + "期": ( + 0x1e, 0x38, 0x0, 0x1e, 0x3b, 0xff, 0x1c, 0x3b, 0xff, 0x7f, 0xfd, 0xff, 0x7f, 0xfd, 0x87, 0x7f, 0xfd, 0x87, 0xc, + 0x39, 0x87, 0xf, 0xf9, 0xff, 0xf, 0xf9, 0xff, 0xc, 0x39, 0xff, 0xc, 0x39, 0x87, 0xf, 0xf9, 0x87, 0xf, 0xfb, + 0x87, + 0xc, 0x3b, 0xff, 0xc, 0x3b, 0xff, 0x7f, 0xff, 0xff, 0x7f, 0xff, 0x87, 0x4c, 0x67, 0x87, 0xe, 0xf7, 0x7, 0x1e, + 0x7f, + 0x7, 0x3c, 0x3e, 0xf, 0x78, 0x1e, 0x3f, 0x30, 0x1c, 0x3e, 0x0, 0x4, 0x1c,), # 空气质量 "优": (0x00, 0x00, 0x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xfe, 0x30, 0xe, 0x30, 0xc,) } diff --git a/code/libs/color.py b/code/libs/color.py new file mode 100644 index 0000000..af2f823 --- /dev/null +++ b/code/libs/color.py @@ -0,0 +1,25 @@ +import random + +# 定义常用颜色 +RED = (255, 0, 0) +ORANGE = (255, 255, 0) +YELLOW = (0, 255, 255) +GREEN = (0, 255, 0) +CYAN = (0, 255, 255) +BLUE = (0, 0, 255) +PURPLE = (255, 0, 200) +BLACK = (0, 0, 0) +WHITE = (255, 255, 255) +RGB_COLOR = [RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE] + + +def getRandomColor(): + global RGB_COLOR + randint = random.randint(0, len(RGB_COLOR) - 1) + return RGB_COLOR[randint] + + +if __name__ == '__main__': + for i in range(20): + color = getRandomColor() + print(color) diff --git a/code/main.py b/code/main.py index d7860c8..3a166e9 100644 --- a/code/main.py +++ b/code/main.py @@ -15,7 +15,7 @@ import machine import network import ntptime -from machine import Pin, RTC, WDT +from machine import Pin, RTC from libs import global_var, ap from libs.urllib import urequest @@ -60,6 +60,9 @@ # 初始化WIFI指示灯 WIFI_LED = Pin(2, Pin.OUT) +# 启动看门狗,超时30秒。 +# wdt = WDT(timeout=30000) +wdt = None # WIFI连接函数 def WIFI_Connect(): @@ -388,6 +391,12 @@ def epidemic_situation_get(): weather[10] = str(data['yes_wzz_add']) +def feedDog(): + global wdt + if wdt is not None: + wdt.feed() # 喂狗 + + ################ # 主程序 # ################ @@ -396,34 +405,31 @@ def epidemic_situation_get(): while 'wifi.txt' not in os.listdir(): ap.startAP() # 启动AP配网模式 - # 启动看门狗,超时30秒。 - wdt = WDT(timeout=30000) - # 连接WiFi while not WIFI_Connect(): # 等待wifi连接 pass - wdt.feed() # 喂狗 + feedDog() # 喂狗 # 获取城市名称和编码 d.fill(BLACK) d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('City Data', 10, 120, WHITE, size=3) city_get() - wdt.feed() # 喂狗 + feedDog() # 喂狗 # 同步网络时钟 d.fill(BLACK) d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('Date & Time', 10, 120, WHITE, size=3) ntp_get() - wdt.feed() # 喂狗 + feedDog() # 喂狗 # 同步天气信息 d.fill(BLACK) d.printStr('Getting...', 10, 60, RED, size=3) d.printStr('Weather Data', 10, 120, WHITE, size=3) weather_get(rtc.datetime()) - wdt.feed() # 喂狗 + feedDog() # 喂狗 # 获取疫情新增人数信息 d.fill(BLACK) @@ -431,15 +437,13 @@ def epidemic_situation_get(): d.printStr('Epidemic Situation', 10, 120, WHITE, size=3) d.printStr('Data', 10, 180, WHITE, size=3) epidemic_situation_get() - wdt.feed() # 喂狗 - + feedDog() # 喂狗 + # 信息打印 info_print() tick = 61 # 每秒刷新标志位 - while True: - # 获取时间 datetime = rtc.datetime() @@ -452,13 +456,10 @@ def epidemic_situation_get(): # 每秒刷新一次UI if tick != datetime[6]: - tick = datetime[6] - - wdt.feed() # 喂狗 - + feedDog() # 喂狗 if ui_choice == 0: - daily_epidemic.UI_Display(city, datetime) # 30天疫情 + daily_epidemic.UI_Display(city, weather, datetime) # 30天疫情 elif ui_choice == 1: default.UI_Display(city, weather, datetime) # 默认UI elif ui_choice == 2: diff --git a/code/t1/GenerateFont.py b/code/t1/GenerateFont.py index b904d3a..4de79ab 100644 --- a/code/t1/GenerateFont.py +++ b/code/t1/GenerateFont.py @@ -1,20 +1,19 @@ -font = [ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,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== '__main__': for i in range(int(len(font) / 8)): b = 8 - 8 diff --git a/code/t1/t4.py b/code/t1/t4.py index c860e4b..dc128a5 100644 --- a/code/t1/t4.py +++ b/code/t1/t4.py @@ -1,4 +1,5 @@ import json +import math import requests @@ -17,9 +18,6 @@ # y: "2022" # 昨日确诊新增 yes_confirm_add: 1129 # 昨日无症状新增 yes_wzz_add: 7166 -def getHeight(head: int = 24, row: int = 0, rowHeight: int = 16): - fixedHeight = head + rowHeight * row - return fixedHeight def getDailyEpidemicData(adCode: str = '440100'): @@ -35,29 +33,61 @@ def getDailyEpidemicData(adCode: str = '440100'): return None -# 最多能显示的行数 -screenHeight = 240 -titleHeight = 24 -rowHeight = 16 -rowCount = (screenHeight - titleHeight) / rowHeight +class HeightCalculator(): + def __init__(self): + # 屏幕高度 + self.screenHeight = 240 + # 标题高度 + self.titleHeight = 24 + # 每行数据高度 + self.rowHeight = 16 + # 一屏幕能显示数据的行数 + self.rowCount = math.floor((self.screenHeight - self.titleHeight) / self.rowHeight) + # 多少秒触发一次数据移动 + self.triggerSecond = 5 + # 一分钟内数据能移动的次数 + self.numberOfMoves = math.floor(60 / self.triggerSecond) + # 数据条数 + self.numberOfData = 30 + # 移动距离 + self.movingDistance = math.ceil((self.numberOfData - self.rowCount) / self.numberOfMoves) + # 移动速度 + self.movingSpeed = self.movingDistance / self.triggerSecond + def getRowOffset(self, second: int): + offset = math.floor(second * self.movingSpeed) + if offset - 1 < 0: + offset = 0 + if offset > self.numberOfData: + offset = self.numberOfData - 1 + row_offset_start = offset + row_offset_end = None if row_offset_start + self.rowCount > self.numberOfData else row_offset_start + self.rowCount + return row_offset_start, row_offset_end -def getRowOffset(second: int): - row_offset_start = int(second / 44 * rowCount) - row_offset_end = -1 if row_offset_start + 13 > 30 else row_offset_start + 13 - return row_offset_start, row_offset_end + def getHeight(self, row: int = 0): + fixedHeight = self.titleHeight + self.rowHeight * row + return fixedHeight if __name__ == '__main__': + heightCalculator = HeightCalculator() + # data2 = [i for i in range(heightCalculator.numberOfData)] + # for i in range(60): + # row_offset_start, row_offset_end = heightCalculator.getRowOffset(i) + # if data2 != None: + # print("*" * 60, "起点=", str(row_offset_start), "终点=", str(row_offset_end)) + # print(data2[row_offset_start:row_offset_end]) + # for item in data2[row_offset_start:row_offset_end]: + # print(item) data = getDailyEpidemicData() for i in range(60): second = i - row_offset_start, row_offset_end = getRowOffset(i) - print("data" * 60) + row_offset_start, row_offset_end = heightCalculator.getRowOffset(i) + print("*" * 60) if data != None: for i, item in enumerate(data[row_offset_start:row_offset_end]): - print(i, getHeight(row=i)) + # print(i, heightCalculator.getHeight(row=i)) print('日期', item['date'], end=":") print('昨日确诊新增', item['yes_confirm_add'], end=" ") print('昨日无症状新增', item['yes_wzz_add']) diff --git a/code/ui/daily_epidemic.py b/code/ui/daily_epidemic.py index 8115c91..67928eb 100644 --- a/code/ui/daily_epidemic.py +++ b/code/ui/daily_epidemic.py @@ -7,8 +7,10 @@ ''' import gc import json +import math from libs import global_var +from libs.color import RED, BLACK, WHITE, getRandomColor from libs.tool import printChinese from libs.urllib import urequest @@ -19,39 +21,55 @@ ######################## d = global_var.LCD -# 定义常用颜色 -RED = (255, 0, 0) -GREEN = (0, 255, 0) -BLUE = (0, 0, 255) -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -# 最多能显示的行数 -screenHeight = 240 -titleHeight = 24 -rowHeight = 16 +# 数据限制 limit = 30 -rowCount = (screenHeight - titleHeight) / rowHeight -def getRowOffset(second: int): - global limit - row_offset_start = int(second / 44 * rowCount) - row_offset_end = limit if row_offset_start + 13 > limit else row_offset_start + 13 - return row_offset_start, row_offset_end +class HeightCalculator(): + def __init__(self): + global limit + # 屏幕高度 + self.screenHeight = 240 + # 标题高度 + self.titleHeight = 16 + # 每行数据高度 + self.rowHeight = 16 + # 一屏幕能显示数据的行数 + self.rowCount = math.floor((self.screenHeight - self.titleHeight) / self.rowHeight) + # 多少秒触发一次数据移动 + self.triggerSecond = 5 + # 一分钟内数据能移动的次数 + self.numberOfMoves = math.floor(60 / self.triggerSecond) + # 数据条数 + self.numberOfData = limit + # 移动距离 + self.movingDistance = math.ceil((self.numberOfData - self.rowCount) / self.numberOfMoves) + # 移动速度 + self.movingSpeed = self.movingDistance / self.triggerSecond + + def getRowOffset(self, second: int): + offset = math.floor(second * self.movingSpeed) + if offset - 1 < 0: + offset = 0 + if offset > self.numberOfData: + offset = self.numberOfData - 1 + row_offset_start = offset + row_offset_end = None if row_offset_start + self.rowCount > self.numberOfData else row_offset_start + self.rowCount + return row_offset_start, row_offset_end + + def getHeight(self, row: int = 0): + fixedHeight = self.titleHeight + self.rowHeight * row + return fixedHeight data = [] -def getHeight(head: int = 24, row: int = 0, rowHeight: int = 16): - fixedHeight = head + rowHeight * row - return fixedHeight - - def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): gc.collect() r = urequest.urlopen( - r"https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?limit=" + str(limit) + "&adCode=" + adCode) # 发get请求 + r"https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list?limit=" + str( + limit) + "&adCode=" + adCode) # 发get请求 text = r.read(7000).decode('utf-8') # 抓取约前4W个字符,节省内存。 info = json.loads(text) if info['ret'] == 0: @@ -66,28 +84,28 @@ def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): def message_display(second): global data + heightCalculator = HeightCalculator() if data != None: - row_offset_start, row_offset_end = getRowOffset(second) + d.fill(BLACK) # 清屏 + printTitle() + row_offset_start, row_offset_end = heightCalculator.getRowOffset(second) for i, item in enumerate(data[row_offset_start:row_offset_end]): - height = getHeight(row=i) + height = heightCalculator.getHeight(row=i) d.printStr(item['date'], 0, height, WHITE, size=1) d.printStr(str(item['yes_confirm_add']), 72, height, RED, size=1) d.printStr(str(item['yes_wzz_add']), 144, height, RED, size=1) def printTitle(): - d.fill(BLACK) # 清屏 - printChinese('日 ', 0, 0, color=WHITE, backcolor=BLACK, size=2) - printChinese('确诊 ', 72, 0, color=WHITE, backcolor=BLACK, size=2) - printChinese('无症状', 144, 0, color=WHITE, backcolor=BLACK, size=2) + printChinese('日期', 0, 0, color=getRandomColor(), backcolor=BLACK, size=1) + printChinese('确诊', 72, 0, color=getRandomColor(), backcolor=BLACK, size=1) + printChinese('无症状', 144, 0, color=getRandomColor(), backcolor=BLACK, size=1) -def UI_Display(city, datetime): +def UI_Display(city, weather, datetime): global second2, data, limit if global_var.UI_Change: # 首次画表盘 global_var.UI_Change = 0 - d.fill(BLACK) # 清屏 - printTitle() data = getDailyEpidemicData(city[2], limit) message_display(datetime[6]) @@ -102,5 +120,8 @@ def UI_Display(city, datetime): # 疫情刷新时间30分钟 if datetime[5] % 30 == 0 and datetime[6] == 0: - printTitle() data = getDailyEpidemicData(city[2], limit) + # 更新最新的疫情信息 + if data is not None and data[-1] is not None: + weather[9] = str(data[-1]['yes_confirm_add']) + weather[10] = str(data[-1]['yes_wzz_add']) From 1dc28eb0941c214fe21bb6653e4ded373b82e9e4 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 10:27:22 +0800 Subject: [PATCH 08/13] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=91=A8?= =?UTF-8?q?=E4=B8=80=E5=87=BA=E9=94=99=E4=BB=A5=E5=8F=8A=E6=8F=90=E5=8F=96?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E5=88=B0color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/data/Fonts/fonts.py | 16 +++++++++----- code/libs/color.py | 2 +- code/main.py | 45 ++++++++++++++++------------------------ code/t1/main.py | 14 ++----------- 4 files changed, 32 insertions(+), 45 deletions(-) diff --git a/code/data/Fonts/fonts.py b/code/data/Fonts/fonts.py index 45add0f..9147d8c 100644 --- a/code/data/Fonts/fonts.py +++ b/code/data/Fonts/fonts.py @@ -192,7 +192,11 @@ 0xF0, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x07, 0xFF, 0xF0, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x06, 0x00, 0x30, 0x00, 0x00, 0x00), - + '一': (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x7F, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,), "二": (0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x0F, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -390,9 +394,11 @@ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,), "期": ( - 0x39, 0xbf, 0x7f, 0xff, 0x7f, 0xf3, 0x7f, 0xf3, 0x3f, 0xbf, 0x3f, 0xbf, 0x39, 0xb3, 0x3f, 0xb3, 0x3f, 0xbf, 0x39, - 0xbf, 0xff, 0xff, 0xff, 0xf3, 0x3b, 0xe3, 0x73, 0xe3, 0x61, 0xcf, 0x0, 0xc7,), + 0x39, 0xbf, 0x7f, 0xff, 0x7f, 0xf3, 0x7f, 0xf3, 0x3f, 0xbf, 0x3f, 0xbf, 0x39, 0xb3, 0x3f, 0xb3, 0x3f, 0xbf, + 0x39, + 0xbf, 0xff, 0xff, 0xff, 0xf3, 0x3b, 0xe3, 0x73, 0xe3, 0x61, 0xcf, 0x0, 0xc7,), "日": ( - 0x3f, 0xfe, 0x30, 0xe, 0x30, 0xe, 0x30, 0xe, 0x30, 0xe, 0x3f, 0xfe, 0x3f, 0xfe, 0x3f, 0xfe, 0x30, 0xe, 0x30, 0xe, - 0x30, 0xe, 0x30, 0xe, 0x3f, 0xfe, 0x3f, 0xfe, 0x30, 0xe, 0x30, 0xc,) + 0x3f, 0xfe, 0x30, 0xe, 0x30, 0xe, 0x30, 0xe, 0x30, 0xe, 0x3f, 0xfe, 0x3f, 0xfe, 0x3f, 0xfe, 0x30, 0xe, 0x30, + 0xe, + 0x30, 0xe, 0x30, 0xe, 0x3f, 0xfe, 0x3f, 0xfe, 0x30, 0xe, 0x30, 0xc,) } diff --git a/code/libs/color.py b/code/libs/color.py index af2f823..e278076 100644 --- a/code/libs/color.py +++ b/code/libs/color.py @@ -11,7 +11,7 @@ BLACK = (0, 0, 0) WHITE = (255, 255, 255) RGB_COLOR = [RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE] - +DEEPGREEN = (1, 179, 105) def getRandomColor(): global RGB_COLOR diff --git a/code/main.py b/code/main.py index 3a166e9..e3dcf2e 100644 --- a/code/main.py +++ b/code/main.py @@ -17,7 +17,7 @@ import ntptime from machine import Pin, RTC -from libs import global_var, ap +from libs import global_var, ap ,color from libs.urllib import urequest from ui import daily_epidemic # 30天疫情主题 # 导入主题 @@ -33,15 +33,6 @@ ######################## d = global_var.LCD -# 定义常用颜色 -RED = (255, 0, 0) -GREEN = (0, 255, 0) -BLUE = (0, 0, 255) -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -YELLOW = (255, 255, 0) -DEEPGREEN = (1, 179, 105) - ''' 城市信息: [0]城市,[1]天气编码,[2]身份证编码 @@ -77,10 +68,10 @@ def WIFI_Connect(): with open('wifi.txt', 'r') as f: # 获取账号密码 info = json.loads(f.read()) print(info) - d.fill(BLACK) - d.printStr('Connecting...', 10, 50, RED, size=2) - d.printStr(info['SSID'], 10, 110, WHITE, size=2) - d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) + d.fill(color.BLACK) + d.printStr('Connecting...', 10, 50, color.RED, size=2) + d.printStr(info['SSID'], 10, 110, color.WHITE, size=2) + d.printStr('Press KEY 5s RESET!', 5, 180, color.BLUE, size=2) wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 while not wlan.isconnected(): @@ -412,30 +403,30 @@ def feedDog(): feedDog() # 喂狗 # 获取城市名称和编码 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('City Data', 10, 120, WHITE, size=3) + d.fill(color.BLACK) + d.printStr('Getting...', 10, 60, color.RED, size=3) + d.printStr('City Data', 10, 120, color.WHITE, size=3) city_get() feedDog() # 喂狗 # 同步网络时钟 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('Date & Time', 10, 120, WHITE, size=3) + d.fill(color.BLACK) + d.printStr('Getting...', 10, 60, color.RED, size=3) + d.printStr('Date & Time', 10, 120, color.WHITE, size=3) ntp_get() feedDog() # 喂狗 # 同步天气信息 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('Weather Data', 10, 120, WHITE, size=3) + d.fill(color.BLACK) + d.printStr('Getting...', 10, 60, color.RED, size=3) + d.printStr('Weather Data', 10, 120, color.WHITE, size=3) weather_get(rtc.datetime()) feedDog() # 喂狗 # 获取疫情新增人数信息 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('Epidemic Situation', 10, 120, WHITE, size=3) - d.printStr('Data', 10, 180, WHITE, size=3) + d.fill(color.BLACK) + d.printStr('Getting...', 10, 60, color.RED, size=3) + d.printStr('Epidemic Situation', 10, 120, color.WHITE, size=3) + d.printStr('Data', 10, 180, color.WHITE, size=3) epidemic_situation_get() feedDog() # 喂狗 diff --git a/code/t1/main.py b/code/t1/main.py index f32c073..06d6ae4 100644 --- a/code/t1/main.py +++ b/code/t1/main.py @@ -23,7 +23,7 @@ from ui import default # 默认经典主题 from ui import dial # 极简表盘主题 from ui import photo_album # 相册主题 - +from libs.color import * ui_qty = 3 # UI总数量 ui_choice = 0 # 初始UI标志位 @@ -32,15 +32,6 @@ ######################## d = global_var.LCD -# 定义常用颜色 -RED = (255, 0, 0) -GREEN = (0, 255, 0) -BLUE = (0, 0, 255) -BLACK = (0, 0, 0) -WHITE = (255, 255, 255) -YELLOW = (255, 255, 0) -DEEPGREEN = (1, 179, 105) - ''' 城市信息: [0]城市,[1]天气编码,[2]身份证编码 @@ -59,7 +50,6 @@ # 初始化WIFI指示灯 WIFI_LED = Pin(2, Pin.OUT) - # WIFI连接函数 def WIFI_Connect(): wlan = network.WLAN(network.STA_IF) # STA模式 @@ -157,7 +147,7 @@ def city_get(): f.close() city[0] = info['CITY'] - city[2] = getIdCardCode("广州") + city[2] = getIdCardCode(city[0]) # 获取城市名称 f = open('/data/CityCode.txt', 'r') From 4d0232497cae162acb2b17de5e05d63538640f33 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 13:06:44 +0800 Subject: [PATCH 09/13] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=A4=A9?= =?UTF-8?q?=E6=B0=94=E6=95=B0=E6=8D=AE=E5=9B=A0=E4=B8=BA=E5=86=85=E5=AD=98?= =?UTF-8?q?=E4=B8=8D=E8=B6=B3=E5=AF=BC=E8=87=B4=E7=9A=84=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/data/Fonts/fonts.py | 50 ------ code/main.py | 116 +++++++------ code/t1/main.py | 337 -------------------------------------- code/t1/t5.py | 136 +++++++++++++++ code/ui/daily_epidemic.py | 8 +- 5 files changed, 195 insertions(+), 452 deletions(-) delete mode 100644 code/t1/main.py create mode 100644 code/t1/t5.py diff --git a/code/data/Fonts/fonts.py b/code/data/Fonts/fonts.py index 9147d8c..9005733 100644 --- a/code/data/Fonts/fonts.py +++ b/code/data/Fonts/fonts.py @@ -8,56 +8,6 @@ 宋体、阴码,逐行式,顺向(高位在前) ''' hanzi_24x24_dict = { - "确": ( - 0x0, 0x3, 0x80, 0x0, 0x3, 0xc0, 0x7f, 0xf7, 0xe4, 0x7f, 0xff, 0xfe, 0x7f, 0xff, 0xfc, 0xe, 0x3e, 0x38, 0xe, - 0x7f, - 0xff, 0xe, 0x3f, 0xff, 0x1f, 0xdf, 0xff, 0x1f, 0xec, 0xe7, 0x3f, 0xec, 0xe7, 0x3c, 0xef, 0xff, 0x7c, 0xef, 0xff, - 0xfc, 0xec, 0xe7, 0x7c, 0xec, 0xe7, 0x7c, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0xfc, 0xe7, - 0x1c, - 0xfc, 0xe7, 0x1c, 0xf8, 0xff, 0x1c, 0xf0, 0xff, 0x0, 0xf0, 0xfe, 0x0, 0x60, 0x8,), - "诊": ( - 0x0, 0x7, 0x80, 0x38, 0x7, 0x80, 0x38, 0xf, 0x80, 0x3c, 0xf, 0xc0, 0x1e, 0x1f, 0xc0, 0x1e, 0x1c, 0xe0, 0xc, - 0x38, - 0xf8, 0x0, 0x78, 0x7e, 0xfc, 0xf3, 0x3f, 0xff, 0xe7, 0x9f, 0xff, 0xcf, 0x86, 0x1d, 0x9e, 0x60, 0x1c, 0x7c, 0xf0, - 0x1c, 0xf9, 0xf0, 0x1c, 0xf3, 0xe0, 0x1c, 0x47, 0xdc, 0x1d, 0x1f, 0x3e, 0x1f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x3c, 0x7c, - 0x7, - 0x78, 0x3f, 0x7, 0xf8, 0x1f, 0x7, 0x70, 0xe, 0x7, 0xa0, 0x0,), "期": ( 0x1e, 0x38, 0x0, 0x1e, 0x3b, 0xff, 0x1c, 0x3b, 0xff, 0x7f, 0xfd, 0xff, 0x7f, 0xfd, 0x87, 0x7f, 0xfd, 0x87, 0xc, 0x39, 0x87, 0xf, 0xf9, 0xff, 0xf, 0xf9, 0xff, 0xc, 0x39, 0xff, 0xc, 0x39, 0x87, 0xf, 0xf9, 0x87, 0xf, 0xfb, diff --git a/code/main.py b/code/main.py index e3dcf2e..fe2ea1a 100644 --- a/code/main.py +++ b/code/main.py @@ -17,7 +17,7 @@ import ntptime from machine import Pin, RTC -from libs import global_var, ap ,color +from libs import global_var, ap, color from libs.urllib import urequest from ui import daily_epidemic # 30天疫情主题 # 导入主题 @@ -55,6 +55,7 @@ # wdt = WDT(timeout=30000) wdt = None + # WIFI连接函数 def WIFI_Connect(): wlan = network.WLAN(network.STA_IF) # STA模式 @@ -128,66 +129,67 @@ def ntp_get(): # 网页获取天气数据 def weather_get(datetime): global weather, lost, total, city - - for i in range(5): # 失败会重试,最多5次 - + a = False + b = False + c = False + myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") + gc.collect() # 内存回收 + for i in range(30): # 失败会重试,最多5 try: - - myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") - text = myURL.read(39000 + 100 * i).decode('utf-8') # 抓取约前4W个字符,节省内存。 + print(int(gc.mem_free() / 8)) + text = myURL.read(7500).decode('utf-8') # 抓取约前4W个字符,节省内存。 # 获取当日天气、高低温 - text1 = re.search('id="hidden_title" value="' + '(.*?)' + '°C', text).group(1) - weather[0] = text1.split()[2] # 当日天气 - weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 - weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 - + info1 = re.search('id="hidden_title" value="(.*?)°C', text) + if info1 != None: + print("获取当日天气、高低温" + info1.group(0)) + text1 = info1.group(1) + if weather[0] == '': + weather[0] = text1.split()[2] # 当日天气 + if weather[1] == '': + weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 + if weather[2] == '': + weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 + a = True # 获取实时天气 - text2 = json.loads(re.search('var hour3data=' + '(.*?)' + '', text).group(1)) - - for i in range(len(text2['1d'])): - if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 - if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 - if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): - weather[3] = text2['1d'][i].split(',')[2] # 实时天气 - else: - weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 - break + info2 = re.search('var hour3data=(.*?)\n', text) + if info2 != None: + gc.collect() # 内存回收 + print("获取实时天气" + info2.group(0)) + text2 = json.loads(info2.group(1)) + for i in range(len(text2['1d'])): + if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 + if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 + if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): + weather[3] = text2['1d'][i].split(',')[2] # 实时天气 + else: + weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 + break + b = True # 获取实时空气质量、风向风力、温湿度 - text3 = json.loads(re.search('var observe24h_data = ' + '(.*?)' + ';', text).group(1)) - - for i in range(len(text3['od']['od2'])): - weather[4] = text3['od']['od2'][i]['od28'] # 空气质量 - if weather[4] != '': - break - - for i in range(len(text3['od']['od2'])): - weather[5] = text3['od']['od2'][i]['od24'] # 实时风向 - if weather[5] != '': - break - - for i in range(len(text3['od']['od2'])): - weather[6] = text3['od']['od2'][i]['od25'] # 实时风力级数 - if weather[6] != '': - break - - for i in range(len(text3['od']['od2'])): - weather[8] = text3['od']['od2'][i]['od27'] # 相对湿度 - if weather[8] != '': - break - - for i in range(len(text3['od']['od2'])): - weather[7] = text3['od']['od2'][i]['od22'] # 温度 - if weather[7] != '': - break + info3 = re.search('var observe24h_data = (.*?);', text) + if info3 != None: + gc.collect() # 内存回收 + print("获取实时空气质量、风向风力、温湿度" + info3.group(0)) + text3 = json.loads(info3.group(1)) + od_data = text3['od']['od2'] + for i in range(len(od_data)): + weather[4] = od_data[i]['od28'] # 空气质量 + weather[5] = od_data[i]['od24'] # 实时风向 + weather[6] = od_data[i]['od25'] # 实时风力级数 + weather[8] = od_data[i]['od27'] # 相对湿度 + weather[7] = od_data[i]['od22'] # 温度 + c = True total = total + 1 + if a and b and c: + return None + else: + raise Exception("没结束") - return None - - except: - + except Exception as e: + print(e) print("Can not get weather!", i) lost = lost + 1 gc.collect() # 内存回收 @@ -272,21 +274,13 @@ def city_get(): else: # 获取字库文件并保存 # 生成城市字模文件 city_font = {} - for i in range(len(city[0])): - f = open('/data/Fonts/fonts_city.py', 'r') - while True: - text = f.readline() - if city[0][i] in text: - while True: - text = text + f.readline() - if ')' in text: a = re.search('[(]' + '(.*?)' + '[)]', text).group(1) \ .replace('\r\n', '') \ @@ -458,6 +452,6 @@ def feedDog(): elif ui_choice == 3: photo_album.UI_Display(datetime) # 相册主图 - # print('gc2:',gc.mem_free()) #内存监测 + # print('gc2:',gc.mem_free()) #内存监测 time.sleep_ms(200) diff --git a/code/t1/main.py b/code/t1/main.py deleted file mode 100644 index 06d6ae4..0000000 --- a/code/t1/main.py +++ /dev/null @@ -1,337 +0,0 @@ -''' -实验名称:pyClock天气时钟-出厂例程 -版本:v1.0 -日期:2022.5 -作者:01Studio -''' - -import gc -# 导入相关模块 -import json -import os -import re -import time - -import machine -import network -import ntptime -from machine import Pin, RTC, WDT - -from libs import global_var, ap -from libs.urllib import urequest -# 导入主题 -from ui import default # 默认经典主题 -from ui import dial # 极简表盘主题 -from ui import photo_album # 相册主题 -from libs.color import * -ui_qty = 3 # UI总数量 -ui_choice = 0 # 初始UI标志位 - -######################## -# 构建1.5寸LCD对象并初始化 -######################## -d = global_var.LCD - -''' -城市信息: -[0]城市,[1]天气编码,[2]身份证编码 -''' -city = ['', '', ''] - -''' -天气信息: -[0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度,[9]昨日确诊新增,[10]昨日无症状新增 -''' -weather = [''] * 11 # 定义一个长度为9的字符列表 - -# 构建RTC时钟对象 -rtc = RTC() - -# 初始化WIFI指示灯 -WIFI_LED = Pin(2, Pin.OUT) - -# WIFI连接函数 -def WIFI_Connect(): - wlan = network.WLAN(network.STA_IF) # STA模式 - wlan.active(True) # 激活接口 - start_time = time.time() # 记录时间做超时判断 - - if not wlan.isconnected(): - - print('Connecting to network...') - - with open('wifi.txt', 'r') as f: # 获取账号密码 - info = json.loads(f.read()) - print(info) - d.fill(BLACK) - d.printStr('Connecting...', 10, 50, RED, size=2) - d.printStr(info['SSID'], 10, 110, WHITE, size=2) - d.printStr('Press KEY 5s RESET!', 5, 180, BLUE, size=2) - wlan.connect(info['SSID'], info['PASSWORD']) # 输入WIFI账号密码 - - while not wlan.isconnected(): - - # LED闪烁提示 - WIFI_LED.value(1) - time.sleep_ms(300) - WIFI_LED.value(0) - time.sleep_ms(300) - - # 超时判断,15秒没连接成功判定为超时 - if time.time() - start_time > 15: - wlan.active(False) - # 点亮LED表示没连接上WiFi - WIFI_LED.value(1) - print('WIFI Connected Timeout!') - return False - - # 连接成功,熄灭LED - WIFI_LED.value(0) - - # 串口打印信息 - print('network information:', wlan.ifconfig()) - - return True - - -# 设置NTP时间偏移量,就是我们所谓的时区,中国在UTC +8 的时区计算方式: 3155673600 - 8*3600 = 3155644800 -# 3155673600 是默认的UTC,以秒计算偏移量。 -ntptime.NTP_DELTA = 3155644800 -ntptime.host = 'ntp1.aliyun.com' - - -# 获取网络时间 -def ntp_get(): - for i in range(10): # 最多尝试获取10次 - - try: - ntptime.settime() # 获取网络时间 - print("ntp time(BeiJing): ", rtc.datetime()) - return True - - except: - print("Can not get time!") - - time.sleep_ms(500) - - - -# 信息打印 -def info_print(): - global city, weather - - print(rtc.datetime()) - - print('城市:', city[0], city[1]) - - print('当日天气:', weather[0]) - print('当日最低温:', weather[1]) - print('当日最高温:', weather[2]) - print('实时天气:', weather[3]) - print('实时空气质量:', weather[4]) - print('实时风向:', weather[5]) - print('实时风力级数:', weather[6]) - print('实时温度:', weather[7]) - print('实时湿度:', weather[8]) - print('昨日确诊新增:', weather[9]) - print('昨日无症状新增:', weather[10]) - - -# 获取城市信息 -def city_get(): - global city - - # 获取城市编码 - with open('wifi.txt', 'r') as f: - info = json.loads(f.read()) - f.close() - - city[0] = info['CITY'] - city[2] = getIdCardCode(city[0]) - - # 获取城市名称 - f = open('/data/CityCode.txt', 'r') - num = 0 - while True: - text = f.readline() - if city[0] in text: - if city[0] == re.match(r'"(.+?)"', text).group(1): # 城市名称完全一样 - city[1] = re.match(r'"(.+?)"', text.split(': ')[1]).group(1) # "获取城市编码" - break - elif '}' in text: # 结束,没这个城市。 - print('No City Name!') - break - - num = num + 1 - - if num == 300: - gc.collect() # 内存回收 - num = 0 - - f.close() - city_node = 0 - - # city.txt文件存在,判断文件是否已经有当前城市字库 - if 'city.txt' in os.listdir('/data/'): - f = open('/data/city.txt', 'r') - city_text = f.read() - for i in range(len(city[0])): - - if city[0][i] in city_text: - - if i == len(city[0]) - 1: # 全部字体都有 - - city_node = 1 # 标记字符信息正常 - f.close() - - # 城市字库正常,无需制作 - if city_node == 1: - pass - - else: # 获取字库文件并保存 - # 生成城市字模文件 - city_font = {} - - for i in range(len(city[0])): - - f = open('/data/Fonts/fonts_city.py', 'r') - - while True: - - text = f.readline() - - if city[0][i] in text: - - while True: - - text = text + f.readline() - - if ')' in text: - a = re.search('[(]' + '(.*?)' + '[)]', text).group(1) \ - .replace('\r\n', '') \ - .replace(' ', '').split(',') - - for j in range(len(a)): - a[j] = int(a[j]) - - city_font[city[0][i]] = a - break - break - - if not text: # 读完 - print("No City Fonts.") - break - - f.close() - - f = open('/data/city.txt', 'w') # 以写的方式打开一个文件,没有该文件就自动新建 - f.write((json.dumps(city_font))) # 写入数据 - f.close() # 每次操作完记得关闭文件 - - gc.collect() # 内存回收 - - -# 按键 -KEY = Pin(9, Pin.IN, Pin.PULL_UP) # 构建KEY对象 - - -# 按键中断触发 -def key(KEY): - global ui_choice, ui_qty - time.sleep_ms(10) # 消除抖动 - if KEY.value() == 0: # 确认按键被按下 - - # 短按切换UI - global_var.UI_Change = 1 - ui_choice = ui_choice + 1 - if ui_choice == ui_qty: # UI数量 - ui_choice = 0 - - # 出厂模式 - start = time.ticks_ms() - while KEY.value() == 0: - - if time.ticks_ms() - start > 5000: # 长按按键5秒 - - WIFI_LED.value(1) # 指示灯亮 - print("Factory Mode!") - try: - os.remove('wifi.txt') - print('Remove wifi.txt') - except: - print('no wifi.txt') - - machine.reset() # 重启开发板。 - - -KEY.irq(key, Pin.IRQ_FALLING) # 定义中断,下降沿触发 - - -def getIdCardCode(cityName: str): - city = None - with open('/data/IdCard.txt', 'r') as f: - while True: - text = f.readline() - if cityName in text: - city = re.match(r'"(.+?)"', text.split(':')[1]).group(1) # "获取城市编码" - break - elif '}' in text: # 结束,没这个城市。 - print('No City Name!') - break - return city - -################ -# 主程序 # -################ -if __name__ == '__main__': - # 没有WiFi配置文件,出厂模式 - while 'wifi.txt' not in os.listdir(): - ap.startAP() # 启动AP配网模式 - - # 启动看门狗,超时30秒。 - wdt = WDT(timeout=30000) - - # 连接WiFi - while not WIFI_Connect(): # 等待wifi连接 - pass - - wdt.feed() # 喂狗 - - # 获取城市名称和编码 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('City Data', 10, 120, WHITE, size=3) - city_get() - - # 同步网络时钟 - d.fill(BLACK) - d.printStr('Getting...', 10, 60, RED, size=3) - d.printStr('Date & Time', 10, 120, WHITE, size=3) - ntp_get() - - # 信息打印 - info_print() - - tick = 61 # 每秒刷新标志位 - - while True: - - # 获取时间 - datetime = rtc.datetime() - - # 30分钟在线获取一次天气信息,顺便检测wifi是否掉线 - if datetime[5] % 30 == 0 and datetime[6] == 0: - WIFI_Connect() # 检查WiFi,掉线的话自动重连 - info_print() # 打印相关信息 - - # 每秒刷新一次UI - if tick != datetime[6]: - - tick = datetime[6] - - wdt.feed() # 喂狗 - - if ui_choice == 0: - pass - - time.sleep_ms(200) diff --git a/code/t1/t5.py b/code/t1/t5.py new file mode 100644 index 0000000..f5129ac --- /dev/null +++ b/code/t1/t5.py @@ -0,0 +1,136 @@ +import json +import re +import traceback + +import requests + + +# adcode: "440100" +# city: "广州" +# 全省确诊 confirm: 19392 +# 全省确诊新增 confirm_add: "1129" +# date: "11.27" +# 死亡 dead: 0 +# 治愈 heal: 0 +# is_show_wzz_add: 1 +# suspect: 0 +# 本日新增 today_confirm_add: 0 +# 本日无症状新增 today_wzz_add: 0 +# y: "2022" +# 昨日确诊新增 yes_confirm_add: 1129 +# 昨日无症状新增 yes_wzz_add: 7166 + + +def getDailyEpidemicData(adCode: str = '440100'): + url = "https://api.inews.qq.com/newsqa/v1/query/pubished/daily/list" + data = {'adCode': adCode, 'limit': '30'} + r = requests.get(url, params=data) # 发get请求 + print(len(r.text)) + print(r.json()) # 将返回的json串转为字典 + info = json.loads(r.text) + if info['ret'] == 0: + return info['data'] + else: + return None + + +''' +天气信息: +[0]当日天气,[1]当日最高温,[2]当日最低温,[3]实时天气,[4]实时空气质量,[5]实时风向,[6]实时风力级数,[7]实时温度,[8]实时湿度,[9]昨日确诊新增,[10]昨日无症状新增 +''' +weather = [''] * 11 +# 记录天气爬虫次数,用于调试 +total = 0 +lost = 0 +''' +城市信息: +[0]城市,[1]天气编码,[2]身份证编码 +''' +city = ['广州', '101280101', '440100'] + + +def weather_get(datetime): + global weather, lost, total, city + + for i in range(5): # 失败会重试,最多5次 + + try: + + myURL = requests.get("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") + myURL.encoding = 'utf-8' + text = myURL.text # 抓取约前4W个字符,节省内存。 + # 获取当日天气、高低温 + text1 = re.search('id="hidden_title" value="' + '(.*?)' + '°C', text).group(1) + weather[0] = text1.split()[2] # 当日天气 + weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 + weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 + + # 获取实时天气 + text2 = json.loads(re.search('var hour3data=(.+)\n', text).group(1)) + for i in range(len(text2['1d'])): + if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 + if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 + if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): + weather[3] = text2['1d'][i].split(',')[2] # 实时天气 + else: + weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 + break + + # 获取实时空气质量、风向风力、温湿度 + text3 = json.loads(re.search('var\sobserve24h_data\s=\s' + '(.*?)' + ';', text).group(1)) + for i in range(len(text3['od']['od2'])): + weather[4] = text3['od']['od2'][i]['od28'] # 空气质量 + if weather[4] != '': + break + + for i in range(len(text3['od']['od2'])): + weather[5] = text3['od']['od2'][i]['od24'] # 实时风向 + if weather[5] != '': + break + + for i in range(len(text3['od']['od2'])): + weather[6] = text3['od']['od2'][i]['od25'] # 实时风力级数 + if weather[6] != '': + break + + for i in range(len(text3['od']['od2'])): + weather[8] = text3['od']['od2'][i]['od27'] # 相对湿度 + if weather[8] != '': + break + + for i in range(len(text3['od']['od2'])): + weather[7] = text3['od']['od2'][i]['od22'] # 温度 + if weather[7] != '': + break + + total = total + 1 + return None + except: + traceback.print_exc() + print("Can not get weather!", i) + lost = lost + 1 + + +def info_print(): + global city, weather + + print('城市:', city[0], city[1]) + + print('当日天气:', weather[0]) + print('当日最低温:', weather[1]) + print('当日最高温:', weather[2]) + print('实时天气:', weather[3]) + print('实时空气质量:', weather[4]) + print('实时风向:', weather[5]) + print('实时风力级数:', weather[6]) + print('实时温度:', weather[7]) + print('实时湿度:', weather[8]) + print('昨日确诊新增:', weather[9]) + print('昨日无症状新增:', weather[10]) + print('total:', total) + print('lost:', lost) + + +if __name__ == '__main__': + data = weather_get((2022, 12, 5, 0, 10, 40, 9, 239427)) + info_print() diff --git a/code/ui/daily_epidemic.py b/code/ui/daily_epidemic.py index 67928eb..a5680a2 100644 --- a/code/ui/daily_epidemic.py +++ b/code/ui/daily_epidemic.py @@ -22,8 +22,7 @@ d = global_var.LCD # 数据限制 -limit = 30 - +limit = 15 class HeightCalculator(): def __init__(self): @@ -73,6 +72,7 @@ def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): text = r.read(7000).decode('utf-8') # 抓取约前4W个字符,节省内存。 info = json.loads(text) if info['ret'] == 0: + gc.collect() return info['data'] else: return None @@ -80,11 +80,11 @@ def getDailyEpidemicData(adCode: str = '440100', limit: int = 30): # 用于显示动画 second2 = 61 +heightCalculator = HeightCalculator() def message_display(second): - global data - heightCalculator = HeightCalculator() + global data, heightCalculator if data != None: d.fill(BLACK) # 清屏 printTitle() From f6c52c870d1cee6588d4341805053468424515c9 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 13:08:40 +0800 Subject: [PATCH 10/13] =?UTF-8?q?refctor:=20=E8=B0=83=E6=95=B4=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/main.py | 127 ++++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/code/main.py b/code/main.py index fe2ea1a..ea37bbf 100644 --- a/code/main.py +++ b/code/main.py @@ -129,70 +129,71 @@ def ntp_get(): # 网页获取天气数据 def weather_get(datetime): global weather, lost, total, city - a = False - b = False - c = False - myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") - gc.collect() # 内存回收 - for i in range(30): # 失败会重试,最多5 - try: - print(int(gc.mem_free() / 8)) - text = myURL.read(7500).decode('utf-8') # 抓取约前4W个字符,节省内存。 - - # 获取当日天气、高低温 - info1 = re.search('id="hidden_title" value="(.*?)°C', text) - if info1 != None: - print("获取当日天气、高低温" + info1.group(0)) - text1 = info1.group(1) - if weather[0] == '': - weather[0] = text1.split()[2] # 当日天气 - if weather[1] == '': - weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 - if weather[2] == '': - weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 - a = True - # 获取实时天气 - info2 = re.search('var hour3data=(.*?)\n', text) - if info2 != None: - gc.collect() # 内存回收 - print("获取实时天气" + info2.group(0)) - text2 = json.loads(info2.group(1)) - for i in range(len(text2['1d'])): - if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 - if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 - if i == 0 or datetime[4] == int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): - weather[3] = text2['1d'][i].split(',')[2] # 实时天气 - else: - weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 - break - b = True - - # 获取实时空气质量、风向风力、温湿度 - info3 = re.search('var observe24h_data = (.*?);', text) - if info3 != None: + for tryCount in range(5): # 失败会重试,最多5 + a = False + b = False + c = False + myURL = urequest.urlopen("http://www.weather.com.cn/weather1d/" + city[1] + ".shtml") + gc.collect() # 内存回收 + for i in range(30): # 假设有30段数据 + try: + text = myURL.read(7500).decode('utf-8') # 抓取约前4W个字符,节省内存。 + + # 获取当日天气、高低温 + info1 = re.search('id="hidden_title" value="(.*?)°C', text) + if info1 != None: + print("获取当日天气、高低温" + info1.group(0)) + text1 = info1.group(1) + if weather[0] == '': + weather[0] = text1.split()[2] # 当日天气 + if weather[1] == '': + weather[1] = str(min(list(map(int, text1.split()[3].split('/'))))) # 当天最低温 + if weather[2] == '': + weather[2] = str(max(list(map(int, text1.split()[3].split('/'))))) # 当天最高温 + a = True + # 获取实时天气 + info2 = re.search('var hour3data=(.*?)\n', text) + if info2 != None: + gc.collect() # 内存回收 + print("获取实时天气" + info2.group(0)) + text2 = json.loads(info2.group(1)) + for i in range(len(text2['1d'])): + if int(text2['1d'][i].split(',')[0].split('日')[0]) == datetime[2]: # 日期相同 + if datetime[4] <= int(text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): # 小时 + if i == 0 or datetime[4] == int( + text2['1d'][i].split(',')[0].split('日')[1].split('时')[0]): + weather[3] = text2['1d'][i].split(',')[2] # 实时天气 + else: + weather[3] = text2['1d'][i - 1].split(',')[2] # 实时天气 + break + b = True + + # 获取实时空气质量、风向风力、温湿度 + info3 = re.search('var observe24h_data = (.*?);', text) + if info3 != None: + gc.collect() # 内存回收 + print("获取实时空气质量、风向风力、温湿度" + info3.group(0)) + text3 = json.loads(info3.group(1)) + od_data = text3['od']['od2'] + for i in range(len(od_data)): + weather[4] = od_data[i]['od28'] # 空气质量 + weather[5] = od_data[i]['od24'] # 实时风向 + weather[6] = od_data[i]['od25'] # 实时风力级数 + weather[8] = od_data[i]['od27'] # 相对湿度 + weather[7] = od_data[i]['od22'] # 温度 + c = True + + total = total + 1 + if a and b and c: + return None + else: + raise Exception("没结束") + + except Exception as e: + print(e) + print("Can not get weather!", i) + lost = lost + 1 gc.collect() # 内存回收 - print("获取实时空气质量、风向风力、温湿度" + info3.group(0)) - text3 = json.loads(info3.group(1)) - od_data = text3['od']['od2'] - for i in range(len(od_data)): - weather[4] = od_data[i]['od28'] # 空气质量 - weather[5] = od_data[i]['od24'] # 实时风向 - weather[6] = od_data[i]['od25'] # 实时风力级数 - weather[8] = od_data[i]['od27'] # 相对湿度 - weather[7] = od_data[i]['od22'] # 温度 - c = True - - total = total + 1 - if a and b and c: - return None - else: - raise Exception("没结束") - - except Exception as e: - print(e) - print("Can not get weather!", i) - lost = lost + 1 - gc.collect() # 内存回收 time.sleep_ms(1000) From 7448b2d13c83dd8c15d5f394086f497ce132873c Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 13:09:44 +0800 Subject: [PATCH 11/13] =?UTF-8?q?refctor:=20=E8=B0=83=E6=95=B4=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/main.py b/code/main.py index ea37bbf..20caba0 100644 --- a/code/main.py +++ b/code/main.py @@ -187,10 +187,10 @@ def weather_get(datetime): if a and b and c: return None else: - raise Exception("没结束") + continue except Exception as e: - print(e) + print(type(e), ":", e) print("Can not get weather!", i) lost = lost + 1 gc.collect() # 内存回收 From 9fb9b0b25ca5d2ef7993a9e2eed5a817780c1ebe Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 13:14:58 +0800 Subject: [PATCH 12/13] =?UTF-8?q?docs:=20v1.9=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/README.md b/code/README.md index e06140f..0397eab 100644 --- a/code/README.md +++ b/code/README.md @@ -33,6 +33,10 @@ ui:UI主题库 http://www.jiqie.com/5/m1.htm ## 版本说明 +2022-12-5 v1.9 +1、增加一个疫情新增数据滚动屏幕。 +2、增加最新疫情新增到时间主题。 +3、修复天气爬虫爆内存的问题 2022-11-1 v1.8 1、修复实时温度显示重影问题; From e4269c2cf9117aeb24cd9f45b182878fd0d49079 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Mon, 5 Dec 2022 13:34:44 +0800 Subject: [PATCH 13/13] =?UTF-8?q?refactor:=20=E6=81=A2=E5=A4=8D=E7=9C=8B?= =?UTF-8?q?=E9=97=A8=E7=8B=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/main.py b/code/main.py index 20caba0..ee711f6 100644 --- a/code/main.py +++ b/code/main.py @@ -15,7 +15,7 @@ import machine import network import ntptime -from machine import Pin, RTC +from machine import Pin, RTC, WDT from libs import global_var, ap, color from libs.urllib import urequest @@ -52,8 +52,8 @@ WIFI_LED = Pin(2, Pin.OUT) # 启动看门狗,超时30秒。 -# wdt = WDT(timeout=30000) -wdt = None +wdt = WDT(timeout=30000) +# wdt = None # WIFI连接函数