fix problems in weather app #42

This commit is contained in:
sharandac
2020-08-21 14:18:29 +02:00
parent b87b342322
commit 72e24a6062
6 changed files with 11 additions and 11 deletions

View File

@@ -70,6 +70,6 @@ const void * resolve_owm_icon( char *iconname ) {
return( owm_icon[ icon ].icon );
}
}
return( NULL );
return( &owm_01d_64px );
}

View File

@@ -113,15 +113,15 @@ int weather_fetch_forecast( weather_config_t *weather_config, weather_forcast_t
weather_forecast[0].valide = true;
for ( int i = 0 ; i < WEATHER_MAX_FORECAST ; i++ ) {
weather_forecast[ i ].timestamp = doc["list"][i]["dt"].as<long>();
weather_forecast[ i ].timestamp = doc["list"][i]["dt"].as<long>() | 0;
snprintf( weather_forecast[ i ].temp, sizeof( weather_forecast[ i ].temp ),"%0.1f°%s", doc["list"][i]["main"]["temp"].as<float>(), weather_units_symbol );
snprintf( weather_forecast[ i ].humidity, sizeof( weather_forecast[ i ].humidity ),"%f%%", doc["list"][i]["main"]["humidity"].as<float>() );
snprintf( weather_forecast[ i ].pressure, sizeof( weather_forecast[ i ].pressure ),"%fpha", doc["list"][i]["main"]["pressure"].as<float>() );
strlcpy( weather_forecast[ i ].icon, doc["list"][i]["weather"][0]["icon"], sizeof( weather_forecast[ i ].icon ) );
strlcpy( weather_forecast[ i ].name, doc["city"]["name"], sizeof( weather_forecast[ i ].name ) );
strlcpy( weather_forecast[ i ].icon, doc["list"][i]["weather"][0]["icon"] | "n/a", sizeof( weather_forecast[ i ].icon ) );
strlcpy( weather_forecast[ i ].name, doc["city"]["name"] | "n/a", sizeof( weather_forecast[ i ].name ) );
int directionDegree = doc["list"][i]["wind"]["deg"].as<int>();
int speed = doc["list"][i]["wind"]["speed"].as<int>();
int directionDegree = doc["list"][i]["wind"]["deg"].as<int>() | 0;
int speed = doc["list"][i]["wind"]["speed"].as<int>() | 0;
weather_wind_to_string( &weather_forecast[i], speed, directionDegree );
}

View File

@@ -280,9 +280,9 @@ void bluetooth_message_msg_pharse( char* msg ) {
if ( !strcmp( doc["app"], "weather" ) ) {
weather_config_t *weather_config = weather_get_config();
strlcpy( weather_config->apikey, doc["apikey"], sizeof( weather_config->apikey ) );
strlcpy( weather_config->lat, doc["lat"], sizeof( weather_config->lat ) );
strlcpy( weather_config->lon, doc["lon"], sizeof( weather_config->lon ) );
strlcpy( weather_config->apikey, doc["apikey"] |"", sizeof( weather_config->apikey ) );
strlcpy( weather_config->lat, doc["lat"] | "", sizeof( weather_config->lat ) );
strlcpy( weather_config->lon, doc["lon"] | "", sizeof( weather_config->lon ) );
weather_save_config();
motor_vibe(100);
}

View File

@@ -32,6 +32,6 @@
/*
* firmeware version string
*/
#define __FIRMWARE__ "2020082106"
#define __FIRMWARE__ "2020082107"
#endif // _CONFIG_H

Binary file not shown.

View File

@@ -1 +1 @@
{"version":"2020082106","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
{"version":"2020082107","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}