From 2c02532e1c2e40cd4af106ca137228dfbc700a76 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 23 Oct 2018 15:51:51 +0200 Subject: [PATCH] 6.2.1.19 Rename user_config.h 6.2.1.19 20181023 * Fix header file execution order by renaming user_config.h to my_user_config.h * Fix Arduino IDE compilation warning regarding e-paper library --- API.md | 1 + .../library.properties | 9 +++++++++ sonoff/_changelog.ino | 5 ++++- sonoff/{user_config.h => my_user_config.h} | 8 ++++---- sonoff/sonoff.h | 9 ++++++--- sonoff/sonoff.ino | 20 +++++++++++-------- sonoff/user_config_override_sample.h | 8 ++++---- sonoff/xdrv_14_mp3.ino | 4 ++-- sonoff/xsns_34_hx711.ino | 5 +++++ 9 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 lib/esp-epaper-29-ws-20171230-gemu-1.0/library.properties rename sonoff/{user_config.h => my_user_config.h} (99%) diff --git a/API.md b/API.md index 9b43a1456..23e45369d 100644 --- a/API.md +++ b/API.md @@ -8,6 +8,7 @@ The following table lists Callback Ids and their availability for a Driver, Sens Callback Id | Bool | Version | xdrv | xsns | xnrg | Description ----------------------------|------|----------|------|------|------|---------------------------------- +FUNC_SETTINGS_OVERRIDE | | 6.2.1.19 | x | | | Override start-up settings FUNC_MODULE_INIT | x | 6.2.1.17 | x | | | Init module specific parameters FUNC_PRE_INIT | | | x | | x | Once GPIO have been established FUNC_INIT | | | x | x | x | At end of initialisation diff --git a/lib/esp-epaper-29-ws-20171230-gemu-1.0/library.properties b/lib/esp-epaper-29-ws-20171230-gemu-1.0/library.properties new file mode 100644 index 000000000..07a9e0a07 --- /dev/null +++ b/lib/esp-epaper-29-ws-20171230-gemu-1.0/library.properties @@ -0,0 +1,9 @@ +name=Waveshare esp 2.9 inch e-paper display driver +version=1.0 +author=Gerhard Muntz +maintainer=Gerhard Muntz +sentence=ESP8266 library for Waveshare e-paper display. +paragraph= +category=Display +url=https://github.com/gemu2015/Sonoff-Tasmota/tree/displays/lib/esp-epaper-29-ws-20171230-gemu-1.0# +architectures=esp8266 diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index d1f82a2d0..c3daa6e42 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.2.1.18 20181019 +/* 6.2.1.19 20181023 + * Fix header file execution order by renaming user_config.h to my_user_config.h + * + * 6.2.1.18 20181019 * Add more API callbacks and document API.md * Add support for La Crosse TX20 Anemometer (#2654, #3146) * Add optional HX711 scale interface to web GUI demonstrating easy GUI plug-in diff --git a/sonoff/user_config.h b/sonoff/my_user_config.h similarity index 99% rename from sonoff/user_config.h rename to sonoff/my_user_config.h index 4c0b4fdb3..c6becae97 100644 --- a/sonoff/user_config.h +++ b/sonoff/my_user_config.h @@ -1,5 +1,5 @@ /* - user_config.h - user specific configuration for Sonoff-Tasmota + my_user_config.h - user specific configuration for Sonoff-Tasmota Copyright (C) 2018 Theo Arends @@ -17,8 +17,8 @@ along with this program. If not, see . */ -#ifndef _USER_CONFIG_H_ -#define _USER_CONFIG_H_ +#ifndef _MY_USER_CONFIG_H_ +#define _MY_USER_CONFIG_H_ /*********************************************************************************************\ * This file consists of TWO sections. @@ -410,4 +410,4 @@ #error "Select either USE_MQTT_TLS or USE_WEBSERVER as there is just not enough memory to play with" #endif -#endif // _USER_CONFIG_H_ +#endif // _MY_USER_CONFIG_H_ diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index beacb9f93..70e0e9a3d 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -212,10 +212,13 @@ enum LightTypes {LT_BASIC, LT_PWM1, LT_PWM2, LT_PWM3, LT_PWM4, LT_PWM5, LT_PWM6, enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_RGBWC}; enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX}; -enum XsnsFunctions {FUNC_MODULE_INIT, 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, +enum XsnsFunctions {FUNC_SETTINGS_OVERRIDE, FUNC_MODULE_INIT, 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_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, - FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_HANDLER}; + FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, + FUNC_SET_POWER, FUNC_SET_DEVICE_POWER, FUNC_SHOW_SENSOR, + FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM, FUNC_BUTTON_PRESSED, + FUNC_WEB_ADD_BUTTON, FUNC_WEB_ADD_MAIN_BUTTON, FUNC_WEB_ADD_HANDLER}; 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 3972d4f40..153e55fb7 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -28,13 +28,13 @@ // Location specific includes #include // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0) #include "sonoff_version.h" // Sonoff-Tasmota version information -#include "sonoff.h" // Enumeration used in user_config.h -#include "user_config.h" // Fixed user configurable options +#include "sonoff.h" // Enumeration used in my_user_config.h +#include "my_user_config.h" // Fixed user configurable options #ifdef USE_CONFIG_OVERRIDE - #include "user_config_override.h" // Configuration overrides for user_config.h + #include "user_config_override.h" // Configuration overrides for my_user_config.h #endif #include "sonoff_post.h" // Configuration overrides for all previous includes -#include "i18n.h" // Language support configured by user_config.h +#include "i18n.h" // Language support configured by my_user_config.h #include "sonoff_template.h" // Hardware configuration #ifdef ARDUINO_ESP8266_RELEASE_2_4_0 @@ -2575,6 +2575,10 @@ void setup() GetFeatures(); + if (1 == RtcReboot.fast_reboot_count) { // Allow setting override only when all is well + XdrvCall(FUNC_SETTINGS_OVERRIDE); + } + baudrate = Settings.baudrate * 1200; seriallog_level = Settings.seriallog_level; seriallog_timer = SERIALLOG_TIMER; @@ -2587,19 +2591,19 @@ void setup() sleep = Settings.sleep; // Disable functionality as possible cause of fast restart within BOOT_LOOP_TIME seconds (Exception, WDT or restarts) - if (RtcReboot.fast_reboot_count > 1) { // Restart twice + if (RtcReboot.fast_reboot_count > 1) { // Restart twice Settings.flag3.user_esp8285_enable = 0; // Disable ESP8285 Generic GPIOs interfering with flash SPI - if (RtcReboot.fast_reboot_count > 2) { // Restart 3 times + if (RtcReboot.fast_reboot_count > 2) { // Restart 3 times for (byte i = 0; i < MAX_RULE_SETS; i++) { if (bitRead(Settings.rule_stop, i)) { bitWrite(Settings.rule_enabled, i, 0); // Disable rules causing boot loop } } } - if (RtcReboot.fast_reboot_count > 3) { // Restarted 4 times + if (RtcReboot.fast_reboot_count > 3) { // Restarted 4 times Settings.rule_enabled = 0; // Disable all rules } - if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times + if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic Settings.last_module = SONOFF_BASIC; for (byte i = 0; i < MAX_GPIO_PIN; i++) { diff --git a/sonoff/user_config_override_sample.h b/sonoff/user_config_override_sample.h index 8b3203904..8d0abb22f 100644 --- a/sonoff/user_config_override_sample.h +++ b/sonoff/user_config_override_sample.h @@ -1,5 +1,5 @@ /* - user_config_override.h - user configuration overrides user_config.h for Sonoff-Tasmota + user_config_override.h - user configuration overrides my_user_config.h for Sonoff-Tasmota Copyright (C) 2018 Theo Arends @@ -25,7 +25,7 @@ /*****************************************************************************************************\ * USAGE: - * To modify the stock configuration without changing the user_config.h file: + * To modify the stock configuration without changing the my_user_config.h file: * (1) copy this file to "user_config_override.h" (It will be ignored by Git) * (2) define your own settings below * (3) for platformio: @@ -33,12 +33,12 @@ * ie1 : export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE' * ie2 : enable in file platformio.ini "build_flags = -Wl,-Tesp8266.flash.1m0.ld -DUSE_CONFIG_OVERRIDE" * for Arduino IDE: - * enable define USE_CONFIG_OVERRIDE in user_config.h + * enable define USE_CONFIG_OVERRIDE in my_user_config.h ****************************************************************************************************** * ATTENTION: * - Changes to SECTION1 PARAMETER defines will only override flash settings if you change define CFG_HOLDER. * - Expect compiler warnings when no ifdef/undef/endif sequence is used. - * - You still need to update user_config.h for major define USE_MQTT_TLS. + * - You still need to update my_user_config.h for major define USE_MQTT_TLS. * - All parameters can be persistent changed online using commands via MQTT, WebConsole or Serial. \*****************************************************************************************************/ diff --git a/sonoff/xdrv_14_mp3.ino b/sonoff/xdrv_14_mp3.ino index 3bbf32bd0..ae0c69fd0 100644 --- a/sonoff/xdrv_14_mp3.ino +++ b/sonoff/xdrv_14_mp3.ino @@ -141,7 +141,7 @@ void MP3PlayerInit(void) { delay(1000); MP3_CMD(MP3_CMD_RESET, MP3_CMD_RESET_VALUE); // reset the player to defaults delay(3000); - MP3_CMD(MP3_CMD_VOLUME, MP3_VOLUME); // after reset set volume depending on the entry in the user_config.h + MP3_CMD(MP3_CMD_VOLUME, MP3_VOLUME); // after reset set volume depending on the entry in the my_user_config.h } return; } @@ -167,7 +167,7 @@ void MP3_CMD(uint8_t mp3cmd,uint16_t val) { MP3Player->write(cmd, sizeof(cmd)); // write mp3 data array to player delay(1000); if (mp3cmd == MP3_CMD_RESET) { - MP3_CMD(MP3_CMD_VOLUME, MP3_VOLUME); // after reset set volume depending on the entry in the user_config.h + MP3_CMD(MP3_CMD_VOLUME, MP3_VOLUME); // after reset set volume depending on the entry in the my_user_config.h } return; } diff --git a/sonoff/xsns_34_hx711.ino b/sonoff/xsns_34_hx711.ino index 7e9b7ff30..e46f1d445 100644 --- a/sonoff/xsns_34_hx711.ino +++ b/sonoff/xsns_34_hx711.ino @@ -215,6 +215,11 @@ bool HxCommand() /*********************************************************************************************/ +long HxWeight() +{ + return (hx_calibrate_step < HX_CAL_FAIL) ? hx_weight : 0; +} + void HxInit() { hx_type = 0;