From 43af63b85d12815427ea24b52e2e1208a2747779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 8 Apr 2018 15:47:50 +0200 Subject: [PATCH 01/23] Fix deploy branch check --- README.md | 6 +++--- code/build.sh | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7ed0c8b9..1cc28569 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. [![version](https://img.shields.io/badge/version-1.12.5-brightgreen.svg)](CHANGELOG.md) -![branch](https://img.shields.io/badge/branch-dev-orange.svg) -[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) -[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) +![branch](https://img.shields.io/badge/branch-master-orange.svg) +[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=master)](https://travis-ci.org/xoseperez/espurna) +[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/master.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) [![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest) diff --git a/code/build.sh b/code/build.sh index 6e6dcaf0..a6109d0b 100755 --- a/code/build.sh +++ b/code/build.sh @@ -26,7 +26,8 @@ if [ $# -eq 0 ]; then # Hook to build travis test envs if [[ "${TRAVIS_BRANCH}" != "" ]]; then - if [[ ${TRAVIS_BRANCH} != "master" ]]; then + re='^[0-9]+\.[0-9]+\.[0-9]+$' + if ! [[ ${TRAVIS_BRANCH} =~ $re ]]; then environments=$travis fi fi From 91e25ea8ae34571383f49f82c77fe9e3677316bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 18 Apr 2018 13:35:47 +0200 Subject: [PATCH 02/23] Decouple Serial object from SerialInjector (#787) --- code/espurna/debug.ino | 14 ++++++++- code/espurna/espurna.ino | 7 ++++- code/espurna/libs/StreamInjector.h | 50 ++++++++++++++++-------------- code/espurna/settings.ino | 43 ++++++++++++------------- code/espurna/system.ino | 7 ----- 5 files changed, 65 insertions(+), 56 deletions(-) diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index f442ab56..e7659693 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -119,7 +119,7 @@ void debugSend_P(PGM_P format_P, ...) { #if DEBUG_WEB_SUPPORT -void debugSetup() { +void debugWebSetup() { wsOnSendRegister([](JsonObject& root) { root["dbgVisible"] = 1; @@ -145,6 +145,17 @@ void debugSetup() { #endif // DEBUG_WEB_SUPPORT +void debugSetup() { + + #if DEBUG_SERIAL_SUPPORT + DEBUG_PORT.begin(SERIAL_BAUDRATE); + #if DEBUG_ESP_WIFI + DEBUG_PORT.setDebugOutput(true); + #endif + #endif + +} + // ----------------------------------------------------------------------------- // Save crash info // Taken from krzychb EspSaveCrash @@ -274,4 +285,5 @@ void debugDumpCrashInfo() { DEBUG_MSG_P(PSTR("<< writeCallback; - StreamInjector(Stream& serial, size_t buflen = 128) : _stream(serial), _buffer_size(buflen) { + StreamInjector(size_t buflen = 128) : _buffer_size(buflen) { _buffer = new char[buflen]; } @@ -20,28 +20,42 @@ class StreamInjector : public Stream { delete[] _buffer; } + // --------------------------------------------------------------------- + + virtual uint8_t inject(char ch) { + _buffer[_buffer_write] = ch; + _buffer_write = (_buffer_write + 1) % _buffer_size; + return 1; + } + + virtual uint8_t inject(char *data, size_t len) { + for (int i=0; i _buffer_write) { bytes += (_buffer_write - _buffer_read + _buffer_size); } else if (_buffer_read < _buffer_write) { @@ -51,35 +65,23 @@ class StreamInjector : public Stream { } virtual int peek() { - int ch = _stream.peek(); - if (ch == -1) { - if (_buffer_read != _buffer_write) { - ch = _buffer[_buffer_read]; - } + int ch = -1; + if (_buffer_read != _buffer_write) { + ch = _buffer[_buffer_read]; } return ch; } virtual void flush() { - _stream.flush(); _buffer_read = _buffer_write; } - virtual void inject(char *data, size_t len) { - for (int i=0; i #include #include "libs/EmbedisWrap.h" #include +#include "libs/StreamInjector.h" -#ifdef DEBUG_PORT - #define EMBEDIS_PORT DEBUG_PORT -#else - #define EMBEDIS_PORT Serial -#endif - -#if TELNET_SUPPORT - #include "libs/StreamInjector.h" - StreamInjector _serial = StreamInjector(EMBEDIS_PORT, TERMINAL_BUFFER_SIZE); - #undef EMBEDIS_PORT - #define EMBEDIS_PORT _serial -#endif - -EmbedisWrap embedis(EMBEDIS_PORT, TERMINAL_BUFFER_SIZE); +StreamInjector _serial = StreamInjector(TERMINAL_BUFFER_SIZE); +EmbedisWrap embedis(_serial, TERMINAL_BUFFER_SIZE); #if TERMINAL_SUPPORT #if SERIAL_RX_ENABLED @@ -360,11 +349,9 @@ void resetSettings() { // Settings // ----------------------------------------------------------------------------- -#if TELNET_SUPPORT - void settingsInject(void *data, size_t len) { - _serial.inject((char *) data, len); - } -#endif +void settingsInject(void *data, size_t len) { + _serial.inject((char *) data, len); +} size_t settingsMaxSize() { size_t size = EEPROM_SIZE; @@ -420,11 +407,14 @@ void settingsSetup() { EEPROM.begin(SPI_FLASH_SEC_SIZE); - #if TELNET_SUPPORT - _serial.callback([](uint8_t ch) { + _serial.callback([](uint8_t ch) { + #if TELNET_SUPPORT telnetWrite(ch); - }); - #endif + #endif + #if DEBUG_SERIAL_SUPPORT + DEBUG_PORT.write(ch); + #endif + }); Embedis::dictionary( F("EEPROM"), SPI_FLASH_SEC_SIZE, @@ -457,8 +447,15 @@ void settingsLoop() { _settings_save = false; } + #if TERMINAL_SUPPORT + #if DEBUG_SERIAL_SUPPORT + while (DEBUG_PORT.available()) { + _serial.inject(DEBUG_PORT.read()); + } + #endif + embedis.process(); #if SERIAL_RX_ENABLED diff --git a/code/espurna/system.ino b/code/espurna/system.ino index e6b5b9c5..fb1d1ed0 100644 --- a/code/espurna/system.ino +++ b/code/espurna/system.ino @@ -150,13 +150,6 @@ void systemSetup() { EEPROM.begin(EEPROM_SIZE); - #if DEBUG_SERIAL_SUPPORT - DEBUG_PORT.begin(SERIAL_BAUDRATE); - #if DEBUG_ESP_WIFI - DEBUG_PORT.setDebugOutput(true); - #endif - #endif - #if SPIFFS_SUPPORT SPIFFS.begin(); #endif From 88b25a4d5c41febe4e5783f465d3082108a06bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 18 Apr 2018 13:52:54 +0200 Subject: [PATCH 03/23] StreamInjector header --- code/espurna/libs/StreamInjector.h | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/code/espurna/libs/StreamInjector.h b/code/espurna/libs/StreamInjector.h index a86e4d25..c9377c98 100644 --- a/code/espurna/libs/StreamInjector.h +++ b/code/espurna/libs/StreamInjector.h @@ -1,6 +1,23 @@ -// ----------------------------------------------------------------------------- -// Stream Injector -// ----------------------------------------------------------------------------- +/* + +StreamInjector + +Copyright (C) 2016-2018 by Xose Pérez + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +*/ #pragma once @@ -35,12 +52,12 @@ class StreamInjector : public Stream { return len; } - // --------------------------------------------------------------------- - virtual void callback(writeCallback c) { _callback = c; } + // --------------------------------------------------------------------- + virtual size_t write(uint8_t ch) { if (_callback) _callback(ch); } From 7de6363644846a4f1438ab4bd57821ba7b498905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 18 Apr 2018 14:05:51 +0200 Subject: [PATCH 04/23] Reenable terminal support on RFBRIDGE,STM32,S31 and DUAL --- code/espurna/config/hardware.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 4f49e73f..b484bd3e 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -388,7 +388,6 @@ #define RELAY_PROVIDER RELAY_PROVIDER_DUAL #define DUMMY_RELAY_COUNT 2 #define DEBUG_SERIAL_SUPPORT 0 - #define TERMINAL_SUPPORT 0 // Buttons #define BUTTON3_RELAY 1 @@ -608,7 +607,6 @@ #endif // Remove UART noise on serial line - #define TERMINAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0 // Buttons @@ -789,7 +787,6 @@ #define LED1_PIN_INVERSE 1 // Disable UART noise - #define TERMINAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0 // CSE7766 @@ -1552,10 +1549,8 @@ #define RELAY_PROVIDER RELAY_PROVIDER_STM // Remove UART noise on serial line - #define TERMINAL_SUPPORT 0 #define DEBUG_SERIAL_SUPPORT 0 - #define SERIAL_BAUDRATE 115200 - + // ----------------------------------------------------------------------------- // Tonbux Powerstrip02 // ----------------------------------------------------------------------------- From e06b0c6edffb63f18a0f2b2ea97570a63f7f90c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 19 Apr 2018 11:19:11 +0200 Subject: [PATCH 05/23] Update ESPSoftwareSerial library --- code/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/platformio.ini b/code/platformio.ini index a103cbaa..d0088d3f 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -50,7 +50,7 @@ lib_deps = Brzo I2C https://bitbucket.org/xoseperez/debounceevent.git#2.0.1 Embedis - https://github.com/plerup/espsoftwareserial#7077979 + https://github.com/plerup/espsoftwareserial#3.4.1 https://github.com/me-no-dev/ESPAsyncTCP#55cd520 https://github.com/me-no-dev/ESPAsyncWebServer#232b87a https://bitbucket.org/xoseperez/fauxmoesp.git#2.4.2 From b5b534877fa2a51f48fdec72092f7c8d6bf9be9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 19 Apr 2018 11:23:18 +0200 Subject: [PATCH 06/23] Added CSE7766 to travis tests --- code/espurna/config/hardware.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index b484bd3e..28486dbe 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1995,11 +1995,11 @@ #define MANUFACTURER "TravisCI" #define DEVICE "Virtual board 02" - // A bit of DHT - pin 1 - #ifndef DHT_SUPPORT - #define DHT_SUPPORT 1 + // A bit of CSE7766 - pin 1 + #ifndef CSE7766_SUPPORT + #define CSE7766_SUPPORT 1 #endif - #define DHT_PIN 1 + #define CSE7766_PIN 1 // Relay type dual - pins 2,3 #define RELAY_PROVIDER RELAY_PROVIDER_DUAL @@ -2013,6 +2013,12 @@ #define IR_PIN 4 #define IR_BUTTON_SET 1 + // A bit of DHT - pin 5 + #ifndef DHT_SUPPORT + #define DHT_SUPPORT 1 + #endif + #define DHT_PIN 5 + #elif defined(TRAVIS03) // Relay provider light/my92XX From 08241d0e1b6b2a47a59d3247241c30770164abb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Thu, 19 Apr 2018 17:22:05 +0200 Subject: [PATCH 07/23] Cleanup sensors and travis environments --- code/espurna/config/arduino.h | 4 +++ code/espurna/config/hardware.h | 36 ++++++++++++++++++++ code/espurna/config/sensors.h | 47 +++++++++++++++++++------- code/espurna/sensor.ino | 32 +++++++++--------- code/espurna/sensors/GUVAS12SDSensor.h | 2 +- code/espurna/utils.ino | 6 ++++ 6 files changed, 98 insertions(+), 29 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index d995139a..d573c59b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -87,6 +87,7 @@ //#define DEBUG_SERIAL_SUPPORT 0 //#define DEBUG_TELNET_SUPPORT 0 //#define DEBUG_UDP_SUPPORT 1 +//#define DEBUG_WEB_SUPPORT 0 //#define DOMOTICZ_SUPPORT 0 //#define HOMEASSISTANT_SUPPORT 0 //#define I2C_SUPPORT 1 @@ -117,6 +118,7 @@ //#define ANALOG_SUPPORT 1 //#define BH1750_SUPPORT 1 //#define BMX280_SUPPORT 1 +//#define CSE7766_SUPPORT 1 //#define DALLAS_SUPPORT 1 //#define DHT_SUPPORT 1 //#define DIGITAL_SUPPORT 1 @@ -126,10 +128,12 @@ //#define EMON_ANALOG_SUPPORT 1 //#define EVENTS_SUPPORT 1 //#define GUVAS12SD_SUPPORT 1 +//#define HCSR04_SUPPORT 1 //#define HLW8012_SUPPORT 1 //#define MHZ19_SUPPORT 1 //#define PMSX003_SUPPORT 1 //#define PZEM004T_SUPPORT 1 //#define SHT3X_I2C_SUPPORT 1 //#define SI7021_SUPPORT 1 +//#define TMP3X_SUPPORT 1 //#define V9261F_SUPPORT 1 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 28486dbe..08d6cb83 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1950,6 +1950,7 @@ // We got silk sensor, velvet sensor, naugahyde sensor. We even got horse sensor, dog sensor, chicken sensor. // C'mon, you want sensor, come on in sensor lovers! // If we don’t got it, you don't want it! + #define AM2320_SUPPORT 1 #define BH1750_SUPPORT 1 #define BMX280_SUPPORT 1 #define SHT3X_I2C_SUPPORT 1 @@ -2019,6 +2020,36 @@ #endif #define DHT_PIN 5 + // A bit of TMP3X (analog) + #define TMP3X_SUPPORT 1 + + // A bit of EVENTS - pin 10 + #define EVENTS_SUPPORT 1 + #define EVENTS_PIN 6 + + // HC-RS04 + #define HCSR04_SUPPORT 1 + #define HCSR04_TRIGGER 7 + #define HCSR04_ECHO 8 + + // MHZ19 + #define MHZ19_SUPPORT 1 + #define MHZ19_RX_PIN 9 + #define MHZ19_TX_PIN 10 + + // PZEM004T + #define PZEM004T_SUPPORT 0 // not working? + #define PZEM004T_RX_PIN 11 + #define PZEM004T_TX_PIN 12 + + // V9261F + #define V9261F_SUPPORT 1 + #define V9261F_PIN 13 + + // GUVAS12SD + #define GUVAS12SD_SUPPORT 1 + #define GUVAS12SD_PIN 14 + #elif defined(TRAVIS03) // Relay provider light/my92XX @@ -2037,6 +2068,11 @@ #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT #define MY92XX_MAPPING 4, 3, 5, 0, 1 + // A bit of Analog EMON (analog) + #ifndef EMON_ANALOG_SUPPORT + #define EMON_ANALOG_SUPPORT 1 + #endif + #endif // ----------------------------------------------------------------------------- diff --git a/code/espurna/config/sensors.h b/code/espurna/config/sensors.h index 2d77dfd8..04a0099f 100644 --- a/code/espurna/config/sensors.h +++ b/code/espurna/config/sensors.h @@ -339,8 +339,13 @@ #define MHZ19_SUPPORT 0 #endif +#ifndef MHZ19_RX_PIN #define MHZ19_RX_PIN 13 +#endif + +#ifndef MHZ19_TX_PIN #define MHZ19_TX_PIN 15 +#endif //------------------------------------------------------------------------------ // Particle Monitor based on Plantower PMSX003 @@ -351,8 +356,13 @@ #define PMSX003_SUPPORT 0 #endif +#ifndef PMS_RX_PIN #define PMS_RX_PIN 13 +#endif + +#ifndef PMS_TX_PIN #define PMS_TX_PIN 15 +#endif //------------------------------------------------------------------------------ // PZEM004T based power monitor @@ -475,18 +485,31 @@ // ============================================================================= #ifndef SENSOR_SUPPORT -#if ANALOG_SUPPORT || BH1750_SUPPORT || BMX280_SUPPORT || DALLAS_SUPPORT \ - || DHT_SUPPORT || DIGITAL_SUPPORT || ECH1560_SUPPORT \ - || EMON_ADC121_SUPPORT || EMON_ADS1X15_SUPPORT \ - || EMON_ANALOG_SUPPORT || EVENTS_SUPPORT || HLW8012_SUPPORT \ - || MHZ19_SUPPORT || PMSX003_SUPPORT || SHT3X_I2C_SUPPORT \ - || SI7021_SUPPORT || V9261F_SUPPORT || AM2320_SUPPORT \ - || GUVAS12SD_SUPPORT || CSE7766_SUPPORT || TMP3X_SUPPORT \ - || HCSR04_SUPPORT -#define SENSOR_SUPPORT 1 -#else -#define SENSOR_SUPPORT 0 -#endif +#define SENSOR_SUPPORT ( \ + AM2320_SUPPORT || \ + ANALOG_SUPPORT || \ + BH1750_SUPPORT || \ + BMX280_SUPPORT || \ + CSE7766_SUPPORT || \ + DALLAS_SUPPORT || \ + DHT_SUPPORT || \ + DIGITAL_SUPPORT || \ + ECH1560_SUPPORT || \ + EMON_ADC121_SUPPORT || \ + EMON_ADS1X15_SUPPORT || \ + EMON_ANALOG_SUPPORT || \ + EVENTS_SUPPORT || \ + GUVAS12SD_SUPPORT || \ + HCSR04_SUPPORT || \ + HLW8012_SUPPORT || \ + MHZ19_SUPPORT || \ + PMSX003_SUPPORT || \ + PZEM004T_SUPPORT || \ + SHT3X_I2C_SUPPORT || \ + SI7021_SUPPORT || \ + TMP3X_SUPPORT || \ + V9261F_SUPPORT \ +) #endif // ----------------------------------------------------------------------------- diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index 22f9b739..1f48cbf3 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -310,6 +310,14 @@ void _sensorLoad() { */ + #if AM2320_SUPPORT + { + AM2320Sensor * sensor = new AM2320Sensor(); + sensor->setAddress(AM2320_ADDRESS); + _sensors.push_back(sensor); + } + #endif + #if ANALOG_SUPPORT { AnalogSensor * sensor = new AnalogSensor(); @@ -440,6 +448,14 @@ void _sensorLoad() { } #endif + #if GUVAS12SD_SUPPORT + { + GUVAS12SDSensor * sensor = new GUVAS12SDSensor(); + sensor->setGPIO(GUVAS12SD_PIN); + _sensors.push_back(sensor); + } + #endif + #if HCSR04_SUPPORT { HCSR04Sensor * sensor = new HCSR04Sensor(); @@ -524,22 +540,6 @@ void _sensorLoad() { } #endif - #if AM2320_SUPPORT - { - AM2320Sensor * sensor = new AM2320Sensor(); - sensor->setAddress(AM2320_ADDRESS); - _sensors.push_back(sensor); - } - #endif - - #if GUVAS12SD_SUPPORT - { - GUVAS12SDSensor * sensor = new GUVAS12SDSensor(); - sensor->setGPIO(GUVAS12SD_PIN); - _sensors.push_back(sensor); - } - #endif - } void _sensorCallback(unsigned char i, unsigned char type, const char * payload) { diff --git a/code/espurna/sensors/GUVAS12SDSensor.h b/code/espurna/sensors/GUVAS12SDSensor.h index 1a0ee3ee..f188b2b3 100644 --- a/code/espurna/sensors/GUVAS12SDSensor.h +++ b/code/espurna/sensors/GUVAS12SDSensor.h @@ -122,6 +122,7 @@ class GUVAS12SDSensor : public BaseSensor { // --------------------------------------------------------------------- void _read() { + int _average = 0; #if UV_SAMPLE_RATE == 1 @@ -161,7 +162,6 @@ class GUVAS12SDSensor : public BaseSensor { _uvindex = 10; } - return _uvindex; } unsigned char _gpio = GPIO_NONE; diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index cd878831..56b9e88d 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -386,6 +386,9 @@ void info() { #if GUVAS12SD_SUPPORT DEBUG_MSG_P(PSTR(" GUVAS12SD")); #endif + #if HCSR04_SUPPORT + DEBUG_MSG_P(PSTR(" HCSR04")); + #endif #if HLW8012_SUPPORT DEBUG_MSG_P(PSTR(" HLW8012")); #endif @@ -404,6 +407,9 @@ void info() { #if SI7021_SUPPORT DEBUG_MSG_P(PSTR(" SI7021")); #endif + #if TMP3X_SUPPORT + DEBUG_MSG_P(PSTR(" TMP3X")); + #endif #if V9261F_SUPPORT DEBUG_MSG_P(PSTR(" V9261F")); #endif From cf2b1d678889eef6b6f755e6817449fff0b5ab6f Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 22 Apr 2018 08:58:37 +0300 Subject: [PATCH 08/23] Use python from PATH --- pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-commit b/pre-commit index 90640b70..00a1b221 100755 --- a/pre-commit +++ b/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """ Referencing current branch in github README.md [1] From 4b135ed65b4a2bb775554e1212bc56c7aa2b2c00 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 22 Apr 2018 09:00:42 +0300 Subject: [PATCH 09/23] Make branch shield clickable --- README.md | 2 +- pre-commit | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6dc1d4b8..2eb670c9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. [![version](https://img.shields.io/badge/version-1.12.6a-brightgreen.svg)](CHANGELOG.md) -![branch](https://img.shields.io/badge/branch-dev-orange.svg) +[![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.com/xoseperez/espurna/tree/dev/) [![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) [![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) [![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE) diff --git a/pre-commit b/pre-commit index 00a1b221..2fa07a7e 100755 --- a/pre-commit +++ b/pre-commit @@ -41,7 +41,10 @@ version = "[![version](https://img.shields.io/badge/version-{VERSION}-brightgree VERSION = VERSION ) -branch = "![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)\n".format( +branch = "[![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)] " + "(https://github.com/{USER}/{REPO}/tree/{BRANCH}/)\n".format( + USER = USER, + REPO = REPO, BRANCH = BRANCH ) From 180ff97916aae73c28bd30b978e01b41b084bac8 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 22 Apr 2018 09:01:59 +0300 Subject: [PATCH 10/23] Reworked pre-commit hook - Fix cwd assumptions, pre-commit always starts at the repo base - Fix subprocess calls for python3 - Extract repository info from 'git config' - Refactored into separate functions and __main__ part - Use fileinput module to modify README --- pre-commit | 171 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 110 insertions(+), 61 deletions(-) diff --git a/pre-commit b/pre-commit index 2fa07a7e..48ccb8e7 100755 --- a/pre-commit +++ b/pre-commit @@ -13,68 +13,117 @@ Travis badge with the current branch. Based on [4]. Copy this file to .git/hooks/ """ +from __future__ import print_function import os import sys import re -import subprocess - -BASE = os.path.dirname(os.path.realpath(__file__)) + "/../../" -README = BASE + "README.md" -remote = subprocess.check_output(["git", "remote", "-v"]).strip().split('\n')[0] -parts = re.split('[/\.: ]', remote) -REPO = parts[ len(parts) - 3] -USER = parts[ len(parts) - 4] -BRANCH = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip() - -def getVersion(): - file_name = BASE + "code/espurna/config/version.h" - lines = open(file_name).readlines() - for line in lines: - if "APP_VERSION" in line: - parts = line.split('"') - return parts[1] - return "unknown" -VERSION = getVersion() - -version = "[![version](https://img.shields.io/badge/version-{VERSION}-brightgreen.svg)](CHANGELOG.md)\n".format( - VERSION = VERSION -) - -branch = "[![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)] " - "(https://github.com/{USER}/{REPO}/tree/{BRANCH}/)\n".format( - USER = USER, - REPO = REPO, - BRANCH = BRANCH -) - -travis = "[![travis](https://travis-ci.org/{USER}/{REPO}.svg?branch={BRANCH})]" \ - "(https://travis-ci.org/{USER}/{REPO})\n".format( - USER = USER, - REPO = REPO, - BRANCH = BRANCH -) - -codacy = "[![codacy](https://img.shields.io/codacy/grade/{HASH}/{BRANCH}.svg)]" \ - "(https://www.codacy.com/app/{USER}/{REPO}/dashboard)\n".format( - HASH = "c9496e25cf07434cba786b462cb15f49", - USER = USER, - REPO = REPO, - BRANCH = BRANCH -) - -lines = open(README).readlines() -with open(README, "w") as fh: - for line in lines: - if "![travis]" in line: - fh.write(travis) - elif "![version]" in line: - fh.write(version) - elif "![branch]" in line: - fh.write(branch) - elif "![codacy]" in line: - fh.write(codacy) - else: - fh.write(line) - -subprocess.check_output(["git", "add", README ]) + +from subprocess import call, check_output +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse + +from fileinput import FileInput +# https://github.com/python/cpython/commit/6cb7b659#diff-78790b53ff259619377058acd4f74672 +if sys.version_info[0] < 3: + class FileInputCtx(FileInput): + def __enter__(self): + return self + + def __exit__(self, type, value, traceback): + self.close() + + FileInput = FileInputCtx + + +def run(cmd, cwd=None): + out = check_output(cmd, cwd=cwd) + out = out.decode("latin1").strip() + + return out + + +def parse_h_string(define, r_quotes=re.compile("\"(.*)\"")): + string = r_quotes.search(define).group(1) + return string + + +def git_parse_remote(cwd=None, remote="origin"): + remote_url = run([ + "git", "config", "--local", + "--get", "remote.{}.url".format(remote)], cwd) + + if remote_url.startswith("git"): + _, _, repo = remote_url.partition(":") + path = repo.replace(".git", "") + elif remote_url.startswith("https"): + parsed = urlparse(remote_url) + path = parsed.path[1:] + return path.split("/") + + +def git_branch(cwd=None): + return run(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd) + + +def espurna_get_version(base, version_h="code/espurna/config/version.h"): + version = "unknown" + + path = os.path.join(base, version_h) + with open(path, "r") as version_f: + for line in version_f: + if line.startswith("#define") and "APP_VERSION" in line: + version = parse_h_string(line) + break + + return version + + +SHIELD_TRAVIS = "[![travis](https://travis-ci.org/{USER}/{REPO}.svg?branch={BRANCH})]" \ + "(https://travis-ci.org/{USER}/{REPO})" + +SHIELD_VERSION = "[![version](https://img.shields.io/badge/version-{VERSION}-brightgreen.svg)](CHANGELOG.md)" + +SHIELD_BRANCH = "[![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)]" \ + "(https://github.org/{USER}/{REPO}/tree/{BRANCH}/)" + +SHIELD_CODACY = "[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/{BRANCH}.svg)]" \ + "(https://www.codacy.com/app/{USER}/{REPO}/dashboard)" + +README = "README.md" + + +if __name__ == "__main__": + base = os.getcwd() + + user, repo = git_parse_remote() + template = { + "USER": user, + "REPO": repo, + "BRANCH": git_branch(), + "VERSION": espurna_get_version(base) + } + + shield_travis = SHIELD_TRAVIS.format(**template) + shield_version = SHIELD_VERSION.format(**template) + shield_branch = SHIELD_BRANCH.format(**template) + shield_codacy = SHIELD_CODACY.format(**template) + + path = os.path.join(base, README) + + with FileInput(path, inplace=True) as readme: + for line in readme: + if "![travis]" in line: + print(shield_travis) + elif "![version]" in line: + print(shield_version) + elif "![branch]" in line: + print(shield_branch) + elif "![codacy]" in line: + print(shield_codacy) + else: + print(line, end="") + + sys.exit(call(["git", "add", README], cwd=base)) From 5ae00f992d56530a76df4be03df610c90f8d9d0c Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 22 Apr 2018 13:35:39 +0300 Subject: [PATCH 11/23] Never print newline --- pre-commit | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/pre-commit b/pre-commit index 48ccb8e7..c79b9ec1 100755 --- a/pre-commit +++ b/pre-commit @@ -80,17 +80,15 @@ def espurna_get_version(base, version_h="code/espurna/config/version.h"): return version - -SHIELD_TRAVIS = "[![travis](https://travis-ci.org/{USER}/{REPO}.svg?branch={BRANCH})]" \ - "(https://travis-ci.org/{USER}/{REPO})" - -SHIELD_VERSION = "[![version](https://img.shields.io/badge/version-{VERSION}-brightgreen.svg)](CHANGELOG.md)" - -SHIELD_BRANCH = "[![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)]" \ - "(https://github.org/{USER}/{REPO}/tree/{BRANCH}/)" - -SHIELD_CODACY = "[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/{BRANCH}.svg)]" \ - "(https://www.codacy.com/app/{USER}/{REPO}/dashboard)" +TEMPLATES = { + "![travis]": "[![travis](https://travis-ci.org/{USER}/{REPO}.svg?branch={BRANCH})]" \ + "(https://travis-ci.org/{USER}/{REPO})\n", + "![version]": "[![version](https://img.shields.io/badge/version-{VERSION}-brightgreen.svg)](CHANGELOG.md)\n", + "![branch]": "[![branch](https://img.shields.io/badge/branch-{BRANCH}-orange.svg)]" \ + "(https://github.org/{USER}/{REPO}/tree/{BRANCH}/)\n", + "![codacy]": "[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/{BRANCH}.svg)]" \ + "(https://www.codacy.com/app/{USER}/{REPO}/dashboard)\n" +} README = "README.md" @@ -99,31 +97,28 @@ if __name__ == "__main__": base = os.getcwd() user, repo = git_parse_remote() - template = { + fmt = { "USER": user, "REPO": repo, "BRANCH": git_branch(), "VERSION": espurna_get_version(base) } + templates = [ + (k, tmpl.format(**fmt)) + for k, tmpl in TEMPLATES.items() + ] + + def fmt_line(line): + for match, tmpl in templates: + if match in line: + return tmpl - shield_travis = SHIELD_TRAVIS.format(**template) - shield_version = SHIELD_VERSION.format(**template) - shield_branch = SHIELD_BRANCH.format(**template) - shield_codacy = SHIELD_CODACY.format(**template) + return line path = os.path.join(base, README) with FileInput(path, inplace=True) as readme: for line in readme: - if "![travis]" in line: - print(shield_travis) - elif "![version]" in line: - print(shield_version) - elif "![branch]" in line: - print(shield_branch) - elif "![codacy]" in line: - print(shield_codacy) - else: - print(line, end="") - - sys.exit(call(["git", "add", README], cwd=base)) + print(fmt_line(line), end='') + + sys.exit(call(["git", "add", README])) From 4bd75cd526c3c387376a1cf9dcba2371dcaeeb60 Mon Sep 17 00:00:00 2001 From: wildwiz Date: Sun, 22 Apr 2018 14:22:06 +0200 Subject: [PATCH 12/23] support for zhilde ZLD-EU44-W power strip --- code/espurna/config/hardware.h | 31 +++++++++++++++++++++++++++++++ code/platformio.ini | 27 +++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 0f202cc9..9cdc9cd1 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1797,6 +1797,37 @@ #define LED1_PIN 12 // D6 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// Zhilde ZLD-EU44-W +// http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html +// ----------------------------------------------------------------------------- + +#elif defined(ZHILDE_EU44_W) + + // Info + #define MANUFACTURER "ZHILDE" + #define DEVICE "ZLD_EU44_W" + + // Buttons + #define BUTTON1_PIN 3 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + + // Relays + #define RELAY1_PIN 5 + #define RELAY2_PIN 4 + #define RELAY3_PIN 12 + #define RELAY4_PIN 13 + #define RELAY5_PIN 14 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define RELAY3_TYPE RELAY_TYPE_NORMAL + #define RELAY4_TYPE RELAY_TYPE_NORMAL + #define RELAY5_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 1 + #define LED1_PIN_INVERSE 1 + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index 0d1dd602..9574728c 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1747,6 +1747,33 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +# ------------------------------------------------------------------------------ + +[env:zhilde-eu44-w] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DZHILDE_EU44_W +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:zhilde-eu44-w-ota] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m} -DZHILDE_EU44_W +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + # ------------------------------------------------------------------------------ # GENERIC OTA ENVIRONMENTS # ------------------------------------------------------------------------------ From 072c491da6386654905b710e48b41e998b3a5cac Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Sun, 22 Apr 2018 22:45:32 +0300 Subject: [PATCH 13/23] Use wrapped stdout directly --- pre-commit | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pre-commit b/pre-commit index c79b9ec1..acc37a69 100755 --- a/pre-commit +++ b/pre-commit @@ -13,7 +13,6 @@ Travis badge with the current branch. Based on [4]. Copy this file to .git/hooks/ """ -from __future__ import print_function import os import sys @@ -119,6 +118,6 @@ if __name__ == "__main__": with FileInput(path, inplace=True) as readme: for line in readme: - print(fmt_line(line), end='') + sys.stdout.write(fmt_line(line)) sys.exit(call(["git", "add", README])) From d154540a742eda750ee9db2c57f29352ec88705b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 09:37:52 +0200 Subject: [PATCH 14/23] Changed order in sensors.h --- code/espurna/config/sensors.h | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/code/espurna/config/sensors.h b/code/espurna/config/sensors.h index 04a0099f..5ef65e6b 100644 --- a/code/espurna/config/sensors.h +++ b/code/espurna/config/sensors.h @@ -57,6 +57,19 @@ // Specific data for each sensor // ============================================================================= +//------------------------------------------------------------------------------ +// AM2320 Humidity & Temperature sensor over I2C +// Enable support by passing AM2320_SUPPORT=1 build flag +//------------------------------------------------------------------------------ + +#ifndef AM2320_SUPPORT +#define AM2320_SUPPORT 0 +#endif + +#ifndef AM2320_ADDRESS +#define AM2320_ADDRESS 0x00 // 0x00 means auto +#endif + //------------------------------------------------------------------------------ // Analog sensor // Enable support by passing ANALOG_SUPPORT=1 build flag @@ -274,6 +287,19 @@ #define EVENTS_DEBOUNCE 50 // Do not register events within less than 10 millis +//------------------------------------------------------------------------------ +// GUVAS12SD UV Sensor (analog) +// Enable support by passing GUVAS12SD_SUPPORT=1 build flag +//------------------------------------------------------------------------------ + +#ifndef GUVAS12SD_SUPPORT +#define GUVAS12SD_SUPPORT 0 +#endif + +#ifndef GUVAS12SD_PIN +#define GUVAS12SD_PIN 14 +#endif + //------------------------------------------------------------------------------ // HC-SR04 // Enable support by passing HCSR04_SUPPORT=1 build flag @@ -454,32 +480,6 @@ #define V9261F_POWER_FACTOR 153699.0 #define V9261F_RPOWER_FACTOR V9261F_CURRENT_FACTOR -//------------------------------------------------------------------------------ -// AM2320 Humidity & Temperature sensor over I2C -// Enable support by passing AM2320_SUPPORT=1 build flag -//------------------------------------------------------------------------------ - -#ifndef AM2320_SUPPORT -#define AM2320_SUPPORT 0 -#endif - -#ifndef AM2320_ADDRESS -#define AM2320_ADDRESS 0x00 // 0x00 means auto -#endif - -//------------------------------------------------------------------------------ -// GUVAS12SD UV Sensor (analog) -// Enable support by passing GUVAS12SD_SUPPORT=1 build flag -//------------------------------------------------------------------------------ - -#ifndef GUVAS12SD_SUPPORT -#define GUVAS12SD_SUPPORT 0 -#endif - -#ifndef GUVAS12SD_PIN -#define GUVAS12SD_PIN 14 -#endif - // ============================================================================= // Sensor helpers configuration - can't move to dependencies.h // ============================================================================= From e834867ec6da36f1ec72216bc0032ed3fc38952b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 14:09:32 +0200 Subject: [PATCH 15/23] Ensure scheduler has access to all channels independently of the color mode (#807) --- code/espurna/data/index.html.gz | Bin 65308 -> 65311 bytes code/espurna/static/index.html.gz.h | 1044 +++++++++++++-------------- code/html/custom.js | 6 +- 3 files changed, 526 insertions(+), 524 deletions(-) diff --git a/code/espurna/data/index.html.gz b/code/espurna/data/index.html.gz index 786bce3e73eeca06cba5f15bf2397217b9e86411..32fa570c572277cc5170fc78219f3f0ea0559ee2 100644 GIT binary patch delta 10486 zcmV1F(eFe{n~KDrd$77h~ygXg9=^Q4a}qo!#M^z@6BgOtL!~2ARR{ zr01ib!yv7WYjwc9LM;`qVa7y;YEaG>^I+u~iP{m~m85J{&)_t41!SP}GD#ZSlN^D?!w=1LUvqyz1Iik~EfHHV$KDaSjkyk_LM4Km^aV?ayxwed$6y-uZ z=W0u3Oh&T|P75HI!AJ_)qi~=YC{58unCqjbqEpfjEx0`tyUXMO0bIf%hA%`2!=4FR z6luGoWtJ=$@+hB$f4Y5xgI>o~OH@nPk!es}n`2|Cmqx0<&u`ebYv*%Fx7QAk?M2yZ z06R?#Nb#PY5U;`!>F(m2Av!(~Y9u7y2u#7bkl?Hpz7H{bt`tusfXauS1k&u!H`K4_ z5hn@8?0t)YwAWX9XC?GtaQ2f$Ob+>SSEQuD)o<(~Q=nbGf7q~QEvx#|JiQ3M@N#mz zUhgU31t44{jVv&A28t#d%%;}2=VdS!w_qd#G>xZ@0JFeNT${X^cmNG#s6mfh?-Yv6 zX=myu$K8`nw7y6?8GQ6kHi0#Pk4yO2;*Wcv$UG9-og#i3C#zGU!sOzP78E3*gV+EN z*I4SbIw#fWe@TW#&Nun(L!FLxD=EfC6AxFXk(OC-dI4RScy>qUkye-X`X}1Azx-*> zM#h67zy9C?l`ng0{^^f>;^ENI1(jCZRjw6zB}6OcKHhl`dArqSuXYnIw^9*}h>?-H z{#CpxFHeD|K^MP^qexa*T)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7nxyHwQ93xr9f_fe?hxZv5J&ac9;-D6PYerM@T^F*L{6`4X}0`lZ;yJ zZ09Fsbb5EH#twHLYCapK6fre6eoa&ewU_A{&l5Qk??~s)eY9S;}8G#%tyvgSGd8Zr6A(%}XR{;= zvs{xlO5OHiNGd%6X0oYd-nS9)k^q&1cnbj$axAKsEV@E$Egkyz>&hK^P`0lAcj>}? zM#FA|{h!<;-PzJ#|9lZGf9X72TpOeev6icSncV-u>;(l6%^li7R`ubOUzvtvyy-`wTDdP!($Z4#qn(xyO%T zk1z0XT1^K?Hai}lbTFDsHV@9iq2u(Oj?*$zU5~ywWK`e?Vb~DV~)A+uIl3 zYi~7A*?K7{PfZwKmv0<)4_wwocBjdis>zvG!u|=RmcL@LN-u;~BITAvNs&h>VxW22 zYVO0Vou{rhOguY=y%ij>ws2MXDy}=P-rCDo_8VgtF?`^at=jn#V>LD{*j=kBYCXw| zxDCqIN*jVq=PWXlf3pZIoJA%s6DVsBweYWawfSmZp`2s3gvYf`Vx>8ud;(Ljy#AZl zX80kz9_jZfxvoMPYZb$DsxYj{pV4d8f0ez`zRs zBG10Q88@qK*FKyLR1~JP").attr("value",i).text("Channel #" + i)); - } } From 427aebe8a756ce57fcdab9dc7f5b8bda7fa5d5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 14:11:08 +0200 Subject: [PATCH 16/23] Fix AM2302 sensor --- code/espurna/config/prototypes.h | 1 + code/espurna/sensors/AM2320Sensor.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/prototypes.h b/code/espurna/config/prototypes.h index ba8e0723..a9316d74 100644 --- a/code/espurna/config/prototypes.h +++ b/code/espurna/config/prototypes.h @@ -77,6 +77,7 @@ bool i2cGetLock(unsigned char address); bool i2cReleaseLock(unsigned char address); unsigned char i2cFindAndLock(size_t size, unsigned char * addresses); +void i2c_wakeup(uint8_t address); uint8_t i2c_write_buffer(uint8_t address, uint8_t * buffer, size_t len); uint8_t i2c_write_uint8(uint8_t address, uint8_t value); uint8_t i2c_write_uint8(uint8_t address, uint8_t reg, uint8_t value); diff --git a/code/espurna/sensors/AM2320Sensor.h b/code/espurna/sensors/AM2320Sensor.h index 656be183..5acea0b6 100644 --- a/code/espurna/sensors/AM2320Sensor.h +++ b/code/espurna/sensors/AM2320Sensor.h @@ -120,7 +120,9 @@ class AM2320Sensor : public I2CSensor { */ void _read() { + i2c_wakeup(); + // waiting time of at least 800 μs, the maximum 3000 μs delayMicroseconds(800); // just to be on safe side @@ -128,7 +130,7 @@ class AM2320Sensor : public I2CSensor { // 4 = number of bytes to read if (i2c_write_uint8(_address, AM2320_I2C_READ_REGISTER_DATA, 0x00, 4) != I2C_TRANS_SUCCESS) { _error = SENSOR_ERROR_TIMEOUT; - return false; + return; } unsigned char _buffer[8]; From b233f61da1413e753a95b626e1d3398236636234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 14:19:09 +0200 Subject: [PATCH 17/23] Fix AM2302 sensor --- code/espurna/sensors/AM2320Sensor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/espurna/sensors/AM2320Sensor.h b/code/espurna/sensors/AM2320Sensor.h index 5acea0b6..586279a8 100644 --- a/code/espurna/sensors/AM2320Sensor.h +++ b/code/espurna/sensors/AM2320Sensor.h @@ -101,7 +101,7 @@ class AM2320Sensor : public I2CSensor { // Get device model, version, device_id void _init() { - i2c_wakeup(); + i2c_wakeup(address); delayMicroseconds(800); unsigned char _buffer[11]; @@ -121,7 +121,7 @@ class AM2320Sensor : public I2CSensor { void _read() { - i2c_wakeup(); + i2c_wakeup(address); // waiting time of at least 800 μs, the maximum 3000 μs delayMicroseconds(800); // just to be on safe side From 17e838206ffcd5f581db656ff25c6b038605a518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 14:30:58 +0200 Subject: [PATCH 18/23] Fix AM2302 sensor --- code/espurna/sensors/AM2320Sensor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/espurna/sensors/AM2320Sensor.h b/code/espurna/sensors/AM2320Sensor.h index 586279a8..80924bf3 100644 --- a/code/espurna/sensors/AM2320Sensor.h +++ b/code/espurna/sensors/AM2320Sensor.h @@ -101,7 +101,7 @@ class AM2320Sensor : public I2CSensor { // Get device model, version, device_id void _init() { - i2c_wakeup(address); + i2c_wakeup(_address); delayMicroseconds(800); unsigned char _buffer[11]; @@ -121,7 +121,7 @@ class AM2320Sensor : public I2CSensor { void _read() { - i2c_wakeup(address); + i2c_wakeup(_address); // waiting time of at least 800 μs, the maximum 3000 μs delayMicroseconds(800); // just to be on safe side From 8d06b8fb91bf5582e1532515ed3efc39c3470e7b Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Mon, 23 Apr 2018 19:35:42 +0300 Subject: [PATCH 19/23] Check for NTP_SUPPORT in sensors --- code/espurna/sensor.ino | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index 22f9b739..6bc1b370 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -286,9 +286,11 @@ void _sensorPost() { } void _sensorReset() { - if (ntpSynced()) { - _sensor_energy_reset_ts = String(" (since ") + ntpDateTime() + String(")"); - } + #if NTP_SUPPORT + if (ntpSynced()) { + _sensor_energy_reset_ts = String(" (since ") + ntpDateTime() + String(")"); + } + #endif } // ----------------------------------------------------------------------------- From 7076e0a7644cab9e2af14e53b2610a2e08b6a311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 22:46:25 +0200 Subject: [PATCH 20/23] Update justwifi library --- README.md | 2 +- code/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6dc1d4b8..926b3872 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. [![version](https://img.shields.io/badge/version-1.12.6a-brightgreen.svg)](CHANGELOG.md) -![branch](https://img.shields.io/badge/branch-dev-orange.svg) +[![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.org/xoseperez/espurna/tree/dev/) [![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) [![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) [![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE) diff --git a/code/platformio.ini b/code/platformio.ini index 8b3914c8..35096654 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -56,7 +56,7 @@ lib_deps = https://bitbucket.org/xoseperez/fauxmoesp.git#2.4.2 https://github.com/xoseperez/hlw8012.git#1.1.0 https://github.com/markszabo/IRremoteESP8266#v2.2.0 - https://bitbucket.org/xoseperez/justwifi.git#1.1.7 + https://bitbucket.org/xoseperez/justwifi.git#1.1.8 https://github.com/madpilot/mDNSResolver#4cfcda1 https://github.com/xoseperez/my92xx#3.0.1 https://bitbucket.org/xoseperez/nofuss.git#0.2.5 From 0575a97fb3d73c2a4ad88c1913d066c9e6453e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 22:46:58 +0200 Subject: [PATCH 21/23] Added captive portal when in AP mode --- code/espurna/config/general.h | 8 +++++++- code/espurna/wifi.ino | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index c26533b6..8bebbe4b 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -78,7 +78,7 @@ #define DEBUG_UDP_PORT 514 #endif -// If DEBUG_UDP_PORT is set to 514 syslog format is assumed +// If DEBUG_UDP_PORT is set to 514 syslog format is assumed // (https://tools.ietf.org/html/rfc3164) // DEBUG_UDP_FAC_PRI is the facility+priority #define DEBUG_UDP_FAC_PRI (SYSLOG_LOCAL0 | SYSLOG_DEBUG) @@ -268,7 +268,13 @@ #define WIFI_RECONNECT_INTERVAL 180000 // If could not connect to WIFI, retry after this time in ms #endif +#ifndef WIFI_MAX_NETWORKS #define WIFI_MAX_NETWORKS 5 // Max number of WIFI connection configurations +#endif + +#ifndef WIFI_AP_CAPTIVE +#define WIFI_AP_CAPTIVE 1 // Captive portal enabled when in AP mode +#endif #ifndef WIFI_AP_MODE #define WIFI_AP_MODE AP_MODE_ALONE diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 3b781f7f..554730a7 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -196,6 +196,27 @@ void _wifiInject() { } } +#if WIFI_AP_CAPTIVE + +DNSServer _wifi_dnsServer; + +void _wifiCaptivePortal(justwifi_messages_t code, char * parameter) { + + if (MESSAGE_ACCESSPOINT_CREATED == code) { + _wifi_dnsServer.setErrorReplyCode(DNSReplyCode::NoError); + _wifi_dnsServer.start(53, "*", WiFi.softAPIP()); + DEBUG_MSG_P(PSTR("[WIFI] Captive portal enabled\n")); + } + + if (MESSAGE_CONNECTED == code) { + _wifi_dnsServer.stop(); + DEBUG_MSG_P(PSTR("[WIFI] Captive portal disabled\n")); + } + +} + +#endif // WIFI_AP_CAPTIVE + #if DEBUG_SUPPORT void _wifiDebug(justwifi_messages_t code, char * parameter) { @@ -422,6 +443,9 @@ void wifiSetup() { _wifiConfigure(); // Message callbacks + #if WIFI_AP_CAPTIVE + wifiRegister(_wifiCaptivePortal); + #endif #if DEBUG_SUPPORT wifiRegister(_wifiDebug); #endif @@ -446,6 +470,12 @@ void wifiLoop() { jw.loop(); + #if WIFI_AP_CAPTIVE + if ((WiFi.getMode() & WIFI_AP) == WIFI_AP) { + _wifi_dnsServer.processNextRequest(); + } + #endif + if (_wifi_scan_client_id > 0) { _wifiScan(_wifi_scan_client_id); _wifi_scan_client_id = 0; From 104caa93fa4db6ecc3eaecaf97506d90173471fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 23:27:20 +0200 Subject: [PATCH 22/23] Fix warnings --- code/espurna/api.ino | 4 ++-- code/espurna/button.ino | 1 + code/espurna/config/prototypes.h | 2 +- code/espurna/libs/StreamInjector.h | 3 ++- code/espurna/libs/WebSocketIncommingBuffer.h | 2 +- code/espurna/scheduler.ino | 2 +- code/espurna/settings.ino | 2 +- code/espurna/thinkspeak.ino | 6 +++++- 8 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/espurna/api.ino b/code/espurna/api.ino index ad41988a..58dcf50a 100644 --- a/code/espurna/api.ino +++ b/code/espurna/api.ino @@ -88,11 +88,11 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) { } // Get response from callback - char value[API_BUFFER_SIZE]; + char value[API_BUFFER_SIZE] = {0}; (api.getFn)(value, API_BUFFER_SIZE); // The response will be a 404 NOT FOUND if the resource is not available - if (!value) { + if (0 == value[0]) { DEBUG_MSG_P(PSTR("[API] Sending 404 response\n")); request->send(404); return; diff --git a/code/espurna/button.ino b/code/espurna/button.ino index dd0d3b5b..e85fba43 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -84,6 +84,7 @@ uint8_t mapEvent(uint8_t event, uint8_t count, uint16_t length) { } if (count == 2) return BUTTON_EVENT_DBLCLICK; } + return BUTTON_EVENT_NONE; } void buttonEvent(unsigned int id, unsigned char event) { diff --git a/code/espurna/config/prototypes.h b/code/espurna/config/prototypes.h index a9316d74..2a581218 100644 --- a/code/espurna/config/prototypes.h +++ b/code/espurna/config/prototypes.h @@ -63,7 +63,7 @@ template bool setSetting(const String& key, T value); template bool setSetting(const String& key, unsigned int index, T value); template String getSetting(const String& key, T defaultValue); template String getSetting(const String& key, unsigned int index, T defaultValue); -bool settingsGetJson(JsonObject& data); +void settingsGetJson(JsonObject& data); bool settingsRestoreJson(JsonObject& data); void settingsRegisterCommand(const String& name, void (*call)(Embedis*)); void settingsInject(void *data, size_t len); diff --git a/code/espurna/libs/StreamInjector.h b/code/espurna/libs/StreamInjector.h index c9377c98..03dbd51b 100644 --- a/code/espurna/libs/StreamInjector.h +++ b/code/espurna/libs/StreamInjector.h @@ -46,7 +46,7 @@ class StreamInjector : public Stream { } virtual uint8_t inject(char *data, size_t len) { - for (int i=0; i *_buffer; }; diff --git a/code/espurna/scheduler.ino b/code/espurna/scheduler.ino index adb89579..003a6f69 100644 --- a/code/espurna/scheduler.ino +++ b/code/espurna/scheduler.ino @@ -104,7 +104,7 @@ bool _schIsThisWeekday(time_t t, String weekdays){ char pch; char * p = (char *) weekdays.c_str(); unsigned char position = 0; - while (pch = p[position++]) { + while ((pch = p[position++])) { if ((pch - '0') == w) return true; } return false; diff --git a/code/espurna/settings.ino b/code/espurna/settings.ino index 2e3f7a4b..ce98370a 100644 --- a/code/espurna/settings.ino +++ b/code/espurna/settings.ino @@ -382,7 +382,7 @@ bool settingsRestoreJson(JsonObject& data) { } -bool settingsGetJson(JsonObject& root) { +void settingsGetJson(JsonObject& root) { // Get sorted list of keys std::vector keys = _settingsKeys(); diff --git a/code/espurna/thinkspeak.ino b/code/espurna/thinkspeak.ino index 35ad9a2d..04b0c85c 100644 --- a/code/espurna/thinkspeak.ino +++ b/code/espurna/thinkspeak.ino @@ -192,7 +192,7 @@ void _tspkPost(String data) { #endif // THINGSPEAK_USE_ASYNC -bool _tspkEnqueue(unsigned char index, char * payload) { +void _tspkEnqueue(unsigned char index, char * payload) { DEBUG_MSG_P(PSTR("[THINGSPEAK] Enqueuing field #%d with value %s\n"), index, payload); --index; if (_tspk_queue[index] != NULL) free(_tspk_queue[index]); @@ -230,7 +230,9 @@ bool tspkEnqueueRelay(unsigned char index, unsigned char status) { char payload[3] = {0}; itoa(status ? 1 : 0, payload, 10); _tspkEnqueue(id, payload); + return true; } + return false; } bool tspkEnqueueMeasurement(unsigned char index, char * payload) { @@ -238,7 +240,9 @@ bool tspkEnqueueMeasurement(unsigned char index, char * payload) { unsigned char id = getSetting("tspkMagnitude", index, 0).toInt(); if (id > 0) { _tspkEnqueue(id, payload); + return true; } + return false; } void tspkFlush() { From 3fbd889f137eedf7fe75398f665cc05477ff65bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 23 Apr 2018 23:43:14 +0200 Subject: [PATCH 23/23] Added PIO1.7.0 to platformio.ini file (not working yet) --- code/platformio.ini | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/code/platformio.ini b/code/platformio.ini index 35096654..db3a4034 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -6,13 +6,16 @@ data_dir = espurna/data [common] # ------------------------------------------------------------------------------ # PLATFORM: -# !! DO NOT confuse platformio's Esp8266 development platform with Arduino core for ESP8266 +# !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266 +# We use platformIO 1.5.0 as default # -# we use platformIO 1.5.0 as default -# platform 1.6.0 = arduino core 2.4.0 is required for newer features/boards +# platformIO 1.5.0 = arduino core 2.3.0 +# platformIO 1.6.0 = arduino core 2.4.0 +# platformIO 1.7.0 = arduino core 2.4.1 # ------------------------------------------------------------------------------ platform_150 = espressif8266@1.5.0 platform_160 = espressif8266@1.6.0 +platform_170 = espressif8266@1.7.0 platform = ${common.platform_150} # ------------------------------------------------------------------------------ @@ -26,8 +29,13 @@ debug_flags = -DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP # build flags for 512k/1m ESP's are different because we use Linker Scripts to adjust flash split # 512 KB = 487 KB sketch, 20 KB eeprom # 1 MB = 999 KB sketch, 20 KB eeprom +# +# Available lwIP variants (macros): +# -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH v1.4 Higher Bandwidth (default) +# -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY v2 Lower Memory +# -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH v2 Higher Bandwidth # ------------------------------------------------------------------------------ -build_flags = -g -DMQTT_MAX_PACKET_SIZE=400 ${env.ESPURNA_FLAGS} +build_flags = -g -DMQTT_MAX_PACKET_SIZE=400 ${env.ESPURNA_FLAGS} -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH build_flags_512k = ${common.build_flags} -Wl,-Tesp8266.flash.512k0.ld build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld