Merge pull request #74 from arendst/development

Update from Tasmota
This commit is contained in:
Adrian Scillato 2018-04-29 18:12:00 -03:00 committed by GitHub
commit e7854bb26b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 27 deletions

View File

@ -146,7 +146,7 @@ If you like **Sonoff-Tasmota**, give it a star, or fork it and contribute!
### Development:
[![Build Status](https://img.shields.io/travis/arendst/Sonoff-Tasmota.svg)](https://travis-ci.org/arendst/Sonoff-Tasmota)
Current version is **5.12.0n** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
Current version is **5.12.0o** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
### Quick install
Download one of the released binaries from https://github.com/arendst/Sonoff-Tasmota/releases and flash it to your hardware as documented in the wiki.

View File

@ -1,4 +1,7 @@
/* 5.12.0n
/* 5.12.0o
* Fix Energy Today and Yesterday overflow (#2543)
*
* 5.12.0n
* Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560)
* Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accomodate rules
* Change ADS1115 JSON message from {"ADS1115":{"Analog0":123,"Analog1":123}} to {"ADS1115":{"A0":123,"A1":123}}

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v5.12.0m
* Updated until v5.12.0n
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)
@ -43,7 +43,7 @@
#define D_HOUR_MINUTE_SEPARATOR ":"
#define D_MINUTE_SECOND_SEPARATOR ":"
#define D_DAY3LIST "Po Út St Čt Pá So Ne "
#define D_DAY3LIST "Ne Po Út St Čt Pá So "
#define D_MONTH3LIST "LedÚnoBřeDubKvěČvnČvcSrpZářŘíjLisPro"
// Non JSON decimal separator

View File

@ -1,7 +1,7 @@
/*
el-GR.h - localization for Greek - Greece for Sonoff-Tasmota
Copyright (C) 2018 Harry Kandiloros
Copyright (C) 2018 Kan3Nas
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
@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v5.12.0m
* Updated until v5.12.0n
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)

View File

@ -28,7 +28,7 @@
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
* Use online command Prefix to translate cmnd, stat and tele.
*
* Updated until v5.12.0l
* Updated until v5.12.0n
\*********************************************************************/
//#define LANGUAGE_MODULE_NAME // Enable to display "Module Generic" (ie Spanish), Disable to display "Generic Module" (ie English)

View File

@ -851,7 +851,11 @@ void SettingsDelta()
Settings.knx_CB_registered = 0;
memset(&Settings.knx_physsical_addr, 0x00, 0x800 - 0x6b8); // Reset until 0x800 for future use
}
if (Settings.version < 0x050C000F) {
Settings.energy_kWhtoday /= 1000;
Settings.energy_kWhyesterday /= 1000;
RtcSettings.energy_kWhtoday /= 1000;
}
Settings.version = VERSION;
SettingsSave(1);
}

View File

@ -25,7 +25,7 @@
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
====================================================*/
#define VERSION 0x050C000E // 5.12.0n
#define VERSION 0x050C000F // 5.12.0o
// Location specific includes
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)

View File

@ -1408,7 +1408,7 @@ void AdcEvery50ms()
if ((new_value < adc_last_value -10) || (new_value > adc_last_value +10)) {
adc_last_value = new_value;
uint16_t value = adc_last_value / 10;
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"ANALOG\":{\"A0div10\":%d}}"), (0 == value) ? 1 : (value > 99) ? 100 : value);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"ANALOG\":{\"A0div10\":%d}}"), (value > 99) ? 100 : value);
RulesProcess();
}
}

View File

