mirror of https://github.com/arendst/Tasmota.git
6.3.0.15 Update dynamic sleep
6.3.0.15 20181201 * Removed command SetOption36 (#4497) * Add command SetOption60 0/1 to select dynamic sleep (0) or sleep (1) (#4497)
This commit is contained in:
parent
980e8c3401
commit
eb3c1a327d
|
@ -1,4 +1,8 @@
|
|||
/* 6.3.0.14 20181127
|
||||
/* 6.3.0.15 20181201
|
||||
* Removed command SetOption36 (#4497)
|
||||
* Add command SetOption60 0/1 to select dynamic sleep (0) or sleep (1) (#4497)
|
||||
*
|
||||
* 6.3.0.14 20181127
|
||||
* Add Command CalcRes to set number of decimals (0 - 7) used in commands ADD, SUB, MULT and SCALE (#4420)
|
||||
* Add support for SM Smart Wifi Dimmer PS-16-DZ (#4465)
|
||||
* Move some static (serial) buffers to dynamic buffers
|
||||
|
|
|
@ -73,7 +73,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
|||
uint32_t use_wifi_rescan : 1; // bit 7 (v6.3.0.10)
|
||||
uint32_t receive_raw : 1; // bit 8 (v6.3.0.11)
|
||||
uint32_t hass_tele_as_result : 1; // bit 9 (v6.3.0.13)
|
||||
uint32_t sleep_normal : 1; // SetOption60 - Enable normal sleep instead of dynamic sleep
|
||||
uint32_t sleep_normal : 1; // bit 10 (v6.3.0.15) - SetOption60 - Enable normal sleep instead of dynamic sleep
|
||||
uint32_t spare11 : 1;
|
||||
uint32_t spare12 : 1;
|
||||
uint32_t spare13 : 1;
|
||||
|
|
|
@ -417,6 +417,9 @@ void SettingsDefaultSet2(void)
|
|||
// Settings.flag.stop_flash_rotate = 0;
|
||||
Settings.save_data = SAVE_DATA;
|
||||
Settings.sleep = APP_SLEEP;
|
||||
if (Settings.sleep < 50) {
|
||||
Settings.sleep = 50; // Default to 50 for sleep, for now
|
||||
}
|
||||
|
||||
// Module
|
||||
// Settings.flag.interlock = 0;
|
||||
|
@ -854,14 +857,14 @@ void SettingsDelta(void)
|
|||
if (Settings.version < 0x06030004) {
|
||||
memset(&Settings.drivers, 0xFF, 32); // Enable all possible monitors, displays, drivers and sensors
|
||||
}
|
||||
if (Settings.version < 0x0603000F) {
|
||||
if (Settings.sleep < 50) {
|
||||
Settings.sleep = 50; // Default to 50 for sleep, for now
|
||||
}
|
||||
}
|
||||
if (Settings.version < 0x0603000E) {
|
||||
Settings.flag2.calc_resolution = CALC_RESOLUTION;
|
||||
}
|
||||
if (Settings.version < 0x0603000F) {
|
||||
if (Settings.sleep < 50) {
|
||||
Settings.sleep = 50; // Default to 50 for sleep, for now
|
||||
}
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
|
|
|
@ -89,6 +89,8 @@ const char kTasmotaCommands[] PROGMEM =
|
|||
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
|
||||
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER "|" D_CMND_DRIVER;
|
||||
|
||||
const char kSleepMode[] PROGMEM = "Dynamic|Normal";
|
||||
|
||||
const uint8_t kIFan02Speed[4][3] = {{6,6,6}, {7,6,6}, {7,7,6}, {7,6,7}};
|
||||
|
||||
// Global variables
|
||||
|
@ -1579,21 +1581,15 @@ void MqttShowState(void)
|
|||
char stemp1[33];
|
||||
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\""), mqtt_data, GetDateAndTime(DT_LOCAL).c_str(), GetUptime().c_str());
|
||||
|
||||
#ifdef USE_ADC_VCC
|
||||
dtostrfd((double)ESP.getVcc()/1000, 3, stemp1);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_VCC "\":%s"), mqtt_data, stemp1);
|
||||
#endif
|
||||
|
||||
char _sleepmode[8];
|
||||
if (Settings.flag3.sleep_normal) {
|
||||
sprintf(_sleepmode,"Normal");
|
||||
} else {
|
||||
sprintf(_sleepmode,"Dynamic");
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SleepMode\":\"%s\""), mqtt_data, _sleepmode); // Add current sleep mode setting to telemetry
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"Sleep\":%u"), mqtt_data, sleep); // Add current sleep setting to telemetry
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"LoadAvg\":%u"), mqtt_data, loop_load_avg); // Add LoadAvg to telemetry
|
||||
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SleepMode\":\"%s\",\"Sleep\":%u,\"LoadAvg\":%u"),
|
||||
mqtt_data, GetTextIndexed(stemp1, sizeof(stemp1), Settings.flag3.sleep_normal, kSleepMode), sleep, loop_load_avg);
|
||||
|
||||
for (byte i = 0; i < devices_present; i++) {
|
||||
if (i == light_device -1) {
|
||||
LightState(1);
|
||||
|
@ -2800,7 +2796,7 @@ void loop(void)
|
|||
#endif // USE_ARDUINO_OTA
|
||||
|
||||
uint32_t my_activity = millis() - my_sleep;
|
||||
|
||||
|
||||
if (Settings.flag3.sleep_normal) {
|
||||
// yield(); // yield == delay(0), delay contains yield, auto yield in loop
|
||||
delay(sleep); // https://github.com/esp8266/Arduino/issues/2021
|
||||
|
|
|
@ -180,12 +180,8 @@ void WiFiSetSleepMode(void)
|
|||
// Sleep explanation: https://github.com/esp8266/Arduino/blob/3f0c601cfe81439ce17e9bd5d28994a7ed144482/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp#L255
|
||||
#if defined(ARDUINO_ESP8266_RELEASE_2_4_1) || defined(ARDUINO_ESP8266_RELEASE_2_4_2)
|
||||
#else // Enabled in 2.3.0, 2.4.0 and stage
|
||||
if (sleep) {
|
||||
if (Settings.flag3.sleep_normal) {
|
||||
WiFi.setSleepMode(WIFI_LIGHT_SLEEP); // Allow light sleep during idle times
|
||||
} else {
|
||||
WiFi.setSleepMode(WIFI_MODEM_SLEEP); // Disable sleep (Esp8288/Arduino core and sdk default)
|
||||
}
|
||||
if (sleep && Settings.flag3.sleep_normal) {
|
||||
WiFi.setSleepMode(WIFI_LIGHT_SLEEP); // Allow light sleep during idle times
|
||||
} else {
|
||||
WiFi.setSleepMode(WIFI_MODEM_SLEEP); // Disable sleep (Esp8288/Arduino core and sdk default)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue