diff --git a/src/hasp/hasp_dispatch.cpp b/src/hasp/hasp_dispatch.cpp index 33db5ee7..23946846 100644 --- a/src/hasp/hasp_dispatch.cpp +++ b/src/hasp/hasp_dispatch.cpp @@ -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() diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp index d0e7611b..8064fa88 100644 --- a/src/hasp_debug.cpp +++ b/src/hasp_debug.cpp @@ -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 } diff --git a/src/log/hasp_debug.cpp b/src/log/hasp_debug.cpp index ff00a1be..522c18a0 100644 --- a/src/log/hasp_debug.cpp +++ b/src/log/hasp_debug.cpp @@ -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)); } } diff --git a/src/main_arduino.cpp b/src/main_arduino.cpp index ae897bd6..4d3c23f6 100644 --- a/src/main_arduino.cpp +++ b/src/main_arduino.cpp @@ -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()) diff --git a/src/main_sdl2.cpp b/src/main_sdl2.cpp index 97f96586..75ce1ae9 100644 --- a/src/main_sdl2.cpp +++ b/src/main_sdl2.cpp @@ -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");