Display the weather forecast on M5Stack. Get the weather forecast from https://www.metaweather.com/api/ No registration is required. You can use this application immediately.
M5Stack
git clone https://github.com/nopnop2002/esp-idf-world-weather
cd esp-idf-world-weather
chmod 777 getpem.sh
./getpem.sh
idf.py set-target esp32
idf.py menuconfig
idf.py flash monitor
You have to set this config value using menuconfig.
How to use location search: https://www.metaweather.com/api/#locationsearch.
Cities containing 'san': https://www.metaweather.com/api/location/search/?query=san
[
{
"woeid": 2487956,
"latt_long": "37.777119, -122.41964",
"location_type": "City",
"title": "San Francisco"
},
{
"woeid": 2487889,
"latt_long": "32.715691,-117.161720",
"location_type": "City",
"title": "San Diego"
},
{
"woeid": 2488042,
"latt_long": "37.338581,-121.885567",
"location_type": "City",
"title": "San Jose"
},
{
"woeid": 2487796,
"latt_long": "29.424580,-98.494614",
"location_type": "City",
"title": "San Antonio"
},
{
"woeid": 2488853,
"latt_long": "36.974018,-122.030952",
"location_type": "City",
"title": "Santa Cruz"
},
{
"woeid": 349859,
"latt_long": "-33.463039,-70.647942",
"location_type": "City",
"title": "Santiago"
},
{
"woeid": 56558361,
"latt_long": "36.406651,25.456530",
"location_type": "City",
"title": "Santorini"
},
{
"woeid": 773964,
"latt_long": "43.461498,-3.810010",
"location_type": "City",
"title": "Santander"
},
{
"woeid": 1132447,
"latt_long": "35.170429,128.999481",
"location_type": "City",
"title": "Busan"
},
{
"woeid": 773692,
"latt_long": "28.46163,-16.267059",
"location_type": "City",
"title": "Santa Cruz de Tenerife"
},
{
"woeid": 2488867,
"latt_long": "35.666431,-105.972572",
"location_type": "City",
"title": "Santa Fe"
}
]
Cities containing 'kyo': https://www.metaweather.com/api/location/search/?query=kyo
[
{
"woeid": 1118370,
"latt_long": "35.670479,139.740921",
"location_type": "City",
"title": "Tokyo"
},
{
"woeid": 15015372,
"latt_long": "35.098129,135.718933",
"location_type": "City",
"title": "Kyoto"
}
]
WOEID of TOKYO is 1118370. You can know the weather forecast of TOKYO. https://www.metaweather.com/api/location/1118370/
You can use test.py for confirmation.
Initial screen. Press Left button briefly. Left:Gothic font. Right:Mincyo font.
Press Middle button briefly.
Press Right button briefly.
Press and hold Left button.
I downloaded the image file from here.
wget https://www.metaweather.com/static/img/weather/png/sn.png
wget https://www.metaweather.com/static/img/weather/png/sl.png
wget https://www.metaweather.com/static/img/weather/png/h.png
wget https://www.metaweather.com/static/img/weather/png/t.png
wget https://www.metaweather.com/static/img/weather/png/hr.png
wget https://www.metaweather.com/static/img/weather/png/lr.png
wget https://www.metaweather.com/static/img/weather/png/s.png
wget https://www.metaweather.com/static/img/weather/png/hc.png
wget https://www.metaweather.com/static/img/weather/png/lc.png
wget https://www.metaweather.com/static/img/weather/png/c.png
Press and hold Middle button.
Press and hold Right button.
You can add your original fonts. The format of the font file is the FONTX format. Your font file is put in font directory. Your font file is uploaded to SPIFFS partition using meke flash.
Please refer this page about FONTX format.
FontxFile yourFont[2];
InitFontx(yourFont,"/spiffs/your_font_file_name","");
uint8_t ascii[10];
strcpy((char *)ascii, "MyFont");
uint16_t color = RED;
lcdDrawString(&dev, yourFont, x, y, ascii, color);
There is a font file editor. This can be done on Windows 10. Developer page is here.
This library uses the following as default fonts:
Changing this file will change the font.