@@ -324,8 +324,8 @@ void wait_for_button_push()
324
324
// Battery::GetInstance().getVoltage();
325
325
boolean sentElocStatus=false ;
326
326
int loopcounter=0 ;
327
- Serial. println ( " waiting for button or bluetooth" );
328
- Serial. println ( " voltage is " + String ( Battery::GetInstance ().getVoltage () ));
327
+ ESP_LOGI (TAG, " waiting for button or bluetooth" );
328
+ ESP_LOGI (TAG, " voltage is %.3f " , Battery::GetInstance ().getVoltage ());
329
329
330
330
331
331
int64_t timein= getSystemTimeMS ();
@@ -335,17 +335,17 @@ void wait_for_button_push()
335
335
int leddelay;
336
336
String serialIN;
337
337
338
- Serial. println ( " two following are heap size, total and max alloc " );
339
- Serial. println ( ESP.getFreeHeap ());
340
- Serial. println ( ESP.getMaxAllocHeap ());
338
+ ESP_LOGI (TAG, " two following are heap size, total and max alloc " );
339
+ ESP_LOGI (TAG, " %u " , ESP.getFreeHeap ());
340
+ ESP_LOGI (TAG, " %u " , ESP.getMaxAllocHeap ());
341
341
// mountSDCard();
342
342
// freeSpace();
343
343
344
344
while (!gotrecord)
345
345
{
346
346
// Battery::GetInstance().getVoltage();
347
347
// gotrecord=false;
348
- // Serial.println( "waiting for buttonpress");
348
+ // ESP_LOGI(TAG, "waiting for buttonpress");
349
349
// btwrite("Waiting for record button");
350
350
if (SerialBT.connected ()) {
351
351
if (!gSentSettings ) {
@@ -380,7 +380,7 @@ void wait_for_button_push()
380
380
if (SerialBT.available ()) {
381
381
// handle case for sending initial default setup to app
382
382
serialIN=SerialBT.readString ();
383
- // Serial.println( serialIN);
383
+ // ESP_LOGI(TAG, serialIN);
384
384
// if (serialIN.startsWith("settingsRequest")) {
385
385
// btwrite("#"+String(gSampleRate)+"#"+String(gSecondsPerFile)+"#"+gLocation);
386
386
// }
@@ -392,7 +392,7 @@ void wait_for_button_push()
392
392
}
393
393
394
394
if (serialIN.startsWith ( " _setClk_" )) {
395
- Serial. println ( " setClk starting" );
395
+ ESP_LOGI (TAG, " setClk starting" );
396
396
// string will look like _setClk_G__120____32456732728 //if google, 12 mins since last phone sync
397
397
// or _setClk_P__0____43267832648 //if phone, 0 min since last phone sync
398
398
@@ -401,15 +401,16 @@ void wait_for_button_push()
401
401
everything.trim ();
402
402
String seconds = everything.substring (0 ,10 ); // was 18
403
403
String milliseconds=everything.substring (10 ,everything.length ());
404
- Serial.println (" timestamp in from android GMT " +everything +" sec: " +seconds + " millisec: " +milliseconds);
404
+ String tmp = " timestamp in from android GMT " +everything +" sec: " +seconds + " millisec: " +milliseconds;
405
+ ESP_LOGI (TAG, " %s" , tmp.c_str ());
405
406
String minutesSinceSync=serialIN.substring (11 ,serialIN.indexOf (" ___" ));
406
407
gSyncPhoneOrGoogle =serialIN.substring (8 ,9 );
407
- // Serial.println( minutesSinceSync);
408
- // Serial.println( "GorP: "+GorP);
408
+ // ESP_LOGI(TAG, minutesSinceSync);
409
+ // ESP_LOGI(TAG, "GorP: "+GorP);
409
410
// delay(8000);
410
- // Serial.println( test);
411
- // Serial.println( seconds);
412
- // Serial.println( milliseconds);
411
+ // ESP_LOGI(TAG, test);
412
+ // ESP_LOGI(TAG, seconds);
413
+ // ESP_LOGI(TAG, milliseconds);
413
414
milliseconds.trim ();
414
415
if (milliseconds.length ()<2 ) milliseconds=" 0" ;
415
416
timeObject.setTime (atol (seconds.c_str ())+(TIMEZONE_OFFSET*60L *60L ), (atol (milliseconds.c_str ()))*1000 );
@@ -424,10 +425,10 @@ void wait_for_button_push()
424
425
int64_t time_us = ( (int64_t )tv_now.tv_sec * 1000000L ) + (int64_t )tv_now.tv_usec ;
425
426
time_us=time_us/1000 ;
426
427
427
- // Serial.println( "atol(minutesSinceSync.c_str()) *60L*1000L "+String(atol(minutesSinceSync.c_str()) *60L*1000L));
428
+ // ESP_LOGI(TAG, "atol(minutesSinceSync.c_str()) *60L*1000L "+String(atol(minutesSinceSync.c_str()) *60L*1000L));
428
429
gLastSystemTimeUpdate =getTimeFromTimeObjectMS () -( atol (minutesSinceSync.c_str ()) *60L *1000L );
429
430
timein= getSystemTimeMS ();
430
- // Serial.println( "timestamp in from android GMT "+everything +" sec: "+seconds + " millisec: "+milliseconds);
431
+ // ESP_LOGI(TAG, "timestamp in from android GMT "+everything +" sec: "+seconds + " millisec: "+milliseconds);
431
432
// ESP_LOGI("d", "new timestamp from new sys time (local time) %lld", time_us ); //this is 7 hours too slow!
432
433
// ESP_LOGI("d","new timestamp from timeobJect (local time) %lld",gLastSystemTimeUpdate);
433
434
@@ -438,7 +439,7 @@ void wait_for_button_push()
438
439
sentElocStatus=true ;
439
440
sendElocStatus ();
440
441
}
441
- Serial. println ( " setClk ending" );
442
+ ESP_LOGI (TAG, " setClk ending" );
442
443
}
443
444
444
445
@@ -450,7 +451,7 @@ void wait_for_button_push()
450
451
gLocationCode .trim ();
451
452
gLocationAccuracy = serialIN.substring (serialIN.indexOf (" #" )+1 ,serialIN.length () );
452
453
gLocationAccuracy .trim ();
453
- Serial. println ( " loc: " + gLocationCode + " acc " + gLocationAccuracy );
454
+ ESP_LOGI (TAG, " loc: %s acc %s " , gLocationCode . c_str (), gLocationAccuracy . c_str () );
454
455
455
456
File file = SPIFFS.open (" /gps.txt" , FILE_WRITE);
456
457
file.println (gLocationCode );
@@ -885,10 +886,10 @@ bool folderExists(const char* folder)
885
886
struct stat sb;
886
887
887
888
if (stat (folder, &sb) == 0 && S_ISDIR (sb.st_mode )) {
888
- Serial. println ( " yes" );
889
+ ESP_LOGI (TAG, " yes" );
889
890
return true ;
890
891
} else {
891
- Serial. println ( " no" );
892
+ ESP_LOGI (TAG, " no" );
892
893
return false ;
893
894
}
894
895
return false ;
@@ -901,7 +902,7 @@ String readNodeName() {
901
902
// if (a==2) {a=1;}
902
903
if (!(SPIFFS.exists (" /nodename.txt" ))){
903
904
904
- Serial. println ( " No nodename set. Returning ELOC_NONAME" );
905
+ ESP_LOGI (TAG, " No nodename set. Returning ELOC_NONAME" );
905
906
return (" ELOC_NONAME" );
906
907
907
908
@@ -915,7 +916,7 @@ String readNodeName() {
915
916
String temp = file2.readString ();
916
917
temp.trim ();
917
918
file2.close ();
918
- Serial. println ( " node name: " + temp);
919
+ ESP_LOGI (TAG, " node name: %s " , temp. c_str () );
919
920
return (temp);
920
921
// return("");
921
922
@@ -1100,9 +1101,8 @@ void app_main(void)
1100
1101
ESP_LOGI (TAG, " \n\n ---------VERSION %s\n\n " , VERSIONTAG);
1101
1102
initArduino ();
1102
1103
ESP_LOGI (TAG, " initArduino done" );
1103
- Serial.begin (115200 );
1104
1104
1105
- Serial. println ( " \n SETUP--start\n " );
1105
+ ESP_LOGI (TAG, " \n SETUP--start\n " );
1106
1106
1107
1107
changeBootPartition (); // so if reboots, always boot into the bluetooth partition
1108
1108
@@ -1185,7 +1185,7 @@ printMemory();
1185
1185
1186
1186
1187
1187
if (!SPIFFS.begin (true , " /spiffs" )){
1188
- Serial. println ( " An Error has occurred while mounting SPIFFS" );
1188
+ ESP_LOGI (TAG, " An Error has occurred while mounting SPIFFS" );
1189
1189
// return;
1190
1190
}
1191
1191
delay (50 );
@@ -1194,9 +1194,9 @@ delay(50);
1194
1194
SerialBT.begin (readNodeName (),false );
1195
1195
delay (100 );
1196
1196
if (SerialBT.isReady ()) {
1197
- Serial. println ( " SerialBT is ready ------------------------------------------------------ " );
1197
+ ESP_LOGI (TAG, " SerialBT is ready ------------------------------------------------------ " );
1198
1198
} else {
1199
- Serial. println ( " SerialBT is NOT ready --------------------------------------------------- " );
1199
+ ESP_LOGI (TAG, " SerialBT is NOT ready --------------------------------------------------- " );
1200
1200
}
1201
1201
1202
1202
@@ -1236,7 +1236,6 @@ ESP_ERROR_CHECK(gpio_isr_handler_add(GPIO_BUTTON, buttonISR, (void *)OTHER_GPIO_
1236
1236
.min_freq_mhz = gMinFrequencyMHZ ,
1237
1237
.light_sleep_enable = gEnableLightSleep
1238
1238
};
1239
- Serial.flush ();
1240
1239
esp_pm_configure (&cfg);
1241
1240
1242
1241
0 commit comments