From ae8cd514a2e45aeca6ef3822e1fe2494d1c2b1bf Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 4 Jun 2017 12:56:05 +0200 Subject: [PATCH] Focus hooks shall follow the style guide more closely Moved them to the a namespace much more fitting, and renamed the hooks too. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/EEPROM-Settings-Focus.cpp | 17 +++++++------ src/Kaleidoscope/EEPROM-Settings-Focus.h | 28 +++++++++++++--------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/Kaleidoscope/EEPROM-Settings-Focus.cpp b/src/Kaleidoscope/EEPROM-Settings-Focus.cpp index e8d06db9..66f536b7 100644 --- a/src/Kaleidoscope/EEPROM-Settings-Focus.cpp +++ b/src/Kaleidoscope/EEPROM-Settings-Focus.cpp @@ -20,9 +20,10 @@ #include #include "crc.h" -namespace FocusHooks { +namespace kaleidoscope { +namespace eeprom_settings { -bool settings(const char *command) { +bool settingsFocusHook(const char *command) { enum { ISVALID, GETVERSION, @@ -43,23 +44,23 @@ bool settings(const char *command) { switch (sub_command) { case ISVALID: - Focus.printBool(EEPROMSettings.isValid()); + Focus.printBool(::EEPROMSettings.isValid()); Serial.println(); break; case GETVERSION: - Serial.println(EEPROMSettings.version()); + Serial.println(::EEPROMSettings.version()); break; case CRC: Serial.print(::CRC.crc, HEX); Serial.print(F("/")); - Serial.println(EEPROMSettings.crc(), HEX); + Serial.println(::EEPROMSettings.crc(), HEX); break; } return true; } -bool eeprom(const char *command) { +bool eepromFocusHook(const char *command) { enum { CONTENTS, FREE, @@ -91,7 +92,7 @@ bool eeprom(const char *command) { break; } case FREE: - Serial.println(EEPROM.length() - EEPROMSettings.used()); + Serial.println(EEPROM.length() - ::EEPROMSettings.used()); break; } @@ -99,3 +100,5 @@ bool eeprom(const char *command) { } } + +} diff --git a/src/Kaleidoscope/EEPROM-Settings-Focus.h b/src/Kaleidoscope/EEPROM-Settings-Focus.h index 42beef42..fdd250df 100644 --- a/src/Kaleidoscope/EEPROM-Settings-Focus.h +++ b/src/Kaleidoscope/EEPROM-Settings-Focus.h @@ -20,16 +20,22 @@ #include -namespace FocusHooks { -bool settings(const char *command); -bool eeprom(const char *command); -}; +namespace kaleidoscope { +namespace eeprom_settings { -#define FOCUS_HOOK_SETTINGS FOCUS_HOOK(FocusHooks::settings, \ - "settings.valid?\n" \ - "settings.version\n" \ - "settings.crc") +bool settingsFocusHook(const char *command); +bool eepromFocusHook(const char *command); -#define FOCUS_HOOK_EEPROM FOCUS_HOOK(FocusHooks::eeprom, \ - "eeprom.free\n" \ - "eeprom.contents") +} +} + +#define FOCUS_HOOK_SETTINGS FOCUS_HOOK \ + (kaleidoscope::eeprom_settings::settingsFocusHook, \ + "settings.valid?\n" \ + "settings.version\n" \ + "settings.crc") + +#define FOCUS_HOOK_EEPROM FOCUS_HOOK \ + (kalediscope::eeprom_settings::eepromFocusHook, \ + "eeprom.free\n" \ + "eeprom.contents")