Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
RaiseDev: use Serial logging for ESP8266.
Browse files Browse the repository at this point in the history
This will allow debugging information on the ESP8266.
  • Loading branch information
MikeMcQuaid committed May 17, 2023
1 parent 2d7ecc4 commit 3debceb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
6 changes: 5 additions & 1 deletion examples/Basic/Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,9 @@ void loop()
}

// Auto-update firmware if a newer one found on RaiseDev Console.
raiseDev.updateFirmware("MY_RAISE_DEV_CONSOLE_WORKSPACE", "MY_FIRMWARE_VERSION");
raiseDev.updateFirmware(
// Under the Workspace named MY_RAISE_DEV_CONSOLE_WORKSPACE.
"MY_RAISE_DEV_CONSOLE_WORKSPACE",
// With a version string created from `git describe` defined in platformio.ini.
VERSION_STRING_FROM_GIT);
}
16 changes: 9 additions & 7 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[platformio]
default_envs = esp32dev, esp8266dev
default_envs = esp32, esp8266

[env]
framework = arduino
build_flags = !echo '-Wall -Werror -DCORE_DEBUG_LEVEL=5'
check_tool = cppcheck, clangtidy
check_skip_packages = yes
check_flags = --enable=all
build_flags = !echo '-DVERSION_STRING_FROM_GIT=\\"'$(git describe --dirty --tags --always)'\\"'

[env:esp8266dev]
platform = espressif8266
board = nodemcuv2

[env:esp32dev]
[env:esp32]
platform = espressif32
board = esp32dev
build_src_flags = -Wall -Werror -DCORE_DEBUG_LEVEL=5

[env:esp8266]
platform = espressif8266
board = nodemcuv2
build_src_flags = -Wall -Werror -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER
29 changes: 15 additions & 14 deletions src/RaiseDev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
// Emulate the nicer default ESP32 APIs on ESP8266
auto httpUpdate = ESPhttpUpdate;

#if defined(CORE_DEBUG_LEVEL) && CORE_DEBUG_LEVEL > 0
#define log_d(msg, ...) ets_printf(msg, ##__VA_ARGS__);
#else
#define log_d(msg, ...)
#endif

#if defined(CORE_DEBUG_LEVEL) && CORE_DEBUG_LEVEL > 1
#define log_e(msg, ...) ets_printf(msg, ##__VA_ARGS__);
#else
#define log_e(msg, ...)
#endif
#if defined(DEBUG_ESP_PORT)
const void printf_with_newline(const char *message, ...)
{
va_list args;
va_start(args, message);
DEBUG_ESP_PORT.printf(message, args);
va_end(args);
DEBUG_ESP_PORT.println();
}

#if defined(CORE_DEBUG_LEVEL) && CORE_DEBUG_LEVEL > 3
#define log_i(msg, ...) ets_printf(msg, ##__VA_ARGS__);
#define log_d(message, ...) printf_with_newline(message, ##__VA_ARGS__);
#define log_e(message, ...) printf_with_newline(message, ##__VA_ARGS__);
#define log_i(message, ...) printf_with_newline(message, ##__VA_ARGS__);
#else
#define log_i(msg, ...)
#define log_d(message, ...)
#define log_e(message, ...)
#define log_i(message, ...)
#endif
#endif // defined(ESP8266)

Expand Down

0 comments on commit 3debceb

Please sign in to comment.