Lets get the party started and +1
[url=https://www.banggood.com/custlink/KvGGhGF4wG[/url]
I like ESP8266 and ESP8285 and ESP32
I only have an 01 module to test with, so I can only try one pin (4=GPIO2) at the moment. No success I'm afraid.
Example:
gpio.mode(4, gpio.INPUT, gpio.PULLUP)
node.enablewakeup(4, "both")
node.dsleep(2000)
Pulled the pin low but no luck in waking up. If somebody with more pins wants to try on a few others and report their results, I'd be interested.
Here is the diff for node.c that adds the enablewakeup command to lua.
diff --git a/app/modules/node.c b/app/modules/node.c
index 90dd0d9..a0285ac 100644
--- a/app/modules/node.c
+++ b/app/modules/node.c
@@ -387,6 +387,47 @@ static int node_compile( lua_State* L )
return 0;
}
+/* testing for wakeup enable and disable */
+
+static int node_wakeup_enable( lua_State* L )
+{
+ s32 pin, mode;
+ size_t sl;
+ const char *str;
+
+ pin = luaL_checkinteger( L, 1 );
+ MOD_CHECK_ID( gpio, pin );
+ if(pin==0)
+ return luaL_error( L, "no interrupt for D0" );
+
+ str = luaL_checklstring( L, 2, &sl );
+ if (str == NULL)
+ return luaL_error( L, "wrong arg type" );
+
+ if(sl == 2 && c_strcmp(str, "up") == 0){
+ mode = GPIO_PIN_INTR_POSEDGE;
+ }else if(sl == 4 && c_strcmp(str, "down") == 0){
+ mode = GPIO_PIN_INTR_NEGEDGE;
+ }else if(sl == 4 && c_strcmp(str, "both") == 0){
+ mode = GPIO_PIN_INTR_ANYEGDE;
+ }else if(sl == 3 && c_strcmp(str, "low") == 0){
+ mode = GPIO_PIN_INTR_LOLEVEL;
+ }else if(sl == 4 && c_strcmp(str, "high") == 0){
+ mode = GPIO_PIN_INTR_HILEVEL;
+ }else{
+ return luaL_error( L, "wrong arg type" );
+ }
+
+ gpio_pin_wakeup_enable(pin, mode);
+ return 0;
+}
+
+static int node_wakeup_disable( lua_State* L )
+{
+ gpio_pin_wakeup_disable();
+ return 0;
+}
+
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
@@ -407,6 +448,9 @@ const LUA_REG_TYPE node_map[] =
{ LSTRKEY( "output" ), LFUNCVAL( node_output ) },
{ LSTRKEY( "readvdd33" ), LFUNCVAL( node_readvdd33) },
{ LSTRKEY( "compile" ), LFUNCVAL( node_compile) },
+
+ { LSTRKEY( "enablewakeup"), LFUNCVAL( node_wakeup_enable ) },
+ { LSTRKEY( "disablewakeup"), LFUNCVAL( node_wakeup_disable ) },
// Combined to dsleep(us, option)
// { LSTRKEY( "dsleepsetoption" ), LFUNCVAL( node_deepsleep_setoption) },
#if LUA_OPTIMIZE_MEMORY > 0
interrupt high
gpio2 connected to RST
deepsleep time = 0 ?