diff --git a/src/app/weather/weather_fetch.cpp b/src/app/weather/weather_fetch.cpp index 58f9a6d..da312d1 100644 --- a/src/app/weather/weather_fetch.cpp +++ b/src/app/weather/weather_fetch.cpp @@ -31,11 +31,24 @@ // arduinoJson allocator for external PSRAM // see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/ -struct SpiRamAllocator { - void* allocate( size_t size ) { return ps_calloc( size, 1 ); } - void deallocate( void* pointer ) { free( pointer ); } +struct WeatherSpiRamAllocator { + void* allocate( size_t size ) { + void *psram = ps_calloc( size, 1 ); + if ( psram ) { + log_i("allocate %dbytes(%p) json psram", size, psram ); + return( psram ); + } + else { + log_e("allocate %dbytes(%p) json psram failed", size, psram ); + while(1); + } + } + void deallocate( void* pointer ) { + log_i("deallocate (%p) json psram", pointer ); + free( pointer ); + } }; -using SpiRamJsonDocument = BasicJsonDocument; +using WeatherSpiRamJsonDocument = BasicJsonDocument; /* Utility function to convert numbers to directions */ static void weather_wind_to_string( weather_forcast_t* container, int speed, int directionDegree); @@ -58,7 +71,7 @@ int weather_fetch_today( weather_config_t *weather_config, weather_forcast_t *we return( -1 ); } - SpiRamJsonDocument doc( today_client.getSize() * 2 ); + WeatherSpiRamJsonDocument doc( today_client.getSize() * 2 ); DeserializationError error = deserializeJson( doc, today_client.getStream() ); if (error) { @@ -103,7 +116,7 @@ int weather_fetch_forecast( weather_config_t *weather_config, weather_forcast_t return( -1 ); } - SpiRamJsonDocument doc( forecast_client.getSize() * 2 ); + WeatherSpiRamJsonDocument doc( forecast_client.getSize() * 2 ); DeserializationError error = deserializeJson( doc, forecast_client.getStream() ); if (error) { diff --git a/src/app/weather/weather_forecast.cpp b/src/app/weather/weather_forecast.cpp index ce1e090..0397e5e 100644 --- a/src/app/weather/weather_forecast.cpp +++ b/src/app/weather/weather_forecast.cpp @@ -135,7 +135,9 @@ void weather_forecast_tile_setup( uint32_t tile_num ) { // regster callback for wifi sync WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) { - weather_forecast_sync_request(); + weather_config_t *weather_config = weather_get_config(); + if ( weather_config->autosync ) + weather_forecast_sync_request(); }, WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP ); weather_forecast_event_handle = xEventGroupCreate(); diff --git a/src/config.h b/src/config.h index 8426055..57e2de8 100644 --- a/src/config.h +++ b/src/config.h @@ -32,6 +32,6 @@ /* * firmeware version string */ - #define __FIRMWARE__ "2020081101" + #define __FIRMWARE__ "2020081102" #endif // _CONFIG_H diff --git a/src/gui/mainbar/setup_tile/update/update_check_version.cpp b/src/gui/mainbar/setup_tile/update/update_check_version.cpp index 8dd0485..aca3a68 100644 --- a/src/gui/mainbar/setup_tile/update/update_check_version.cpp +++ b/src/gui/mainbar/setup_tile/update/update_check_version.cpp @@ -27,11 +27,24 @@ // arduinoJson allocator for external PSRAM // see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/ -struct SpiRamAllocator { - void* allocate( size_t size ) { return ps_calloc( size, 1 ); } - void deallocate( void* pointer ) { free( pointer ); } +struct UpdateSpiRamAllocator { + void* allocate( size_t size ) { + void *psram = ps_calloc( size, 1 ); + if ( psram ) { + log_i("allocate %dbytes(%p) json psram", size, psram ); + return( psram ); + } + else { + log_e("allocate %dbytes(%p) json psram failed", size, psram ); + while(1); + } + } + void deallocate( void* pointer ) { + log_i("deallocate (%p) json psram", pointer ); + free( pointer ); + } }; -using SpiRamJsonDocument = BasicJsonDocument; +using SpiRamJsonDocument = BasicJsonDocument; uint64_t update_check_new_version( void ) { char url[512]=""; diff --git a/ttgo-t-watch2020_v1.ino.bin b/ttgo-t-watch2020_v1.ino.bin index 582961b..c4b4ae1 100644 Binary files a/ttgo-t-watch2020_v1.ino.bin and b/ttgo-t-watch2020_v1.ino.bin differ diff --git a/ttgo-t-watch2020_v1.version.json b/ttgo-t-watch2020_v1.version.json index 5d248df..4ea9328 100644 --- a/ttgo-t-watch2020_v1.version.json +++ b/ttgo-t-watch2020_v1.version.json @@ -1 +1 @@ -{"version":"2020081101","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"} +{"version":"2020081102","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}