Merge pull request #5 from letscontrolit/mega

Update from master
This commit is contained in:
Grovkillen
2019-01-08 10:35:07 +01:00
committed by GitHub
4 changed files with 67 additions and 13 deletions
+30
View File
@@ -1,3 +1,33 @@
-------------------------------------------------
Changes in release mega-20190108 (since mega-20190107)
-------------------------------------------------
Release date: Tue Jan 8 04:00:08 CET 2019
Bartlomiej Zimon (2):
Dallas: perform 1wire reset before issue copy to eeprom command it is small fix for resolution change after sensor reset #2143
Dallas: do not perform eeprom write if configuration does not change
Grovkillen (8):
[docs] fixed used libraries
[docs] added events to all plugin pages
[docs] added "used libraries" to all plugin pages
[docs] moved events to repl file (same as commands)
[docs] added an event reference page (similar to the command ref. page)
[docs] added P082 (GPS) pages
[docs] P082 (GPS) added "where to buy" links
[docs] fixed some syntax
TD-er (1):
[deepSleep] Prevent overflow issues
stefan (4):
[deepSleep] Make deepSleep work again with 2.5.0 and refactor delay var
[deepSleep] only use deepSleepInstant for 2.5.0
[deepSleep] Allow for sleeptimes up to deepSleepMax()
[deepSleep] fix type errors of #999e43a
-------------------------------------------------
Changes in release mega-20190107 (since mega-20190106)
-------------------------------------------------
+18 -11
View File
@@ -350,7 +350,7 @@ bool readyForSleep()
return timeOutReached(timerAwakeFromDeepSleep + 1000 * Settings.deepSleep);
}
void deepSleep(int delay)
void deepSleep(int dsdelay)
{
checkRAM(F("deepSleep"));
@@ -378,28 +378,35 @@ void deepSleep(int delay)
}
}
saveUserVarToRTC();
deepSleepStart(delay); // Call deepSleepStart function after these checks
deepSleepStart(dsdelay); // Call deepSleepStart function after these checks
}
void deepSleepStart(int delay)
void deepSleepStart(int dsdelay)
{
// separate function that is called from above function or directly from rules, usign deepSleep as a one-shot
String event = F("System#Sleep");
rulesProcessing(event);
RTC.deepSleepState = 1;
saveToRTC();
if (delay > 4294 || delay < 0)
delay = 4294; //max sleep time ~1.2h
addLog(LOG_LEVEL_INFO, F("SLEEP: Powering down to deepsleep..."));
delay(100); // give the node time to send above log message before going to sleep
#if defined(ESP8266)
ESP.deepSleep((uint32_t)delay * 1000000, WAKE_RF_DEFAULT);
#if defined(CORE_2_5_0)
uint64_t deepSleep_usec = dsdelay * 1000000ULL;
if ((deepSleep_usec > ESP.deepSleepMax()) || dsdelay < 0) {
deepSleep_usec = ESP.deepSleepMax();
}
ESP.deepSleepInstant(deepSleep_usec, WAKE_RF_DEFAULT);
#else
if (dsdelay > 4294 || dsdelay < 0)
dsdelay = 4294; //max sleep time ~71 minutes
ESP.deepSleep((uint32_t)dsdelay * 1000000, WAKE_RF_DEFAULT);
#endif
#endif
#if defined(ESP32)
esp_sleep_enable_timer_wakeup((uint32_t)delay * 1000000);
esp_sleep_enable_timer_wakeup((uint32_t)dsdelay * 1000000);
esp_deep_sleep_start();
#endif
}
@@ -735,9 +742,9 @@ void statusLED(boolean traffic)
/********************************************************************************************\
delay in milliseconds with background processing
\*********************************************************************************************/
void delayBackground(unsigned long delay)
void delayBackground(unsigned long dsdelay)
{
unsigned long timer = millis() + delay;
unsigned long timer = millis() + dsdelay;
while (!timeOutReached(timer))
backgroundtasks();
}
+13 -2
View File
@@ -1253,8 +1253,19 @@ void handle_config() {
addHelpButton(F("SleepMode"));
addFormNote(F("0 = Sleep Disabled, else time awake from sleep"));
addFormNumericBox( F("Sleep time"), F("delay"), Settings.Delay, 0, 4294); //limited by hardware to ~1.2h
addUnit(F("sec"));
int dsmax = 4294; // About 71 minutes
#if defined(CORE_2_5_0)
dsmax = INT_MAX;
if ((ESP.deepSleepMax()/1000000ULL) <= (uint64_t)INT_MAX)
dsmax = (int)(ESP.deepSleepMax()/1000000ULL);
#endif
addFormNumericBox( F("Sleep time"), F("delay"), Settings.Delay, 0, dsmax); //limited by hardware
{
String maxSleeptimeUnit = F("sec (max: ");
maxSleeptimeUnit += String(dsmax);
maxSleeptimeUnit += ')';
addUnit(maxSleeptimeUnit);
}
addFormCheckBox(F("Sleep on connection failure"), F("deepsleeponfail"), Settings.deepSleepOnFail);
+6
View File
@@ -360,6 +360,8 @@ boolean Plugin_004_DS_setResolution(uint8_t ROM[8], byte res)
return false;
else
{
byte old_configuration = ScratchPad[4];
switch (res)
{
case 12:
@@ -377,6 +379,9 @@ boolean Plugin_004_DS_setResolution(uint8_t ROM[8], byte res)
break;
}
if (ScratchPad[4] == old_configuration)
return true;
Plugin_004_DS_reset();
Plugin_004_DS_write(0x55); // Choose ROM
for (byte i = 0; i < 8; i++)
@@ -387,6 +392,7 @@ boolean Plugin_004_DS_setResolution(uint8_t ROM[8], byte res)
Plugin_004_DS_write(ScratchPad[3]); // low alarm temp
Plugin_004_DS_write(ScratchPad[4]); // configuration register
Plugin_004_DS_reset();
Plugin_004_DS_write(0x55); // Choose ROM
for (byte i = 0; i < 8; i++)
Plugin_004_DS_write(ROM[i]);