change debug msg
This commit is contained in:
@@ -40,7 +40,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_
|
|||||||
uint32_t retval = -1;
|
uint32_t retval = -1;
|
||||||
|
|
||||||
if ( !today_client.connect( OWM_HOST, OWM_PORT ) ) {
|
if ( !today_client.connect( OWM_HOST, OWM_PORT ) ) {
|
||||||
Serial.printf( __FILE__ "connection failed\r\n");
|
log_e("connection failed");
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_
|
|||||||
uint64_t startMillis = millis();
|
uint64_t startMillis = millis();
|
||||||
while ( today_client.available() == 0 ) {
|
while ( today_client.available() == 0 ) {
|
||||||
if ( millis() - startMillis > 5000 ) {
|
if ( millis() - startMillis > 5000 ) {
|
||||||
Serial.printf( __FILE__ "connection timeout\r\n");
|
log_e("connection timeout");
|
||||||
today_client.stop();
|
today_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_
|
|||||||
|
|
||||||
char *json = (char *)ps_malloc( WEATHER_TODAY_BUFFER_SIZE );
|
char *json = (char *)ps_malloc( WEATHER_TODAY_BUFFER_SIZE );
|
||||||
if ( json == NULL ) {
|
if ( json == NULL ) {
|
||||||
Serial.printf( __FILE__ "memory alloc failed\r\n");
|
log_e("memory alloc failed");
|
||||||
today_client.stop();
|
today_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -93,8 +93,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_
|
|||||||
|
|
||||||
DeserializationError error = deserializeJson( doc, json);
|
DeserializationError error = deserializeJson( doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
Serial.print(F( __FILE__ "weather today deserializeJson() failed: "));
|
log_e("weather today deserializeJson() failed: %s", error.c_str() );
|
||||||
Serial.println(error.c_str());
|
|
||||||
doc.clear();
|
doc.clear();
|
||||||
free( json );
|
free( json );
|
||||||
return( retval );
|
return( retval );
|
||||||
@@ -103,7 +102,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_
|
|||||||
retval = doc["cod"].as<int>();
|
retval = doc["cod"].as<int>();
|
||||||
|
|
||||||
if ( retval != 200 ) {
|
if ( retval != 200 ) {
|
||||||
Serial.printf( __FILE__ "get weather failed, returncode: %d\r\n", retval );
|
log_e("get weather failed, returncode: %d", retval );
|
||||||
doc.clear();
|
doc.clear();
|
||||||
free( json );
|
free( json );
|
||||||
return( retval );
|
return( retval );
|
||||||
@@ -131,7 +130,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca
|
|||||||
uint32_t retval = -1;
|
uint32_t retval = -1;
|
||||||
|
|
||||||
if ( !forecast_client.connect( OWM_HOST, OWM_PORT ) ) {
|
if ( !forecast_client.connect( OWM_HOST, OWM_PORT ) ) {
|
||||||
Serial.printf( __FILE__ "connection failed\r\n");
|
log_e("connection failed");
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +145,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca
|
|||||||
uint64_t startMillis = millis();
|
uint64_t startMillis = millis();
|
||||||
while ( forecast_client.available() == 0 ) {
|
while ( forecast_client.available() == 0 ) {
|
||||||
if ( millis() - startMillis > 5000 ) {
|
if ( millis() - startMillis > 5000 ) {
|
||||||
Serial.printf( __FILE__ "connection timeout\r\n");
|
log_e("connection timeout");
|
||||||
forecast_client.stop();
|
forecast_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -154,7 +153,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca
|
|||||||
|
|
||||||
char *json = (char *)ps_malloc( WEATHER_FORECAST_BUFFER_SIZE );
|
char *json = (char *)ps_malloc( WEATHER_FORECAST_BUFFER_SIZE );
|
||||||
if ( json == NULL ) {
|
if ( json == NULL ) {
|
||||||
Serial.printf( __FILE__ "memory alloc failed\r\n");
|
log_e("memory alloc failed");
|
||||||
forecast_client.stop();
|
forecast_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -182,8 +181,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca
|
|||||||
DynamicJsonDocument doc(20000);
|
DynamicJsonDocument doc(20000);
|
||||||
DeserializationError error = deserializeJson( doc, json );
|
DeserializationError error = deserializeJson( doc, json );
|
||||||
if (error) {
|
if (error) {
|
||||||
Serial.print(F( __FILE__ "weather forecast deserializeJson() failed: "));
|
log_e("weather forecast deserializeJson() failed: %s", error.c_str() );
|
||||||
Serial.println(error.c_str());
|
|
||||||
doc.clear();
|
doc.clear();
|
||||||
free( json );
|
free( json );
|
||||||
return( retval );
|
return( retval );
|
||||||
@@ -192,7 +190,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca
|
|||||||
retval = doc["cod"].as<int>();
|
retval = doc["cod"].as<int>();
|
||||||
|
|
||||||
if ( retval != 200 ) {
|
if ( retval != 200 ) {
|
||||||
Serial.printf( __FILE__ "get weather forecast failed, returncode: %d\r\n", retval );
|
log_e("get weather forecast failed, returncode: %d", retval );
|
||||||
doc.clear();
|
doc.clear();
|
||||||
free( json );
|
free( json );
|
||||||
return( retval );
|
return( retval );
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ void weather_setup_tile_setup( lv_obj_t *tile, lv_style_t *style, lv_coord_t hre
|
|||||||
lv_switch_on( weather_wind_onoff, LV_ANIM_OFF );
|
lv_switch_on( weather_wind_onoff, LV_ANIM_OFF );
|
||||||
else
|
else
|
||||||
lv_switch_off( weather_wind_onoff, LV_ANIM_OFF );
|
lv_switch_off( weather_wind_onoff, LV_ANIM_OFF );
|
||||||
log_e("Display wind currently set to %d", weather_config->showWind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void weather_textarea_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
static void weather_textarea_event_cb( lv_obj_t * obj, lv_event_t event ) {
|
||||||
|
|||||||
@@ -31,6 +31,6 @@
|
|||||||
/*
|
/*
|
||||||
* firmeware version string
|
* firmeware version string
|
||||||
*/
|
*/
|
||||||
#define __FIRMWARE__ "2020072901"
|
#define __FIRMWARE__ "2020072902"
|
||||||
|
|
||||||
#endif // _CONFIG_H
|
#endif // _CONFIG_H
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ uint64_t update_check_new_version( void ) {
|
|||||||
uint64_t retval = -1;
|
uint64_t retval = -1;
|
||||||
|
|
||||||
if ( !check_version_client.connect( FIRMWARE_HOST, FIRMWARE_HOST_PORT ) ) {
|
if ( !check_version_client.connect( FIRMWARE_HOST, FIRMWARE_HOST_PORT ) ) {
|
||||||
Serial.printf( __FILE__ "connection failed\r\n");
|
log_e("connection failed");
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ uint64_t update_check_new_version( void ) {
|
|||||||
uint64_t startMillis = millis();
|
uint64_t startMillis = millis();
|
||||||
while ( check_version_client.available() == 0 ) {
|
while ( check_version_client.available() == 0 ) {
|
||||||
if ( millis() - startMillis > 5000 ) {
|
if ( millis() - startMillis > 5000 ) {
|
||||||
Serial.printf( __FILE__ "connection timeout\r\n");
|
log_e("connection timeout");
|
||||||
check_version_client.stop();
|
check_version_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ uint64_t update_check_new_version( void ) {
|
|||||||
|
|
||||||
char *json = (char *)ps_malloc( 200 );
|
char *json = (char *)ps_malloc( 200 );
|
||||||
if ( json == NULL ) {
|
if ( json == NULL ) {
|
||||||
Serial.printf( __FILE__ "memory alloc failed\r\n");
|
log_e("memory alloc failed");
|
||||||
check_version_client.stop();
|
check_version_client.stop();
|
||||||
return( retval );
|
return( retval );
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,7 @@ uint64_t update_check_new_version( void ) {
|
|||||||
|
|
||||||
DeserializationError error = deserializeJson( doc, json);
|
DeserializationError error = deserializeJson( doc, json);
|
||||||
if (error) {
|
if (error) {
|
||||||
Serial.print(F( __FILE__ "update version deserializeJson() failed: "));
|
log_e("update version deserializeJson() failed: ", error.c_str() );
|
||||||
Serial.println(error.c_str());
|
|
||||||
doc.clear();
|
doc.clear();
|
||||||
free( json );
|
free( json );
|
||||||
return( retval );
|
return( retval );
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void bma_save_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( BMA_COFIG_FILE, FILE_WRITE );
|
fs::File file = SPIFFS.open( BMA_COFIG_FILE, FILE_WRITE );
|
||||||
|
|
||||||
if ( !file ) {
|
if ( !file ) {
|
||||||
Serial.printf( __FILE__ "Can't save file: %s\r\n", BMA_COFIG_FILE );
|
log_e("Can't save file: %s", BMA_COFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.write( (uint8_t *)bma_config, sizeof( bma_config ) );
|
file.write( (uint8_t *)bma_config, sizeof( bma_config ) );
|
||||||
@@ -128,12 +128,12 @@ void bma_read_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( BMA_COFIG_FILE, FILE_READ );
|
fs::File file = SPIFFS.open( BMA_COFIG_FILE, FILE_READ );
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf( __FILE__ "Can't open file: %s!\r\n", BMA_COFIG_FILE );
|
log_e("Can't open file: %s!", BMA_COFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int filesize = file.size();
|
int filesize = file.size();
|
||||||
if ( filesize > sizeof( bma_config ) ) {
|
if ( filesize > sizeof( bma_config ) ) {
|
||||||
Serial.printf( __FILE__ "Failed to read configfile. Wrong filesize!\r\n" );
|
log_e("Failed to read configfile. Wrong filesize!" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.read( (uint8_t *)bma_config, filesize );
|
file.read( (uint8_t *)bma_config, filesize );
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void display_save_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_WRITE );
|
fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_WRITE );
|
||||||
|
|
||||||
if ( !file ) {
|
if ( !file ) {
|
||||||
Serial.printf( __FILE__ "Can't save file: %s\r\n", DISPLAY_CONFIG_FILE );
|
log_e("Can't save file: %s", DISPLAY_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.write( (uint8_t *)&display_config, sizeof( display_config ) );
|
file.write( (uint8_t *)&display_config, sizeof( display_config ) );
|
||||||
@@ -111,12 +111,12 @@ void display_read_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_READ );
|
fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_READ );
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf( __FILE__ "Can't open file: %s!\r\n", DISPLAY_CONFIG_FILE );
|
log_e("Can't open file: %s!", DISPLAY_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int filesize = file.size();
|
int filesize = file.size();
|
||||||
if ( filesize > sizeof( display_config ) ) {
|
if ( filesize > sizeof( display_config ) ) {
|
||||||
Serial.printf( __FILE__ "Failed to read configfile. Wrong filesize!\r\n" );
|
log_e("Failed to read configfile. Wrong filesize!" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.read( (uint8_t *)&display_config, filesize );
|
file.read( (uint8_t *)&display_config, filesize );
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ void pmu_setup( TTGOClass *ttgo ) {
|
|||||||
|
|
||||||
// enable coulumb counter
|
// enable coulumb counter
|
||||||
if ( ttgo->power->EnableCoulombcounter() )
|
if ( ttgo->power->EnableCoulombcounter() )
|
||||||
Serial.printf( __FILE__ "enable coulumb counter failed!\r\n");
|
log_e("enable coulumb counter failed!");
|
||||||
if ( ttgo->power->setChargingTargetVoltage( AXP202_TARGET_VOL_4_2V ) )
|
if ( ttgo->power->setChargingTargetVoltage( AXP202_TARGET_VOL_4_2V ) )
|
||||||
Serial.printf( __FILE__ "target voltage set failed!\r\n");
|
log_e("target voltage set failed!");
|
||||||
if ( ttgo->power->setChargeControlCur( 300 ) )
|
if ( ttgo->power->setChargeControlCur( 300 ) )
|
||||||
Serial.printf( __FILE__ "charge current set failed!\r\n");
|
log_e("charge current set failed!");
|
||||||
if ( ttgo->power->setAdcSamplingRate( AXP_ADC_SAMPLING_RATE_200HZ ) )
|
if ( ttgo->power->setAdcSamplingRate( AXP_ADC_SAMPLING_RATE_200HZ ) )
|
||||||
Serial.printf( __FILE__ "adc sample set failed!\r\n");
|
log_e("adc sample set failed!");
|
||||||
|
|
||||||
// Turn off unused power
|
// Turn off unused power
|
||||||
ttgo->power->setPowerOutPut( AXP202_EXTEN, AXP202_OFF );
|
ttgo->power->setPowerOutPut( AXP202_EXTEN, AXP202_OFF );
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ void powermgm_loop( TTGOClass *ttgo ) {
|
|||||||
ttgo->power->setDCDC3Voltage( 3300 );
|
ttgo->power->setDCDC3Voltage( 3300 );
|
||||||
// normal wake up from standby
|
// normal wake up from standby
|
||||||
if ( powermgm_get_event( POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP ) ) {
|
if ( powermgm_get_event( POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP ) ) {
|
||||||
Serial.printf("wakeup\r\n");
|
log_e("wakeup");
|
||||||
display_go_wakeup( ttgo );
|
display_go_wakeup( ttgo );
|
||||||
motor_vibe( 1 );
|
motor_vibe( 1 );
|
||||||
}
|
}
|
||||||
// silence wakeup request from standby
|
// silence wakeup request from standby
|
||||||
else if ( powermgm_get_event( POWERMGM_SILENCE_WAKEUP_REQUEST ) ) {
|
else if ( powermgm_get_event( POWERMGM_SILENCE_WAKEUP_REQUEST ) ) {
|
||||||
Serial.printf("silence wakeup\r\n");
|
log_e("silence wakeup");
|
||||||
display_go_silence_wakeup( ttgo );
|
display_go_silence_wakeup( ttgo );
|
||||||
powermgm_set_event( POWERMGM_SILENCE_WAKEUP );
|
powermgm_set_event( POWERMGM_SILENCE_WAKEUP );
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ void powermgm_loop( TTGOClass *ttgo ) {
|
|||||||
ttgo->power->offTimer();
|
ttgo->power->offTimer();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.printf("go to standby\r\n");
|
log_e("go to standby");
|
||||||
display_go_sleep( ttgo );
|
display_go_sleep( ttgo );
|
||||||
timesyncToRTC();
|
timesyncToRTC();
|
||||||
if ( powermgm_get_event( POWERMGM_WIFI_ACTIVE ) ) wifictl_off();
|
if ( powermgm_get_event( POWERMGM_WIFI_ACTIVE ) ) wifictl_off();
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void timesync_save_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( TIMESYNC_CONFIG_FILE, FILE_WRITE );
|
fs::File file = SPIFFS.open( TIMESYNC_CONFIG_FILE, FILE_WRITE );
|
||||||
|
|
||||||
if ( !file ) {
|
if ( !file ) {
|
||||||
Serial.printf("Can't save file: %s\r\n", TIMESYNC_CONFIG_FILE );
|
log_e("Can't save file: %s", TIMESYNC_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.write( (uint8_t *)×ync_config, sizeof( timesync_config ) );
|
file.write( (uint8_t *)×ync_config, sizeof( timesync_config ) );
|
||||||
@@ -80,12 +80,12 @@ void timesync_read_config( void ) {
|
|||||||
fs::File file = SPIFFS.open( TIMESYNC_CONFIG_FILE, FILE_READ );
|
fs::File file = SPIFFS.open( TIMESYNC_CONFIG_FILE, FILE_READ );
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf("Can't open file: %s!\r\n", TIMESYNC_CONFIG_FILE );
|
log_e("Can't open file: %s!", TIMESYNC_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int filesize = file.size();
|
int filesize = file.size();
|
||||||
if ( filesize > sizeof( timesync_config ) ) {
|
if ( filesize > sizeof( timesync_config ) ) {
|
||||||
Serial.printf("Failed to read configfile. Wrong filesize!\r\n" );
|
log_e("Failed to read configfile. Wrong filesize!" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.read( (uint8_t *)×ync_config, filesize );
|
file.read( (uint8_t *)×ync_config, filesize );
|
||||||
@@ -147,7 +147,7 @@ void timesync_Task( void * pvParameters ) {
|
|||||||
configTime( gmtOffset_sec, daylightOffset_sec, "pool.ntp.org" );
|
configTime( gmtOffset_sec, daylightOffset_sec, "pool.ntp.org" );
|
||||||
|
|
||||||
if( !getLocalTime( &info ) ) {
|
if( !getLocalTime( &info ) ) {
|
||||||
Serial.println( "Failed to obtain time\r\n" );
|
log_e("Failed to obtain time" );
|
||||||
}
|
}
|
||||||
xEventGroupClearBits( time_event_handle, TIME_SYNC_REQUEST );
|
xEventGroupClearBits( time_event_handle, TIME_SYNC_REQUEST );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ void wifictl_save_network( void ) {
|
|||||||
fs::File file = SPIFFS.open( WIFICTL_CONFIG_FILE, FILE_WRITE );
|
fs::File file = SPIFFS.open( WIFICTL_CONFIG_FILE, FILE_WRITE );
|
||||||
|
|
||||||
if ( !file ) {
|
if ( !file ) {
|
||||||
Serial.printf("Can't save file: %s\r\n", WIFICTL_CONFIG_FILE );
|
log_e("Can't save file: %s", WIFICTL_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.write( (uint8_t *)wifictl_networklist, sizeof( wifictl_networklist ) );
|
file.write( (uint8_t *)wifictl_networklist, sizeof( wifictl_networklist ) );
|
||||||
@@ -154,12 +154,12 @@ void wifictl_load_network( void ) {
|
|||||||
fs::File file = SPIFFS.open( WIFICTL_CONFIG_FILE, FILE_READ );
|
fs::File file = SPIFFS.open( WIFICTL_CONFIG_FILE, FILE_READ );
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
Serial.printf("Can't open file: %s\r\n", WIFICTL_CONFIG_FILE );
|
log_e("Can't open file: %s", WIFICTL_CONFIG_FILE );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int filesize = file.size();
|
int filesize = file.size();
|
||||||
if ( filesize > sizeof( wifictl_networklist ) ) {
|
if ( filesize > sizeof( wifictl_networklist ) ) {
|
||||||
Serial.printf("Failed to read configfile. Wrong filesize!\r\n" );
|
log_e("Failed to read configfile. Wrong filesize!" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file.read( (uint8_t *)wifictl_networklist, filesize );
|
file.read( (uint8_t *)wifictl_networklist, filesize );
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
{"version":"2020072901","url":"http://www.neo-guerillaz.de/ttgo-t-watch2020_v1.ino.bin"}
|
{"version":"2020072902","url":"http://www.neo-guerillaz.de/ttgo-t-watch2020_v1.ino.bin"}
|
||||||
|
|||||||
Reference in New Issue
Block a user