ducalex / retro-go

Retro emulation for the ODROID-GO and other ESP32 devices
GNU General Public License v2.0
543 stars 125 forks source link

launcher/rg_network: Adding pre-configured Wifi Select option #60

Closed KD-MM2 closed 1 year ago

KD-MM2 commented 1 year ago

I giveup the AP scan because I have no idea about making 'something' to input the password. So I read on ODROID GO forum and get the idea that we will save the APs to config file and select, then load them.

This option(under Wi-Fi options) let us select the saved SSIDs from wifi.json. Present support saving up to 5 APs(this can be change by changing the MAX_AP_LIST). The wifi.json will look like this:

{
    "WiFi": 1,
    "HTTPFileServer":   1,
    "slot": 0,

    "ssid0":    "ssid-1",
    "password0":    "password-1",

    "ssid1":    "ssid-2",
    "password1":    "password-2,

    "ssid2":    "ssid-3",
    "password2":    "password-3",

    "ssid3":    "ssid-4",
    "password3":    "password-4",

    "ssid4":    "ssid-5",
    "password4":    "password-5"
}

I define the variable to a different header file to get rid of defined but not used warning when include them inside rg_network.h(building the emulators make the warning) After select the AP, need to reboot to apply new AP config. Now I'm looking for a way to restart the wifi after the AP is set without rebooting the OGO.

KD-MM2 commented 1 year ago

DEFFE472-AAA7-4B99-A2CD-CA0A5E2FDD60

ducalex commented 1 year ago

I'm not a fan of the usage of a global array and rg_network_wifi.h.

Maybe you could make rg_network_get_ap_list return a const char ** pointer (ie return ap_list) instead? There are other/nicer solutions but that one wouldn't need much changes for you.

BTW thanks for including photos in your PRs, I appreciate it :).

KD-MM2 commented 1 year ago

Will re-open after new commit pushed