change debug msg

This commit is contained in:
sharandac
2020-07-29 09:18:53 +02:00
parent c67db70f22
commit 47e2fb0376
12 changed files with 36 additions and 40 deletions

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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 *)&timesync_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 *)&timesync_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 );
}

View File

@@ -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 );