Explorar el Código

Merge pull request #987 from DiUS/enduser_enhanced

Enhancements to enduser_setup module
Johny Mattsson hace 8 años
padre
commit
fcb14a33b3
Se han modificado 5 ficheros con 30 adiciones y 31 borrados
  1. 4 2
      app/libc/c_stdio.c
  2. 1 1
      app/libc/c_stdio.h
  3. 4 2
      app/modules/enduser_setup.c
  4. 18 1
      docs/en/modules/enduser-setup.md
  5. 3 25
      ld/nodemcu.ld

+ 4 - 2
app/libc/c_stdio.c

@@ -1094,12 +1094,14 @@ exponent(char *p, int exp, int fmtch)
 #endif /* FLOATINGPT */
 
 
-void c_sprintf(char *s, char *fmt, ...)
+int c_sprintf(char *s, const char *fmt, ...)
 {
+    int n;
     va_list arg;
     va_start(arg, fmt);
-    vsprintf(s, fmt, arg);
+    n = vsprintf(s, fmt, arg);
     va_end(arg);
+    return n;
 }
 
 #endif

+ 1 - 1
app/libc/c_stdio.h

@@ -60,7 +60,7 @@ extern void output_redirect(const char *str);
 #define c_sprintf os_sprintf
 #else
 #include "c_stdarg.h"
-void c_sprintf(char* s,char *fmt, ...);
+int c_sprintf(char* s,const char *fmt, ...);
 #endif
 
 // #define c_vsprintf ets_vsprintf

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 4 - 2
app/modules/enduser_setup.c


+ 18 - 1
docs/en/modules/enduser-setup.md

@@ -6,6 +6,23 @@ This module provides a simple way of configuring ESP8266 chips without using a s
 After running [`enduser_setup.start()`](#enduser_setupstart) a portal like the above can be accessed through a wireless network called SetupGadget_XXXXXX. The portal is used to submit the credentials for the WiFi of the enduser.
 After an IP address has been successfully obtained this module will stop as if [`enduser_setup.stop()`](#enduser_setupstop) had been called.
 
+## enduser_setup.manual()
+
+Controls whether manual AP configuration is used.
+
+By default the `enduser_setup` module automatically configures an open access point when starting, and stops it when the device has been successfully joined to a WiFi network. If manual mode has been enabled, neither of this is done. The device must be manually configured for `wifi.SOFTAP` mode prior to calling `enduser_setup.start()`. Additionally, the portal is not stopped after the device has successfully joined to a WiFi network.
+
+Most importantly, *the `onConfigured()` callback is not supported in manual mode*. This limitation may disappear in the future.
+
+#### Syntax
+`enduser_setup.manual([on_off])`
+
+#### Parameters
+  - `on_off` a boolean value indicating whether to use manual mode; if not given, the function only returns the current setting.
+
+#### Returns
+The current setting, true if manual mode is enabled, false if it is not.
+
 ## enduser_setup.start()
 
 Starts the captive portal.
@@ -44,4 +61,4 @@ Stops the captive portal.
 none
 
 #### Returns
-`nil`
+`nil`

+ 3 - 25
ld/nodemcu.ld

@@ -89,31 +89,9 @@ SECTIONS
     KEEP(*(.lua_rotable))
     LONG(0) LONG(0) /* Null-terminate the array */
 
-    /* These are *only* pulled in by Lua, and therefore safe to put in flash */
-    */libc.a:lib_a-isalnum.o(.text* .literal*)
-    */libc.a:lib_a-isalpha.o(.text* .literal*)
-    */libc.a:lib_a-iscntrl.o(.text* .literal*)
-    */libc.a:lib_a-isspace.o(.text* .literal*)
-    */libc.a:lib_a-islower.o(.text* .literal*)
-    */libc.a:lib_a-isupper.o(.text* .literal*)
-    */libc.a:lib_a-ispunct.o(.text* .literal*)
-    */libc.a:lib_a-isxdigit.o(.text* .literal*)
-    */libc.a:lib_a-locale.o(.text* .literal*)
-    */libc.a:lib_a-tolower.o(.text* .literal*)
-    */libc.a:lib_a-toupper.o(.text* .literal*)
-    */libc.a:lib_a-strcasecmp.o(.text* .literal*)
-    */libc.a:lib_a-strcoll.o(.text* .literal*)
-    */libc.a:lib_a-strchr.o(.text* .literal*)
-    */libc.a:lib_a-strrchr.o(.text* .literal*)
-    */libc.a:lib_a-strcat.o(.text* .literal*)
-    */libc.a:lib_a-strncat.o(.text* .literal*)
-    */libc.a:lib_a-strcspn.o(.text* .literal*)
-    */libc.a:lib_a-strtol.o(.text* .literal*)
-    */libc.a:lib_a-strtoul.o(.text* .literal*)
-    */libc.a:lib_a-strpbrk.o(.text* .literal*)
-    */libc.a:lib_a-memchr.o(.text* .literal*)
-    */libc.a:lib_a-setjmp.o(.text* .literal*)
-    /* end Lua C lib functions */
+    /* SDK doesn't use libc functions, and are therefore safe to put in flash */
+    */libc.a(.text* .literal*)
+    /* end libc functions */
 
     _irom0_text_end = ABSOLUTE(.);
     _flash_used_end = ABSOLUTE(.);

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio