Skip to content

Commit

Permalink
Fixes to feature update for Internal Temperature usermod
Browse files Browse the repository at this point in the history
Simplified the code by removing an unnecessary function definition and instead using direct assignment in the place where the function was previously called.
  • Loading branch information
adamsthws committed Jun 28, 2024
1 parent a1dfdce commit 3815516
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class InternalTemperatureUsermod : public Usermod
// any private methods should go here (non-inline method should be defined out of class)
void publishMqtt(const char *state, bool retain = false); // example for publishing MQTT message

// Makes sure the measurement interval can't be set too low
void setSafeLoopInterval(unsigned long newInterval) {
loopInterval = max(newInterval, minLoopInterval);
}

public:
void setup()
{
Expand Down Expand Up @@ -138,7 +133,7 @@ class InternalTemperatureUsermod : public Usermod
bool configComplete = !top.isNull();
configComplete &= getJsonValue(top[FPSTR(_enabled)], isEnabled);
configComplete &= getJsonValue(top[FPSTR(_loopInterval)], loopInterval);
setSafeLoopInterval(loopInterval); // Makes sure the loop interval isn't too small.
loopInterval = max(loopInterval, minLoopInterval); // Makes sure the loop interval isn't too small.
configComplete &= getJsonValue(top[FPSTR(_presetToActivate)], presetToActivate);
configComplete &= getJsonValue(top[FPSTR(_activationThreshold)], activationThreshold);
return configComplete;
Expand Down

0 comments on commit 3815516

Please sign in to comment.