Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #57 from venustrg/master
Browse files Browse the repository at this point in the history
automatically determine maximum sleep time for current FW
  • Loading branch information
zerog2k authored Sep 21, 2020
2 parents df5f8d9 + a38983d commit 92d8cca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/nmea/init-cool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ function PrintUart()
fail_cnt = fail_cnt + 1
end
if (sync_att >= 2 or fail_cnt >= 3) then
print("going to deep sleep mode")
print("going to deep sleep for " .. math.floor((node.dsleepMax()-1e8)/1e6/60) .. " min")
tmr.create():alarm(3000, tmr.ALARM_SINGLE, function()
-- !! rtctime.dsleep() breaks NTP, using node.dsleep() instead
-- node.dsleep(1810e6); -- ~30 min sleep, will be rebooted (32-bit value for "integer" fw)
node.dsleep(36000e6) -- >3 hrs sleep, will be rebooted (64-bit value for "float" fw)
node.dsleep(node.dsleepMax()-1e8) -- >3 hrs sleep, will be rebooted (64-bit value for "float" fw)
end)
end
end
Expand Down
6 changes: 3 additions & 3 deletions docs/nmea/nmea_howto.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ so USB-TTL +5V line shouldn't be connected when powered from the clock!

- uses DHCP mode by default (can be disabled with DHCP=0)
- has no http server
- after 2 successfull sync attempts it goes to deep sleep for 10 hrs.
- after 2 successfull sync attempts it goes to deep sleep for ~3.5 hrs.
so it consumes much less power and generates almost no heat.
just rename it to init.lua before uploading to ESP866.
- script uses node.dsleep() for 10 hrs by default.
please change value to 30 min if you're using "integer" nodemcu FW.
- script uses node.dsleep() for ~3.5 hrs (max for nodemcu) by default.
please change value to less than 36 min if you're using "integer" nodemcu FW.

notice: deep sleep function can only be used when
ESP8266 PIN32(RST) and PIN8(XPD_DCDC aka GPIO16) are connected together.

0 comments on commit 92d8cca

Please # to comment.