From 72c5de6eae1a4e886dc5203044246d7c838ca757 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 2 Oct 2021 22:32:33 +0200 Subject: [PATCH] Minor optimization in Temperature UM. --- usermods/Temperature/usermod_temperature.h | 4 +--- wled00/wled.h | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/usermods/Temperature/usermod_temperature.h b/usermods/Temperature/usermod_temperature.h index 7c209f47..6a2320c8 100644 --- a/usermods/Temperature/usermod_temperature.h +++ b/usermods/Temperature/usermod_temperature.h @@ -252,23 +252,21 @@ class UsermodTemperature : public Usermod { bool readFromConfig(JsonObject &root) { // we look for JSON object: {"Temperature": {"pin": 0, "degC": true}} int8_t newTemperaturePin = temperaturePin; + DEBUG_PRINT(FPSTR(_name)); JsonObject top = root[FPSTR(_name)]; if (top.isNull()) { - DEBUG_PRINT(FPSTR(_name)); DEBUG_PRINTLN(F(": No config found. (Using defaults.)")); return false; } enabled = top[FPSTR(_enabled)] | enabled; newTemperaturePin = top["pin"] | newTemperaturePin; -// newTemperaturePin = min(33,max(-1,(int)newTemperaturePin)); // bounds check degC = top["degC"] | degC; readingInterval = top[FPSTR(_readInterval)] | readingInterval/1000; readingInterval = min(120,max(10,(int)readingInterval)) * 1000; // convert to ms parasite = top[FPSTR(_parasite)] | parasite; - DEBUG_PRINT(FPSTR(_name)); if (!initDone) { // first run: reading from cfg.json temperaturePin = newTemperaturePin; diff --git a/wled00/wled.h b/wled00/wled.h index b520e95a..460a3886 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2110011 +#define VERSION 2110021 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG @@ -569,7 +569,7 @@ WLED_GLOBAL JsonDocument* fileDoc; WLED_GLOBAL bool doCloseFile _INIT(false); // presets -WLED_GLOBAL int8_t currentPreset _INIT(-1); +WLED_GLOBAL int16_t currentPreset _INIT(-1); WLED_GLOBAL byte errorFlag _INIT(0);