Add join wifi for switch hardware

This commit is contained in:
Just Call Me Koko
2025-06-04 11:59:03 -04:00
parent 51eddd5b8f
commit 33d7460c6b
6 changed files with 123 additions and 30 deletions

View File

@@ -253,6 +253,7 @@ void CommandLine::runCommand(String input) {
Serial.println(HELP_SSID_CMD_B);
Serial.println(HELP_SAVE_CMD);
Serial.println(HELP_LOAD_CMD);
Serial.println(HELP_JOIN_CMD);
// Bluetooth sniff/scan
#ifdef HAS_BT
@@ -1241,6 +1242,28 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.RunInfo();
}
}
else if (cmd_args.get(0) == JOIN_CMD) {
int ap_sw = this->argSearch(&cmd_args, "-a");
int pw_sw = this->argSearch(&cmd_args, "-p");
if ((ap_sw != -1) && (pw_sw != -1)) {
int index = cmd_args.get(ap_sw + 1).toInt();
String password = cmd_args.get(pw_sw + 1);
Serial.println("Using SSID: " + (String)access_points->get(index).essid + " Password: " + (String)password);
wifi_scan_obj.currentScanMode = LV_JOIN_WIFI;
wifi_scan_obj.StartScan(LV_JOIN_WIFI, TFT_YELLOW);
wifi_scan_obj.joinWiFi(access_points->get(index).essid, password);
#ifdef HAS_SCREEN
#ifdef HAS_MINI_KB
menu_function_obj.changeMenu(menu_function_obj.current_menu);
#endif
#endif
}
else {
Serial.println("You did not provide the proper args");
return;
}
}
// Select access points or stations
else if (cmd_args.get(0) == SEL_CMD) {
// Get switches