@ -47,11 +47,12 @@ float energy_voltage = 0; // 123.1 V
float energy_current = 0; // 123.123 A
float energy_power = 0; // 123.1 W
float energy_power_factor = 0; // 0.12
float energy_daily = 0; // 12.123 kWh
float energy_daily = 0; // 123.123 kWh
float energy_total = 0; // 12345.12345 kWh
float energy_start = 0; // 12345.12345 kWh total previous
unsigned long energy_kWhtoday; // 1212312345 Wh * 10^-5 (deca micro Watt hours) - 5763924 = 0.05763924 kWh = 0.058 kWh = energy_daily
unsigned long energy_period = 0; // 1212312345 Wh * 10^-5 (deca micro Watt hours) - 5763924 = 0.05763924 kWh = 0.058 kWh = energy_daily
unsigned long energy_kWhtoday; // 12312312 Wh * 10^-2 (deca milli Watt hours) - 5764 = 0.05764 kWh = 0.058 kWh = energy_daily
unsigned long energy_period = 0; // 12312312 Wh * 10^-2 (deca milli Watt hours) - 5764 = 0.05764 kWh = 0.058 kWh = energy_daily
float energy_power_last[3] = { 0 };
uint8_t energy_power_delta = 0;
@ -82,8 +83,8 @@ Ticker ticker_energy;
void EnergyUpdateToday()
{
RtcSettings.energy_kWhtoday = energy_kWhtoday;
energy_daily = (float)energy_kWhtoday / 100000000;
energy_total = (float)(RtcSettings.energy_kWhtotal + (energy_kWhtoday / 1000)) / 100000;
energy_daily = (float)energy_kWhtoday / 100000;
energy_total = (float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000;
}
/*********************************************************************************************\
@ -156,7 +157,7 @@ void HlwEverySecond()
hlw_len = 10000 / hlw_energy_period_counter;
hlw_energy_period_counter = 0;
if (hlw_len) {
energy_kWhtoday += ((HLW_PREF * Settings.energy_power_calibration) / hlw_len) / 36;
energy_kWhtoday += ((HLW_PREF * Settings.energy_power_calibration) / hlw_len) / 36000;
EnergyUpdateToday();
}
}
@ -390,7 +391,7 @@ void CseEverySecond()
}
if (cf_frequency && energy_power) {
cf_pulses_last_time = cf_pulses;
energy_kWhtoday += (cf_frequency * Settings.energy_power_calibration) / 36;
energy_kWhtoday += (cf_frequency * Settings.energy_power_calibration) / 36000;
EnergyUpdateToday();
}
}
@ -539,7 +540,7 @@ void PzemEvery200ms()
break;
case 4: // Total energy as 99999Wh
if (!energy_start || (value < energy_start)) energy_start = value; // Init after restart and hanlde roll-over if any
energy_kWhtoday += (value - energy_start) * 100000;
energy_kWhtoday += (value - energy_start) * 100;
energy_start = value;
EnergyUpdateToday();
break;
@ -579,7 +580,7 @@ void Energy200ms()
if (RtcTime.valid) {
if (LocalTime() == Midnight()) {
Settings.energy_kWhyesterday = energy_kWhtoday;
Settings.energy_kWhtotal += (energy_kWhtoday / 1000);
Settings.energy_kWhtotal += energy_kWhtoday;
RtcSettings.energy_kWhtotal = Settings.energy_kWhtotal;
energy_kWhtoday = 0;
energy_period = energy_kWhtoday;
@ -851,14 +852,14 @@ boolean EnergyCommand()
if (p != XdrvMailbox.data) {
switch (XdrvMailbox.index) {
case 1:
energy_kWhtoday = lnum *100000;
energy_kWhtoday = lnum *100;
energy_period = energy_kWhtoday;
Settings.energy_kWhtoday = energy_kWhtoday;
RtcSettings.energy_kWhtoday = energy_kWhtoday;
energy_daily = (float)energy_kWhtoday / 100000000;
energy_daily = (float)energy_kWhtoday / 100000;
break;
case 2:
Settings.energy_kWhyesterday = lnum *100000;
Settings.energy_kWhyesterday = lnum *100;
break;
case 3:
RtcSettings.energy_kWhtotal = lnum *100;
@ -869,9 +870,9 @@ boolean EnergyCommand()
char energy_yesterday_chr[10];
char stoday_energy[10];
char energy_total_chr[10];
dtostrfd((float)Settings.energy_kWhyesterday / 100000000, Settings.flag2.energy_resolution, energy_yesterday_chr);
dtostrfd((float)RtcSettings.energy_kWhtoday / 100000000, Settings.flag2.energy_resolution, stoday_energy);
dtostrfd((float)(RtcSettings.energy_kWhtotal + (energy_kWhtoday / 1000)) / 100000, Settings.flag2.energy_resolution, energy_total_chr);
dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr);
dtostrfd((float)RtcSettings.energy_kWhtoday / 100000, Settings.flag2.energy_resolution, stoday_energy);
dtostrfd((float)(RtcSettings.energy_kWhtotal + energy_kWhtoday) / 100000, Settings.flag2.energy_resolution, energy_total_chr);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":{\"" D_JSON_TOTAL "\":%s,\"" D_JSON_YESTERDAY "\":%s,\"" D_JSON_TODAY "\":%s}}"),
command, energy_total_chr, energy_yesterday_chr, stoday_energy);
status_flag = 1;
@ -1073,7 +1074,7 @@ void EnergyShow(boolean json)
float energy = 0;
if (show_energy_period) {
if (energy_period) energy = (float)(energy_kWhtoday - energy_period) / 100000;
if (energy_period) energy = (float)(energy_kWhtoday - energy_period) / 100;
energy_period = energy_kWhtoday;
}
@ -1084,7 +1085,7 @@ void EnergyShow(boolean json)
dtostrfd(energy_voltage, Settings.flag2.voltage_resolution, energy_voltage_chr);
dtostrfd(energy_current, Settings.flag2.current_resolution, energy_current_chr);
dtostrfd(energy_power_factor, 2, energy_power_factor_chr);
dtostrfd((float)Settings.energy_kWhyesterday / 100000000, Settings.flag2.energy_resolution, energy_yesterday_chr);
dtostrfd((float)Settings.energy_kWhyesterday / 100000, Settings.flag2.energy_resolution, energy_yesterday_chr);
if (json) {
snprintf_P(speriod, sizeof(speriod), PSTR(",\"" D_JSON_PERIOD "\":%s"), energy_period_chr);