diff --git a/src/app/weather/weather_fetch.cpp b/src/app/weather/weather_fetch.cpp index 65a2502..1230453 100644 --- a/src/app/weather/weather_fetch.cpp +++ b/src/app/weather/weather_fetch.cpp @@ -40,7 +40,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_ uint32_t retval = -1; if ( !today_client.connect( OWM_HOST, OWM_PORT ) ) { - Serial.printf( __FILE__ "connection failed\r\n"); + log_e("connection failed"); return( -1 ); } @@ -55,7 +55,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_ uint64_t startMillis = millis(); while ( today_client.available() == 0 ) { if ( millis() - startMillis > 5000 ) { - Serial.printf( __FILE__ "connection timeout\r\n"); + log_e("connection timeout"); today_client.stop(); 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 ); if ( json == NULL ) { - Serial.printf( __FILE__ "memory alloc failed\r\n"); + log_e("memory alloc failed"); today_client.stop(); return( retval ); } @@ -93,8 +93,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_ DeserializationError error = deserializeJson( doc, json); if (error) { - Serial.print(F( __FILE__ "weather today deserializeJson() failed: ")); - Serial.println(error.c_str()); + log_e("weather today deserializeJson() failed: %s", error.c_str() ); doc.clear(); free( json ); return( retval ); @@ -103,7 +102,7 @@ uint32_t weather_fetch_today( weather_config_t *weather_config, weather_forcast_ retval = doc["cod"].as(); if ( retval != 200 ) { - Serial.printf( __FILE__ "get weather failed, returncode: %d\r\n", retval ); + log_e("get weather failed, returncode: %d", retval ); doc.clear(); free( json ); return( retval ); @@ -131,7 +130,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca uint32_t retval = -1; if ( !forecast_client.connect( OWM_HOST, OWM_PORT ) ) { - Serial.printf( __FILE__ "connection failed\r\n"); + log_e("connection failed"); return( retval ); } @@ -146,7 +145,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca uint64_t startMillis = millis(); while ( forecast_client.available() == 0 ) { if ( millis() - startMillis > 5000 ) { - Serial.printf( __FILE__ "connection timeout\r\n"); + log_e("connection timeout"); forecast_client.stop(); 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 ); if ( json == NULL ) { - Serial.printf( __FILE__ "memory alloc failed\r\n"); + log_e("memory alloc failed"); forecast_client.stop(); return( retval ); } @@ -182,8 +181,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca DynamicJsonDocument doc(20000); DeserializationError error = deserializeJson( doc, json ); if (error) { - Serial.print(F( __FILE__ "weather forecast deserializeJson() failed: ")); - Serial.println(error.c_str()); + log_e("weather forecast deserializeJson() failed: %s", error.c_str() ); doc.clear(); free( json ); return( retval ); @@ -192,7 +190,7 @@ uint32_t weather_fetch_forecast( weather_config_t *weather_config, weather_forca retval = doc["cod"].as(); 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(); free( json ); return( retval ); diff --git a/src/app/weather/weather_setup.cpp b/src/app/weather/weather_setup.cpp index 2c258e7..2cedabd 100644 --- a/src/app/weather/weather_setup.cpp +++ b/src/app/weather/weather_setup.cpp @@ -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 ); else 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 ) { diff --git a/src/config.h b/src/config.h index 45ca42c..8bb2055 100644 --- a/src/config.h +++ b/src/config.h @@ -31,6 +31,6 @@ /* * firmeware version string */ - #define __FIRMWARE__ "2020072901" + #define __FIRMWARE__ "2020072902" #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 69ad06c..4a506a6 100644 --- a/src/gui/mainbar/setup_tile/update/update_check_version.cpp +++ b/src/gui/mainbar/setup_tile/update/update_check_version.cpp @@ -33,7 +33,7 @@ uint64_t update_check_new_version( void ) { uint64_t retval = -1; if ( !check_version_client.connect( FIRMWARE_HOST, FIRMWARE_HOST_PORT ) ) { - Serial.printf( __FILE__ "connection failed\r\n"); + log_e("connection failed"); return( -1 ); } @@ -48,7 +48,7 @@ uint64_t update_check_new_version( void ) { uint64_t startMillis = millis(); while ( check_version_client.available() == 0 ) { if ( millis() - startMillis > 5000 ) { - Serial.printf( __FILE__ "connection timeout\r\n"); + log_e("connection timeout"); check_version_client.stop(); return( retval ); } @@ -56,7 +56,7 @@ uint64_t update_check_new_version( void ) { char *json = (char *)ps_malloc( 200 ); if ( json == NULL ) { - Serial.printf( __FILE__ "memory alloc failed\r\n"); + log_e("memory alloc failed"); check_version_client.stop(); return( retval ); } @@ -86,8 +86,7 @@ uint64_t update_check_new_version( void ) { DeserializationError error = deserializeJson( doc, json); if (error) { - Serial.print(F( __FILE__ "update version deserializeJson() failed: ")); - Serial.println(error.c_str()); + log_e("update version deserializeJson() failed: ", error.c_str() ); doc.clear(); free( json ); return( retval ); diff --git a/src/hardware/bma.cpp b/src/hardware/bma.cpp index 207da7f..8b11db4 100644 --- a/src/hardware/bma.cpp +++ b/src/hardware/bma.cpp @@ -113,7 +113,7 @@ void bma_save_config( void ) { fs::File file = SPIFFS.open( BMA_COFIG_FILE, FILE_WRITE ); 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 { 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 ); 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 { int filesize = file.size(); 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 { file.read( (uint8_t *)bma_config, filesize ); diff --git a/src/hardware/display.cpp b/src/hardware/display.cpp index 80970c4..5d24b4f 100644 --- a/src/hardware/display.cpp +++ b/src/hardware/display.cpp @@ -96,7 +96,7 @@ void display_save_config( void ) { fs::File file = SPIFFS.open( DISPLAY_CONFIG_FILE, FILE_WRITE ); 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 { 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 ); 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 { int filesize = file.size(); 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 { file.read( (uint8_t *)&display_config, filesize ); diff --git a/src/hardware/pmu.cpp b/src/hardware/pmu.cpp index 44912b2..da66785 100644 --- a/src/hardware/pmu.cpp +++ b/src/hardware/pmu.cpp @@ -25,13 +25,13 @@ void pmu_setup( TTGOClass *ttgo ) { // enable coulumb counter 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 ) ) - Serial.printf( __FILE__ "target voltage set failed!\r\n"); + log_e("target voltage set failed!"); 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 ) ) - Serial.printf( __FILE__ "adc sample set failed!\r\n"); + log_e("adc sample set failed!"); // Turn off unused power ttgo->power->setPowerOutPut( AXP202_EXTEN, AXP202_OFF ); diff --git a/src/hardware/powermgm.cpp b/src/hardware/powermgm.cpp index 7c4729c..203224e 100644 --- a/src/hardware/powermgm.cpp +++ b/src/hardware/powermgm.cpp @@ -73,13 +73,13 @@ void powermgm_loop( TTGOClass *ttgo ) { ttgo->power->setDCDC3Voltage( 3300 ); // normal wake up from standby 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 ); motor_vibe( 1 ); } // silence wakeup request from standby else if ( powermgm_get_event( POWERMGM_SILENCE_WAKEUP_REQUEST ) ) { - Serial.printf("silence wakeup\r\n"); + log_e("silence wakeup"); display_go_silence_wakeup( ttgo ); powermgm_set_event( POWERMGM_SILENCE_WAKEUP ); } @@ -94,7 +94,7 @@ void powermgm_loop( TTGOClass *ttgo ) { ttgo->power->offTimer(); } else { - Serial.printf("go to standby\r\n"); + log_e("go to standby"); display_go_sleep( ttgo ); timesyncToRTC(); if ( powermgm_get_event( POWERMGM_WIFI_ACTIVE ) ) wifictl_off(); diff --git a/src/hardware/timesync.cpp b/src/hardware/timesync.cpp index cef75b1..aa8deaa 100644 --- a/src/hardware/timesync.cpp +++ b/src/hardware/timesync.cpp @@ -68,7 +68,7 @@ void timesync_save_config( void ) { fs::File file = SPIFFS.open( TIMESYNC_CONFIG_FILE, FILE_WRITE ); 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 { 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 ); 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 { int filesize = file.size(); if ( filesize > sizeof( timesync_config ) ) { - Serial.printf("Failed to read configfile. Wrong filesize!\r\n" ); + log_e("Failed to read configfile. Wrong filesize!" ); } else { file.read( (uint8_t *)×ync_config, filesize ); @@ -147,7 +147,7 @@ void timesync_Task( void * pvParameters ) { configTime( gmtOffset_sec, daylightOffset_sec, "pool.ntp.org" ); if( !getLocalTime( &info ) ) { - Serial.println( "Failed to obtain time\r\n" ); + log_e("Failed to obtain time" ); } xEventGroupClearBits( time_event_handle, TIME_SYNC_REQUEST ); } diff --git a/src/hardware/wifictl.cpp b/src/hardware/wifictl.cpp index 70a6e73..76e0d43 100644 --- a/src/hardware/wifictl.cpp +++ b/src/hardware/wifictl.cpp @@ -139,7 +139,7 @@ void wifictl_save_network( void ) { fs::File file = SPIFFS.open( WIFICTL_CONFIG_FILE, FILE_WRITE ); 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 { 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 ); 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 { int filesize = file.size(); if ( filesize > sizeof( wifictl_networklist ) ) { - Serial.printf("Failed to read configfile. Wrong filesize!\r\n" ); + log_e("Failed to read configfile. Wrong filesize!" ); } else { file.read( (uint8_t *)wifictl_networklist, filesize ); diff --git a/ttgo-t-watch2020_v1.ino.bin b/ttgo-t-watch2020_v1.ino.bin index efcf013..039d929 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 a0bf493..b5757a6 100644 --- a/ttgo-t-watch2020_v1.version.json +++ b/ttgo-t-watch2020_v1.version.json @@ -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"}