add debuginfo for json memory allocation
This commit is contained in:
@@ -31,11 +31,24 @@
|
|||||||
|
|
||||||
// arduinoJson allocator for external PSRAM
|
// arduinoJson allocator for external PSRAM
|
||||||
// see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/
|
// see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/
|
||||||
struct SpiRamAllocator {
|
struct WeatherSpiRamAllocator {
|
||||||
void* allocate( size_t size ) { return ps_calloc( size, 1 ); }
|
void* allocate( size_t size ) {
|
||||||
void deallocate( void* pointer ) { free( pointer ); }
|
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<SpiRamAllocator>;
|
using WeatherSpiRamJsonDocument = BasicJsonDocument<WeatherSpiRamAllocator>;
|
||||||
|
|
||||||
/* Utility function to convert numbers to directions */
|
/* Utility function to convert numbers to directions */
|
||||||
static void weather_wind_to_string( weather_forcast_t* container, int speed, int directionDegree);
|
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 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
SpiRamJsonDocument doc( today_client.getSize() * 2 );
|
WeatherSpiRamJsonDocument doc( today_client.getSize() * 2 );
|
||||||
|
|
||||||
DeserializationError error = deserializeJson( doc, today_client.getStream() );
|
DeserializationError error = deserializeJson( doc, today_client.getStream() );
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -103,7 +116,7 @@ int weather_fetch_forecast( weather_config_t *weather_config, weather_forcast_t
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
SpiRamJsonDocument doc( forecast_client.getSize() * 2 );
|
WeatherSpiRamJsonDocument doc( forecast_client.getSize() * 2 );
|
||||||
|
|
||||||
DeserializationError error = deserializeJson( doc, forecast_client.getStream() );
|
DeserializationError error = deserializeJson( doc, forecast_client.getStream() );
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ void weather_forecast_tile_setup( uint32_t tile_num ) {
|
|||||||
|
|
||||||
// regster callback for wifi sync
|
// regster callback for wifi sync
|
||||||
WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) {
|
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 );
|
}, WiFiEvent_t::SYSTEM_EVENT_STA_GOT_IP );
|
||||||
|
|
||||||
weather_forecast_event_handle = xEventGroupCreate();
|
weather_forecast_event_handle = xEventGroupCreate();
|
||||||
|
|||||||
@@ -32,6 +32,6 @@
|
|||||||
/*
|
/*
|
||||||
* firmeware version string
|
* firmeware version string
|
||||||
*/
|
*/
|
||||||
#define __FIRMWARE__ "2020081101"
|
#define __FIRMWARE__ "2020081102"
|
||||||
|
|
||||||
#endif // _CONFIG_H
|
#endif // _CONFIG_H
|
||||||
|
|||||||
@@ -27,11 +27,24 @@
|
|||||||
|
|
||||||
// arduinoJson allocator for external PSRAM
|
// arduinoJson allocator for external PSRAM
|
||||||
// see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/
|
// see: https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/
|
||||||
struct SpiRamAllocator {
|
struct UpdateSpiRamAllocator {
|
||||||
void* allocate( size_t size ) { return ps_calloc( size, 1 ); }
|
void* allocate( size_t size ) {
|
||||||
void deallocate( void* pointer ) { free( pointer ); }
|
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<SpiRamAllocator>;
|
using SpiRamJsonDocument = BasicJsonDocument<UpdateSpiRamAllocator>;
|
||||||
|
|
||||||
uint64_t update_check_new_version( void ) {
|
uint64_t update_check_new_version( void ) {
|
||||||
char url[512]="";
|
char url[512]="";
|
||||||
|
|||||||
Binary file not shown.
@@ -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"}
|
||||||
|
|||||||
Reference in New Issue
Block a user