We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a26ab4e + dc1efd2 commit 0102b95Copy full SHA for 0102b95
adafruit_espatcontrol/adafruit_espatcontrol.py
@@ -657,3 +657,18 @@ def hard_reset(self) -> None:
657
time.sleep(3) # give it a few seconds to wake up
658
self._uart.reset_input_buffer()
659
self._initialized = False
660
+
661
+ def deep_sleep(self, duration_ms: int) -> bool:
662
+ """Execute deep-sleep command.
663
+ Passing zero as argument will put the chip into deep-sleep forever
664
+ until the RST-pin is pulled low (method hard_reset()).
665
+ This is the typical use-case for an ESP8266 as coprocessor.
666
667
+ Note that a similar method in the Arduino-libs expects microseconds.
668
+ """
669
+ cmd = "AT+GSLP=" + str(duration_ms)
670
+ try:
671
+ self.at_response(cmd, retries=1)
672
+ return True
673
+ except OKError:
674
+ return False
0 commit comments