mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Add command `Sunrise 0..3
` to select sunrise dawn angle
- Bump version to v12.1.1.5 - Add command ``Sunrise 0..3`` to select sunrise dawn angle between Normal, Civil, Nautical or Astronomical (#16795)
This commit is contained in:
parent
40f7cfba4c
commit
5cfbbd4302
16
CHANGELOG.md
16
CHANGELOG.md
@ -3,7 +3,17 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
## [Unreleased] - Development
|
## [Unreleased] - Development
|
||||||
|
|
||||||
## [12.1.1.4]
|
## [12.1.1.5]
|
||||||
|
### Added
|
||||||
|
- Command ``Sunrise 0..3`` to select sunrise dawn angle between Normal, Civil, Nautical or Astronomical (#16795)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
## [12.1.1.4] 20221012
|
||||||
### Added
|
### Added
|
||||||
- Support for Shelly Plus 2PM using template ``{"NAME":"Shelly Plus 2PM PCB v0.1.9","GPIO":[320,0,0,0,32,192,0,0,225,224,0,0,0,0,193,0,0,0,0,0,0,608,640,3458,0,0,0,0,0,9472,0,4736,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"AdcParam1 2,10000,10000,3350"}``
|
- Support for Shelly Plus 2PM using template ``{"NAME":"Shelly Plus 2PM PCB v0.1.9","GPIO":[320,0,0,0,32,192,0,0,225,224,0,0,0,0,193,0,0,0,0,0,0,608,640,3458,0,0,0,0,0,9472,0,4736,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"AdcParam1 2,10000,10000,3350"}``
|
||||||
- Zigbee Alexa/Hue emulation, support multiple switches on separate endpoints (#16718)
|
- Zigbee Alexa/Hue emulation, support multiple switches on separate endpoints (#16718)
|
||||||
@ -16,10 +26,6 @@ All notable changes to this project will be documented in this file.
|
|||||||
- ESP32 LVGL library from v8.3.0 to v8.3.2
|
- ESP32 LVGL library from v8.3.0 to v8.3.2
|
||||||
- Increase serial console fixed input buffer size from 520 to 800
|
- Increase serial console fixed input buffer size from 520 to 800
|
||||||
|
|
||||||
### Fixed
|
|
||||||
|
|
||||||
### Removed
|
|
||||||
|
|
||||||
## [12.1.1.3] 20221003
|
## [12.1.1.3] 20221003
|
||||||
### Added
|
### Added
|
||||||
- ESP32-S2 and ESP32-S3 touch button support
|
- ESP32-S2 and ESP32-S3 touch button support
|
||||||
|
@ -116,11 +116,13 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||||||
- Command ``UrlFetch <url>`` to download a file to filesystem
|
- Command ``UrlFetch <url>`` to download a file to filesystem
|
||||||
- Command ``DspSpeed 2..127`` to control message rotation speed on display of POWR3xxD and THR3xxD
|
- Command ``DspSpeed 2..127`` to control message rotation speed on display of POWR3xxD and THR3xxD
|
||||||
- Command ``DspLine<1|2> <index>,<unit>,<index>,<unit>,...`` to select message(s) on display of POWR3xxD and THR3xxD
|
- Command ``DspLine<1|2> <index>,<unit>,<index>,<unit>,...`` to select message(s) on display of POWR3xxD and THR3xxD
|
||||||
|
- Command ``Sunrise 0..3`` to select sunrise dawn angle between Normal, Civil, Nautical or Astronomical [#16795](https://github.com/arendst/Tasmota/issues/16795)
|
||||||
- Support for Shelly Plus 2PM
|
- Support for Shelly Plus 2PM
|
||||||
- Support for SGP40 gas and air quality sensor [#16341](https://github.com/arendst/Tasmota/issues/16341)
|
- Support for SGP40 gas and air quality sensor [#16341](https://github.com/arendst/Tasmota/issues/16341)
|
||||||
- Support for Modbus writing using ModbusBridge by JeroenSt [#16351](https://github.com/arendst/Tasmota/issues/16351)
|
- Support for Modbus writing using ModbusBridge by JeroenSt [#16351](https://github.com/arendst/Tasmota/issues/16351)
|
||||||
- Support for DFRobot SEN0390 V30B ambient light sensor [#16105](https://github.com/arendst/Tasmota/issues/16105)
|
- Support for DFRobot SEN0390 V30B ambient light sensor [#16105](https://github.com/arendst/Tasmota/issues/16105)
|
||||||
- Support for QMC5883L magnetic induction sensor by Helge Scheunemann [#16714](https://github.com/arendst/Tasmota/issues/16714)
|
- Support for QMC5883L magnetic induction sensor by Helge Scheunemann [#16714](https://github.com/arendst/Tasmota/issues/16714)
|
||||||
|
- Support for Modbus Energy Monitoring devices using a rule file. See ``xnrg_29_modbus.ino`` for more information
|
||||||
- Zigbee device plugin mechanism with commands ``ZbLoad``, ``ZbUnload`` and ``ZbLoadDump`` [#16252](https://github.com/arendst/Tasmota/issues/16252)
|
- Zigbee device plugin mechanism with commands ``ZbLoad``, ``ZbUnload`` and ``ZbLoadDump`` [#16252](https://github.com/arendst/Tasmota/issues/16252)
|
||||||
- Zigbee basic support for Green Power [#16407](https://github.com/arendst/Tasmota/issues/16407)
|
- Zigbee basic support for Green Power [#16407](https://github.com/arendst/Tasmota/issues/16407)
|
||||||
- Zigbee friendly names per endpoint
|
- Zigbee friendly names per endpoint
|
||||||
@ -143,6 +145,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||||||
- ESP32 NimBLE library from v1.3.6 to v1.4.0
|
- ESP32 NimBLE library from v1.3.6 to v1.4.0
|
||||||
- ESP32 LVGL library from v8.3.0 to v8.3.2
|
- ESP32 LVGL library from v8.3.0 to v8.3.2
|
||||||
- ESP32 Tasmota Core32 from 2.0.4.1 to 2.0.5
|
- ESP32 Tasmota Core32 from 2.0.4.1 to 2.0.5
|
||||||
|
- Increase serial console input buffer size from 520 to 800
|
||||||
- Button debouncing V3 by adopting switch debounce code [#16339](https://github.com/arendst/Tasmota/issues/16339)
|
- Button debouncing V3 by adopting switch debounce code [#16339](https://github.com/arendst/Tasmota/issues/16339)
|
||||||
- Thermostat max allowed temperature from 100 to 200C [#16363](https://github.com/arendst/Tasmota/issues/16363)
|
- Thermostat max allowed temperature from 100 to 200C [#16363](https://github.com/arendst/Tasmota/issues/16363)
|
||||||
- Using command ``SerialBuffer`` raise max allowed buffer size to 2048 characters [#16374](https://github.com/arendst/Tasmota/issues/16374)
|
- Using command ``SerialBuffer`` raise max allowed buffer size to 2048 characters [#16374](https://github.com/arendst/Tasmota/issues/16374)
|
||||||
|
@ -589,6 +589,7 @@
|
|||||||
#define D_CMND_TIMERS "Timers"
|
#define D_CMND_TIMERS "Timers"
|
||||||
#define D_CMND_LATITUDE "Latitude"
|
#define D_CMND_LATITUDE "Latitude"
|
||||||
#define D_CMND_LONGITUDE "Longitude"
|
#define D_CMND_LONGITUDE "Longitude"
|
||||||
|
#define D_CMND_SUNRISE "Sunrise"
|
||||||
|
|
||||||
// Commands xdrv_23_zigbee.ino
|
// Commands xdrv_23_zigbee.ino
|
||||||
#define D_PRFX_ZB "Zb"
|
#define D_PRFX_ZB "Zb"
|
||||||
|
@ -268,8 +268,7 @@ typedef union {
|
|||||||
uint32_t spare25 : 1; // bit 25
|
uint32_t spare25 : 1; // bit 25
|
||||||
uint32_t spare26 : 1; // bit 26
|
uint32_t spare26 : 1; // bit 26
|
||||||
uint32_t spare27 : 1; // bit 27
|
uint32_t spare27 : 1; // bit 27
|
||||||
uint32_t spare28 : 1; // bit 28
|
uint32_t sunrise_dawn_angle : 2; // bits 28/29 (v12.1.1.4) -
|
||||||
uint32_t spare29 : 1; // bit 29
|
|
||||||
uint32_t temperature_set_res : 2; // bits 30/31 (v9.3.1.4) - (Tuya)
|
uint32_t temperature_set_res : 2; // bits 30/31 (v9.3.1.4) - (Tuya)
|
||||||
};
|
};
|
||||||
} SysMBitfield2;
|
} SysMBitfield2;
|
||||||
|
@ -20,6 +20,6 @@
|
|||||||
#ifndef _TASMOTA_VERSION_H_
|
#ifndef _TASMOTA_VERSION_H_
|
||||||
#define _TASMOTA_VERSION_H_
|
#define _TASMOTA_VERSION_H_
|
||||||
|
|
||||||
const uint32_t VERSION = 0x0C010104; // 12.1.1.4
|
const uint32_t VERSION = 0x0C010105; // 12.1.1.5
|
||||||
|
|
||||||
#endif // _TASMOTA_VERSION_H_
|
#endif // _TASMOTA_VERSION_H_
|
||||||
|
@ -226,6 +226,8 @@ bool tasconsole_serial = true;
|
|||||||
HardwareSerial TasConsole = Serial; // Only serial interface
|
HardwareSerial TasConsole = Serial; // Only serial interface
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
|
char EmptyStr[1] = { 0 }; // Provide a pointer destination to an empty char string
|
||||||
|
|
||||||
struct TasmotaGlobal_t {
|
struct TasmotaGlobal_t {
|
||||||
uint32_t global_update; // Timestamp of last global temperature and humidity update
|
uint32_t global_update; // Timestamp of last global temperature and humidity update
|
||||||
uint32_t baudrate; // Current Serial baudrate
|
uint32_t baudrate; // Current Serial baudrate
|
||||||
|
@ -1214,6 +1214,10 @@ void SettingsDefaultSet2(void) {
|
|||||||
Settings->longitude = (int)((double)LONGITUDE * 1000000);
|
Settings->longitude = (int)((double)LONGITUDE * 1000000);
|
||||||
SettingsResetStd();
|
SettingsResetStd();
|
||||||
SettingsResetDst();
|
SettingsResetDst();
|
||||||
|
// if (DAWN_NORMAL == SUNRISE_DAWN_ANGLE) { mbflag2.sunrise_dawn_angle |= 0; }
|
||||||
|
if (DAWN_CIVIL == SUNRISE_DAWN_ANGLE) { mbflag2.sunrise_dawn_angle |= 1; }
|
||||||
|
else if (DAWN_NAUTIC == SUNRISE_DAWN_ANGLE) { mbflag2.sunrise_dawn_angle |= 2; }
|
||||||
|
else if (DAWN_ASTRONOMIC == SUNRISE_DAWN_ANGLE) { mbflag2.sunrise_dawn_angle |= 3; }
|
||||||
|
|
||||||
Settings->button_debounce = KEY_DEBOUNCE_TIME;
|
Settings->button_debounce = KEY_DEBOUNCE_TIME;
|
||||||
Settings->switch_debounce = SWITCH_DEBOUNCE_TIME;
|
Settings->switch_debounce = SWITCH_DEBOUNCE_TIME;
|
||||||
@ -1260,6 +1264,7 @@ void SettingsDefaultSet2(void) {
|
|||||||
Settings->flag4 = flag4;
|
Settings->flag4 = flag4;
|
||||||
Settings->flag5 = flag5;
|
Settings->flag5 = flag5;
|
||||||
Settings->flag6 = flag6;
|
Settings->flag6 = flag6;
|
||||||
|
Settings->mbflag2 = mbflag2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDefaultSet3(void) {
|
void SettingsDefaultSet3(void) {
|
||||||
@ -1581,6 +1586,12 @@ void SettingsDelta(void) {
|
|||||||
Settings->touch_threshold = ESP32_TOUCH_THRESHOLD;
|
Settings->touch_threshold = ESP32_TOUCH_THRESHOLD;
|
||||||
}
|
}
|
||||||
#endif // ESP32 SOC_TOUCH_VERSION_1 or SOC_TOUCH_VERSION_2
|
#endif // ESP32 SOC_TOUCH_VERSION_1 or SOC_TOUCH_VERSION_2
|
||||||
|
if (Settings->version < 0x0C010105) { // 12.1.1.5
|
||||||
|
// if (DAWN_NORMAL == SUNRISE_DAWN_ANGLE) { mbflag2.sunrise_dawn_angle = 0; }
|
||||||
|
if (DAWN_CIVIL == SUNRISE_DAWN_ANGLE) { Settings->mbflag2.sunrise_dawn_angle = 1; }
|
||||||
|
else if (DAWN_NAUTIC == SUNRISE_DAWN_ANGLE) { Settings->mbflag2.sunrise_dawn_angle = 2; }
|
||||||
|
else if (DAWN_ASTRONOMIC == SUNRISE_DAWN_ANGLE) { Settings->mbflag2.sunrise_dawn_angle = 3; }
|
||||||
|
}
|
||||||
|
|
||||||
Settings->version = VERSION;
|
Settings->version = VERSION;
|
||||||
SettingsSave(1);
|
SettingsSave(1);
|
||||||
|
@ -550,6 +550,17 @@ char* UpperCase_P(char* dest, const char* source)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* SetStr(const char* str) {
|
||||||
|
if (nullptr == str) { str = PSTR(""); } // nullptr is considered empty string
|
||||||
|
size_t str_len = strlen(str);
|
||||||
|
if (0 == str_len) { return EmptyStr; } // return empty string
|
||||||
|
|
||||||
|
char* new_str = (char*) malloc(str_len + 1);
|
||||||
|
if (nullptr == new_str) { return EmptyStr; } // return empty string
|
||||||
|
strlcpy(new_str, str, str_len + 1);
|
||||||
|
return new_str;
|
||||||
|
}
|
||||||
|
|
||||||
bool StrCaseStr_P(const char* source, const char* search) {
|
bool StrCaseStr_P(const char* source, const char* search) {
|
||||||
char case_source[strlen_P(source) +1];
|
char case_source[strlen_P(source) +1];
|
||||||
UpperCase_P(case_source, source);
|
UpperCase_P(case_source, source);
|
||||||
|
@ -203,7 +203,7 @@ char* WebEnergyFormat(char* result, float* input, uint32_t resolution, uint32_t
|
|||||||
uint32_t index = (single) ? 1 : Energy.phase_count; // 1,2,3
|
uint32_t index = (single) ? 1 : Energy.phase_count; // 1,2,3
|
||||||
result[0] = '\0';
|
result[0] = '\0';
|
||||||
for (uint32_t i = 0; i < index; i++) {
|
for (uint32_t i = 0; i < index; i++) {
|
||||||
ext_snprintf_P(result, TOPSZ, PSTR("%s%s%*_f"), result, (i)?" / ":"", resolution, &input[i]);
|
ext_snprintf_P(result, GUISZ, PSTR("%s%s%*_f"), result, (i)?" / ":"", resolution, &input[i]);
|
||||||
}
|
}
|
||||||
#endif // USE_ENERGY_COLUMN_GUI
|
#endif // USE_ENERGY_COLUMN_GUI
|
||||||
return result;
|
return result;
|
||||||
|
@ -41,14 +41,14 @@
|
|||||||
const char kTimerCommands[] PROGMEM = "|" // No prefix
|
const char kTimerCommands[] PROGMEM = "|" // No prefix
|
||||||
D_CMND_TIMER "|" D_CMND_TIMERS
|
D_CMND_TIMER "|" D_CMND_TIMERS
|
||||||
#ifdef USE_SUNRISE
|
#ifdef USE_SUNRISE
|
||||||
"|" D_CMND_LATITUDE "|" D_CMND_LONGITUDE
|
"|" D_CMND_LATITUDE "|" D_CMND_LONGITUDE "|" D_CMND_SUNRISE
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
void (* const TimerCommand[])(void) PROGMEM = {
|
void (* const TimerCommand[])(void) PROGMEM = {
|
||||||
&CmndTimer, &CmndTimers
|
&CmndTimer, &CmndTimers
|
||||||
#ifdef USE_SUNRISE
|
#ifdef USE_SUNRISE
|
||||||
, &CmndLatitude, &CmndLongitude
|
, &CmndLatitude, &CmndLongitude, &CmndSunrise
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -129,7 +129,19 @@ void DuskTillDawn(uint8_t *hour_up,uint8_t *minute_up, uint8_t *hour_down, uint8
|
|||||||
h (D) = -12.0 nautische Dämmerung
|
h (D) = -12.0 nautische Dämmerung
|
||||||
h (D) = -18.0 astronomische Dämmerung
|
h (D) = -18.0 astronomische Dämmerung
|
||||||
*/
|
*/
|
||||||
const float h = SUNRISE_DAWN_ANGLE * RAD;
|
float sunrise_dawn_angle = DAWN_NORMAL;
|
||||||
|
switch (Settings->mbflag2.sunrise_dawn_angle) {
|
||||||
|
case 1:
|
||||||
|
sunrise_dawn_angle = DAWN_CIVIL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
sunrise_dawn_angle = DAWN_NAUTIC;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
sunrise_dawn_angle = DAWN_ASTRONOMIC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const float h = sunrise_dawn_angle * RAD;
|
||||||
const float sin_h = sinf(h); // let GCC pre-compute the sin() at compile time
|
const float sin_h = sinf(h); // let GCC pre-compute the sin() at compile time
|
||||||
|
|
||||||
float B = Settings->latitude / (1000000.0f / RAD); // geographische Breite
|
float B = Settings->latitude / (1000000.0f / RAD); // geographische Breite
|
||||||
@ -508,21 +520,26 @@ void CmndTimers(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_SUNRISE
|
#ifdef USE_SUNRISE
|
||||||
void CmndLongitude(void)
|
void CmndLongitude(void) {
|
||||||
{
|
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len) {
|
||||||
Settings->longitude = (int)(CharToFloat(XdrvMailbox.data) *1000000);
|
Settings->longitude = (int)(CharToFloat(XdrvMailbox.data) *1000000);
|
||||||
}
|
}
|
||||||
ResponseCmndFloat((float)(Settings->longitude) /1000000, 6);
|
ResponseCmndFloat((float)(Settings->longitude) /1000000, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmndLatitude(void)
|
void CmndLatitude(void) {
|
||||||
{
|
|
||||||
if (XdrvMailbox.data_len) {
|
if (XdrvMailbox.data_len) {
|
||||||
Settings->latitude = (int)(CharToFloat(XdrvMailbox.data) *1000000);
|
Settings->latitude = (int)(CharToFloat(XdrvMailbox.data) *1000000);
|
||||||
}
|
}
|
||||||
ResponseCmndFloat((float)(Settings->latitude) /1000000, 6);
|
ResponseCmndFloat((float)(Settings->latitude) /1000000, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CmndSunrise(void) {
|
||||||
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 3)) {
|
||||||
|
Settings->mbflag2.sunrise_dawn_angle = XdrvMailbox.payload;
|
||||||
|
}
|
||||||
|
ResponseCmndNumber(Settings->mbflag2.sunrise_dawn_angle);
|
||||||
|
}
|
||||||
#endif // USE_SUNRISE
|
#endif // USE_SUNRISE
|
||||||
|
|
||||||
/*********************************************************************************************\
|
/*********************************************************************************************\
|
||||||
|
@ -219,20 +219,6 @@ NrgMbsUser_t *NrgMbsUser = nullptr;
|
|||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
char EmptyStr[1] = { 0 };
|
|
||||||
|
|
||||||
char* SetStr(const char* str) {
|
|
||||||
if (nullptr == str) { str = PSTR(""); } // nullptr is considered empty string
|
|
||||||
size_t str_len = strlen(str);
|
|
||||||
if (0 == str_len) { return EmptyStr; } // return empty string
|
|
||||||
|
|
||||||
char* new_str = (char*) malloc(str_len + 1);
|
|
||||||
strlcpy(new_str, str, str_len + 1);
|
|
||||||
return new_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************************************/
|
|
||||||
|
|
||||||
void EnergyModbusLoop(void) {
|
void EnergyModbusLoop(void) {
|
||||||
#ifdef ENERGY_MODBUS_TICKER
|
#ifdef ENERGY_MODBUS_TICKER
|
||||||
if (NrgMbsParam.mutex || TasmotaGlobal.ota_state_flag) { return; }
|
if (NrgMbsParam.mutex || TasmotaGlobal.ota_state_flag) { return; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user