Restore the debugPrintHaspHeader

This commit is contained in:
fvanroie 2021-05-06 18:16:27 +02:00
parent 6662d07c2d
commit fdc8d86b3f
5 changed files with 34 additions and 17 deletions

View File

@ -966,6 +966,8 @@ void dispatchSetup()
// In order of importance : commands are NOT case-sensitive
// The command.func() call will receive the full topic and payload parameters!
LOG_TRACE(TAG_MSGR, F(D_SERVICE_STARTING));
/* WARNING: remember to expand the commands array when adding new commands */
dispatch_add_command(PSTR("json"), dispatch_parse_json);
dispatch_add_command(PSTR("page"), dispatch_page);
@ -989,6 +991,8 @@ void dispatchSetup()
dispatch_add_command(PSTR("setupap"), oobeFakeSetup);
#endif
/* WARNING: remember to expand the commands array when adding new commands */
LOG_INFO(TAG_MSGR, F(D_SERVICE_STARTED));
}
IRAM_ATTR void dispatchLoop()

View File

@ -37,6 +37,7 @@ inline void debugSendAnsiCode(const __FlashStringHelper* code, Print* _logOutput
#endif
}
/*
void debug_timestamp()
{
timeval curTime;
@ -48,7 +49,7 @@ void debug_timestamp()
// strftime(currentTime, 80, "%Y-%m-%d %H:%M.%S", localtime(&t));
strftime(currentTime, 80, "%H:%M:%S", localtime(&t));
printf("[%s.%03d] ", currentTime, milli);
}
} */
static void debugPrintTimestamp(int level, Print* _logOutput)
{ /* Print Current Time */
@ -64,8 +65,8 @@ static void debugPrintTimestamp(int level, Print* _logOutput)
if(timeinfo->tm_year >= 120) {
unsigned long int milli = curTime.tv_usec / 1000;
char buffer[24];
strftime(buffer, sizeof(buffer), "[%b %d %H:%M:%S", timeinfo); // Literal String
// strftime(buffer, sizeof(buffer), "[%H:%M:%S.", timeinfo); // Literal String
// strftime(buffer, sizeof(buffer), "[%b %d %H:%M:%S", timeinfo); // Literal String
strftime(buffer, sizeof(buffer), "[%H:%M:%S", timeinfo); // Literal String
#ifdef ARDUINO
_logOutput->printf(PSTR("%s.%03lu]"), buffer, milli);
@ -178,23 +179,33 @@ void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, co
// Send the HASP header and version to the output device specified
void debugPrintHaspHeader(Print* output)
{
// if(debugAnsiCodes) debug_print(output,TERM_COLOR_YELLOW);
// debug_newline(output);
// debug_print(output, F(""
// " _____ _____ _____ _____\r\n"
// " | | | _ | __| _ |\r\n"
// " | | |__ | __|\r\n"
// " |__|__|__|__|_____|__|\r\n"
// " Home Automation Switch Plate\r\n"
// " Open Hardware edition v"));
char buffer[32];
char buffer[16];
haspGetVersion(buffer, sizeof(buffer));
#ifdef ARDUINO
if(debugAnsiCodes) output->print(TERM_COLOR_YELLOW);
output->println();
output->print(F("\r\n"
" open____ _____ _____ _____\r\n"
" | | | _ | __| _ |\r\n"
" | | |__ | __|\r\n"
" |__|__|__|__|_____|__|\r\n"
" Home Automation Switch Plate\r\n"
" Open Hardware edition v"));
output->println(buffer);
output->println();
#else
if(debugAnsiCodes) debug_print(output, TERM_COLOR_YELLOW);
debug_print(output, F("\r\n"
" open____ _____ _____ _____\r\n"
" | | | _ | __| _ |\r\n"
" | | |__ | __|\r\n"
" |__|__|__|__|_____|__|\r\n"
" Home Automation Switch Plate\r\n"
" Open Hardware edition v"));
debug_print(output, buffer);
debug_newline(output);
debug_newline(output);
#endif
}

View File

@ -328,7 +328,7 @@ void debugSetupWithoutLogging(JsonObject settings)
debugPrintHaspHeader(&Serial);
Serial.flush();
LOG_INFO(TAG_DEBG, F(D_SERVICE_STARTED " @ %u baud"), baudrate);
LOG_INFO(TAG_DEBG, F(D_SERVICE_STARTED " @ %u Bps"), baudrate);
LOG_INFO(TAG_DEBG, F("Environment: " PIOENV));
}
}

View File

@ -57,9 +57,9 @@ void setup()
configSetup(); // also runs debugSetupWithoutLogging(), debugSetup() and debugStart()
#endif
dispatchSetup(); // before hasp and oobe, asap after logging starts
guiSetup();
debugSetup(); // Init the console
dispatchSetup(); // for hasp and oobe
debugSetup(); // Init the console
#if HASP_USE_CONFIG > 0
if(!oobeSetup())

View File

@ -276,7 +276,9 @@ int main(int argc, char* argv[])
// printf("%s %d\n", __FILE__, __LINE__);
// fflush(stdout);
debugPrintHaspHeader(stdout);
LOG_NOTICE(TAG_MAIN, "pre setup");
setup();
LOG_TRACE(TAG_MAIN, "loop started");