Join with saved wifi credentials

This commit is contained in:
Just Call Me Koko
2025-08-04 17:47:56 -04:00
parent b490b5968f
commit 3ea48c35e5
6 changed files with 148 additions and 1 deletions

View File

@@ -1367,6 +1367,7 @@ void CommandLine::runCommand(String input) {
else if (cmd_args.get(0) == JOIN_CMD) {
int ap_sw = this->argSearch(&cmd_args, "-a");
int pw_sw = this->argSearch(&cmd_args, "-p");
int s_sw = this->argSearch(&cmd_args, "-s");
if ((ap_sw != -1) && (pw_sw != -1)) {
int index = cmd_args.get(ap_sw + 1).toInt();
@@ -1381,6 +1382,20 @@ void CommandLine::runCommand(String input) {
#endif
#endif
}
else if (s_sw != -1) {
String ssid = settings_obj.loadSetting<String>("ClientSSID");
String pw = settings_obj.loadSetting<String>("ClientPW");
if ((ssid != "") && (pw != "")) {
wifi_scan_obj.joinWiFi(ssid, pw, false);
#ifdef HAS_SCREEN
menu_function_obj.changeMenu(menu_function_obj.current_menu);
#endif
}
else {
Serial.println("There are no saved WiFi credentials");
}
}
else {
Serial.println("You did not provide the proper args");
return;