diff --git a/Mk2_3phase_RFdatalog_temp/.clang-format b/Mk2_3phase_RFdatalog_temp/.clang-format index 974d2ce..0a8bbae 100644 --- a/Mk2_3phase_RFdatalog_temp/.clang-format +++ b/Mk2_3phase_RFdatalog_temp/.clang-format @@ -60,7 +60,7 @@ BreakConstructorInitializersBeforeComma: false BreakInheritanceList: BeforeColon BreakStringLiterals: false ColumnLimit: 0 -CommentPragmas: '' +CommentPragmas: "" CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 2 @@ -89,12 +89,12 @@ IncludeCategories: Priority: 3 SortPriority: 0 CaseSensitive: false - - Regex: '.*' + - Regex: ".*" Priority: 1 SortPriority: 0 CaseSensitive: false -IncludeIsMainRegex: '' -IncludeIsMainSourceRegex: '' +IncludeIsMainRegex: "" +IncludeIsMainSourceRegex: "" IndentAccessModifiers: false IndentCaseBlocks: true IndentCaseLabels: true @@ -110,8 +110,8 @@ JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true LambdaBodyIndentation: Signature Language: Cpp -MacroBlockBegin: '' -MacroBlockEnd: '' +MacroBlockBegin: "" +MacroBlockEnd: "" MaxEmptyLinesToKeep: 100000 NamespaceIndentation: None ObjCBinPackProtocolList: Auto @@ -173,7 +173,7 @@ SpacesInLineCommentPrefix: Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false -Standard: Auto +Standard: c++17 StatementAttributeLikeMacros: - Q_EMIT StatementMacros: diff --git a/Mk2_3phase_RFdatalog_temp/config.h b/Mk2_3phase_RFdatalog_temp/config.h index 8df137e..eec06fa 100644 --- a/Mk2_3phase_RFdatalog_temp/config.h +++ b/Mk2_3phase_RFdatalog_temp/config.h @@ -50,7 +50,7 @@ inline constexpr bool OVERRIDE_PIN_PRESENT{ false }; /**< set #endif inline constexpr bool WATCHDOG_PIN_PRESENT{ false }; /**< set it to 'true' if there's a watch led */ -inline constexpr bool RELAY_DIVERSION{ false }; /**< set it to 'true' if a relay is used for diversion */ +inline constexpr bool RELAY_DIVERSION{ false }; /**< set it to 'true' if a relay is used for diversion */ inline constexpr bool DUAL_TARIFF{ false }; /**< set it to 'true' if there's a dual tariff each day AND the router is connected to the billing meter */ // ----------- Pinout assignments ----------- diff --git a/Mk2_3phase_RFdatalog_temp/config_system.h b/Mk2_3phase_RFdatalog_temp/config_system.h index c97c936..f5b08a6 100644 --- a/Mk2_3phase_RFdatalog_temp/config_system.h +++ b/Mk2_3phase_RFdatalog_temp/config_system.h @@ -28,7 +28,8 @@ inline constexpr uint8_t SUPPLY_FREQUENCY{ 50 }; /**< number of cycles/s of the inline constexpr uint32_t WORKING_ZONE_IN_JOULES{ 3600UL }; /**< number of joule for 1Wh */ -inline constexpr uint8_t DATALOG_PERIOD_IN_SECONDS{ 5 }; /**< Period of datalogging in seconds */ +inline constexpr uint8_t DATALOG_PERIOD_IN_SECONDS{ 5 }; /**< Period of datalogging in seconds */ + inline constexpr typename conditional< DATALOG_PERIOD_IN_SECONDS * SUPPLY_FREQUENCY >= UINT8_MAX, uint16_t, uint8_t >::type DATALOG_PERIOD_IN_MAINS_CYCLES{ DATALOG_PERIOD_IN_SECONDS * SUPPLY_FREQUENCY }; /**< Period of datalogging in cycles */ // Computes inverse value at compile time to use '*' instead of '/' diff --git a/Mk2_3phase_RFdatalog_temp/constants.h b/Mk2_3phase_RFdatalog_temp/constants.h index fa9066e..410fa33 100644 --- a/Mk2_3phase_RFdatalog_temp/constants.h +++ b/Mk2_3phase_RFdatalog_temp/constants.h @@ -12,6 +12,8 @@ #ifndef CONSTANTS_H #define CONSTANTS_H +#include + // Dallas DS18B20 commands inline constexpr uint8_t CONVERT_TEMPERATURE{ 0x44 }; inline constexpr uint8_t READ_SCRATCHPAD{ 0xBE }; diff --git a/Mk2_3phase_RFdatalog_temp/utils_temp.h b/Mk2_3phase_RFdatalog_temp/utils_temp.h index aa556e0..cf93ab2 100644 --- a/Mk2_3phase_RFdatalog_temp/utils_temp.h +++ b/Mk2_3phase_RFdatalog_temp/utils_temp.h @@ -65,7 +65,7 @@ class TemperatureSensing * @brief Request temperature for all sensors * */ - void requestTemperatures() + void requestTemperatures() const { #ifdef TEMP_ENABLED oneWire.reset(); @@ -78,7 +78,7 @@ class TemperatureSensing * @brief Initialize the Dallas sensors * */ - void initTemperatureSensors() + void initTemperatureSensors() const { #ifdef TEMP_ENABLED oneWire.begin(sensorPin); @@ -112,7 +112,7 @@ class TemperatureSensing * @param idx The index of the device * @return int16_t Temperature * 100 */ - int16_t readTemperature(const uint8_t idx) + int16_t readTemperature(const uint8_t idx) const { static ScratchPad buf;