From 01ce1b0c91a72d46a87c517626038b11497521da Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 23 Sep 2018 13:55:42 +0200 Subject: [PATCH] Fix Shelly2 monitoring Disable serial logging on Shelly2 as serial is being used by energy monitoring (#3878) --- sonoff/_changelog.ino | 1 + sonoff/sonoff.h | 2 +- sonoff/sonoff.ino | 4 ---- sonoff/xdrv_10_rules.ino | 2 +- sonoff/xnrg_04_mcp39f501.ino | 1 + 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index b220dc4b3..f38b68153 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -5,6 +5,7 @@ * Add power value below 5W to Sonoff Pow R2 and S31 (#3745) * Add force_update to Home Assistant discovery (#3873) * Fix rule trigger POWER1#STATE execution after restart and SetOption0 is 0 (#3856) + * Disable serial logging on Shelly2 as serial is being used by energy monitoring (#3878) * * 6.2.1.5 20180921 * Add authentication to HTTP web pages diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index c3d514f0c..80356d475 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -203,7 +203,7 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX}; enum XsnsFunctions {FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD, - FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_RULE_INIT_POWER, FUNC_SHOW_SENSOR, + FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR, FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM}; const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 }; diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index a405fe47b..dc1445fc4 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2613,10 +2613,6 @@ void setup() SetPulseTimer(i, Settings.pulse_timer[i]); } } - - XdrvMailbox.index = power; - XdrvCall(FUNC_RULE_INIT_POWER); - blink_powersave = power; snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s (" D_CMND_TOPIC " %s, " D_FALLBACK " %s, " D_CMND_GROUPTOPIC " %s) " D_VERSION " %s-" ARDUINO_ESP8266_RELEASE), diff --git a/sonoff/xdrv_10_rules.ino b/sonoff/xdrv_10_rules.ino index 5ef59c037..303207c10 100644 --- a/sonoff/xdrv_10_rules.ino +++ b/sonoff/xdrv_10_rules.ino @@ -366,6 +366,7 @@ void RulesEvery50ms() if (Settings.rule_enabled) { // Any rule enabled char json_event[120]; + if (-1 == rules_new_power) { rules_new_power = power; } if (rules_new_power != rules_old_power) { if (rules_old_power != -1) { for (byte i = 0; i < devices_present; i++) { @@ -628,7 +629,6 @@ boolean Xdrv10(byte function) case FUNC_EVERY_SECOND: RulesEverySecond(); break; - case FUNC_RULE_INIT_POWER: case FUNC_SET_POWER: RulesSetPower(); break; diff --git a/sonoff/xnrg_04_mcp39f501.ino b/sonoff/xnrg_04_mcp39f501.ino index 05d55a425..408e0ca26 100644 --- a/sonoff/xnrg_04_mcp39f501.ino +++ b/sonoff/xnrg_04_mcp39f501.ino @@ -614,6 +614,7 @@ void McpEverySecond() void McpSnsInit() { + SetSeriallog(LOG_LEVEL_NONE); // Free serial interface from logging interference digitalWrite(15, 1); // GPIO15 - MCP enable }