Browse Source

Debug: use lowercase enum for mode (following isocpp guidelines)

mcspr-patch-1
Maxim Prokhorov 4 years ago
parent
commit
2e891e3129
3 changed files with 14 additions and 13 deletions
  1. +2
    -1
      code/espurna/config/general.h
  2. +3
    -3
      code/espurna/debug.h
  3. +9
    -9
      code/espurna/debug.ino

+ 2
- 1
code/espurna/config/general.h View File

@ -33,7 +33,8 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef DEBUG_LOG_MODE #ifndef DEBUG_LOG_MODE
#define DEBUG_LOG_MODE DebugLogMode::ENABLED
#define DEBUG_LOG_MODE DebugLogMode::Enabled // Set global logger mode. One of:
// ::Enabled, ::Disabled or ::SkipBoot
#endif #endif
// Serial debug log // Serial debug log


+ 3
- 3
code/espurna/debug.h View File

@ -16,9 +16,9 @@ class PrintRaw;
class PrintHex; class PrintHex;
enum class DebugLogMode : int { enum class DebugLogMode : int {
DISABLED = 0,
ENABLED = 1,
SKIP_BOOT = 2
Disabled = 0,
Enabled = 1,
SkipBoot = 2
}; };
bool debugLogBuffer(); bool debugLogBuffer();


+ 9
- 9
code/espurna/debug.ino View File

@ -281,12 +281,12 @@ void debugSetup() {
String _debugLogModeSerialize(DebugLogMode value) { String _debugLogModeSerialize(DebugLogMode value) {
switch (value) { switch (value) {
case DebugLogMode::DISABLED:
case DebugLogMode::Disabled:
return "0"; return "0";
case DebugLogMode::SKIP_BOOT:
case DebugLogMode::SkipBoot:
return "2"; return "2";
default: default:
case DebugLogMode::ENABLED:
case DebugLogMode::Enabled:
return "1"; return "1";
} }
} }
@ -294,12 +294,12 @@ String _debugLogModeSerialize(DebugLogMode value) {
DebugLogMode _debugLogModeDeserialize(const String& value) { DebugLogMode _debugLogModeDeserialize(const String& value) {
switch (value.toInt()) { switch (value.toInt()) {
case 0: case 0:
return DebugLogMode::DISABLED;
return DebugLogMode::Disabled;
case 2: case 2:
return DebugLogMode::SKIP_BOOT;
return DebugLogMode::SkipBoot;
case 1: case 1:
default: default:
return DebugLogMode::ENABLED;
return DebugLogMode::Enabled;
} }
} }
@ -311,15 +311,15 @@ void debugConfigureBoot() {
const auto mode = getSetting<DebugLogMode, _debugLogModeDeserialize>("dbgLogMode", DEBUG_LOG_MODE); const auto mode = getSetting<DebugLogMode, _debugLogModeDeserialize>("dbgLogMode", DEBUG_LOG_MODE);
switch (mode) { switch (mode) {
case DebugLogMode::SKIP_BOOT:
case DebugLogMode::SkipBoot:
schedule_function([]() { schedule_function([]() {
_debug_enabled = true; _debug_enabled = true;
}); });
// fall through // fall through
case DebugLogMode::DISABLED:
case DebugLogMode::Disabled:
_debug_enabled = false; _debug_enabled = false;
break; break;
case DebugLogMode::ENABLED:
case DebugLogMode::Enabled:
_debug_enabled = true; _debug_enabled = true;
break; break;
} }


Loading…
Cancel
Save