(ssid, password)
| 670 | } |
| 671 | |
| 672 | configAP(ssid, password) { |
| 673 | trace(`Configure access point ${ssid}\n`); |
| 674 | let iter = 2; |
| 675 | let clockAP; |
| 676 | let disp = 'ap '; |
| 677 | while (undefined !== (clockAP = accessPointList.find(x => x.ssid === ap_name))) { |
| 678 | trace(` ap - ${clockAP.ssid} found iterating\n`); |
| 679 | ap_name = AP_NAME + `_${iter}`; |
| 680 | disp = `ap_${iter}`; |
| 681 | iter++; |
| 682 | } |
| 683 | |
| 684 | this.usingAP = true; |
| 685 | if (!this.rtc.valid) |
| 686 | this.display.value(disp).blink(); |
| 687 | |
| 688 | this.myWiFi?.close(); |
| 689 | delete this.myWiFi; |
| 690 | |
| 691 | this.AP = WiFi.accessPoint({ ssid:ap_name, password, station: true }); |
| 692 | |
| 693 | this.configServer(); |
| 694 | this.doWiFiScan(); |
| 695 | |
| 696 | if (this.prefs.ssid) { // saved SSID failed. wait a bit (2 minutes initially). them, if saved SSID is visible, try again. |
| 697 | let delay = 2 * 60_000; |
| 698 | Timer.repeat(id => { |
| 699 | if (delay < (60_000 * 60)) { |
| 700 | delay *= 2; |
| 701 | Timer.schedule(id, delay, delay); |
| 702 | } |
| 703 | |
| 704 | if (accessPointList.findIndex(x => x.ssid === this.prefs.ssid) >= 0) |
| 705 | doRestart(this); |
| 706 | }, delay); |
| 707 | } |
| 708 | } |
| 709 | apScan() { |
| 710 | WiFi.scan({}, item => { |
| 711 | if (!item) { |
no test coverage detected