Skip to content

Commit

Permalink
Refactor formatting and add missing includes for consistency and clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
FredM67 committed Dec 27, 2024
1 parent 90f3d2f commit fff67d1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Mk2_3phase_RFdatalog_temp/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
ColumnLimit: 0
CommentPragmas: ''
CommentPragmas: ""
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
Expand Down Expand Up @@ -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
Expand All @@ -110,8 +110,8 @@ JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 100000
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
Expand Down Expand Up @@ -173,7 +173,7 @@ SpacesInLineCommentPrefix:
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
Standard: c++17
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
Expand Down
2 changes: 1 addition & 1 deletion Mk2_3phase_RFdatalog_temp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----------
Expand Down
3 changes: 2 additions & 1 deletion Mk2_3phase_RFdatalog_temp/config_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand Down
2 changes: 2 additions & 0 deletions Mk2_3phase_RFdatalog_temp/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#ifndef CONSTANTS_H
#define CONSTANTS_H

#include <Arduino.h>

// Dallas DS18B20 commands
inline constexpr uint8_t CONVERT_TEMPERATURE{ 0x44 };
inline constexpr uint8_t READ_SCRATCHPAD{ 0xBE };
Expand Down
6 changes: 3 additions & 3 deletions Mk2_3phase_RFdatalog_temp/utils_temp.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TemperatureSensing
* @brief Request temperature for all sensors
*
*/
void requestTemperatures()
void requestTemperatures() const
{
#ifdef TEMP_ENABLED
oneWire.reset();
Expand All @@ -78,7 +78,7 @@ class TemperatureSensing
* @brief Initialize the Dallas sensors
*
*/
void initTemperatureSensors()
void initTemperatureSensors() const
{
#ifdef TEMP_ENABLED
oneWire.begin(sensorPin);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit fff67d1

Please sign in to comment.