Merge pull request #1417 from MaBecker/wifi

fix wifi restore ssidAP
This commit is contained in:
Gordon Williams 2018-05-14 08:57:00 +01:00 committed by GitHub
commit cf93b4ba02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -850,6 +850,7 @@ void jswrap_wifi_save(JsVar *what) {
jsvObjectSetChildAndUnLock(o, "passwordAP", jsvNewFromString((char *) ap_config.password));
jsvObjectSetChildAndUnLock(o, "authmodeAP", jsvNewFromInteger(ap_config.authmode));
jsvObjectSetChildAndUnLock(o, "hiddenAP", jsvNewFromInteger(ap_config.ssid_hidden));
jsvObjectSetChildAndUnLock(o, "channelAP", jsvNewFromInteger(ap_config.channel));
savedMode = wifi_get_opmode();
@ -900,7 +901,7 @@ void jswrap_wifi_restore(void) {
ap_config.ssid_hidden = jsvGetInteger(v);
jsvUnLock(v);
v = jsvObjectGetChild(o,"ssid",0);
v = jsvObjectGetChild(o,"ssidAP",0);
jsvGetString(v, (char *)ap_config.ssid, sizeof(ap_config.ssid));
ap_config.ssid_len = jsvGetStringLength(v);
@ -910,7 +911,10 @@ void jswrap_wifi_restore(void) {
jsvGetString(v, (char *)ap_config.password, sizeof(ap_config.password));
jsvUnLock(v);
ap_config.channel = 1;
v = jsvObjectGetChild(o,"channelAP",0);
ap_config.channel = jsvGetInteger(v);
jsvUnLock(v);
ap_config.max_connection = 4;
ap_config.beacon_interval = 100;
wifi_softap_set_config_current(&ap_config);