Issue configuring WiFi credentials through UART RTS/CTS while application running

Help needed! I currently have a P1 operating a power-distribution board. I’ve integrated the Featherwing header standard to interconnect a Mesh device. My initial intention is to be able to send WiFi credentials to the P1, through the Mesh device without entering listening mode. I have written the appropriate Serial.read code to receive and return messages and testing with the CoolTerm software. I am using my desktop to test everything before integrating the Mesh device. I have included the WiFi.setCredentials() call with variables _SSID and _Password, which are read from UART. I have the P1 respond accordingly, repeating the SSID and password and it’s returning correct. I can then parse the list of stored credentials and the SSID, password, security, cipher, stored and it’s all correct. However, after performing a WiFi reset, the network still doesn’t connect and the previous SSID is connected to. I repeat the process but this time clearing the credentials before uploading them through UART. Now the only stored credentials are the newly-uploaded ones as expected. However, it doesn’t connect. If I set the credentials during Setup using the same inputs (SSID, Password, WPA2), it works just fine. After hours and hours of trying to work this out, I have come to the conclusion that there is: 1. some character(s) are extra or missing, or 2. that there is another step in getting the new credentials to be selected or properly stored. Can anybody help with this? Here is the relevant code:

void readSerialMessage() {
    getMessage();
    checkMessage();  
    clearMessage();
}

void checkMessage() {
    String message = newReadMessage;
    String _SSID;
    String _Password;
        
    if(message == "help") {
        Serial.printlnf("debug on");
        Serial.printlnf("debug off");
        Serial.printlnf("wifi");
        Serial.printlnf("clear wifi");
    }
    if(message == "debug on") {
        DEBUG = true;
        Serial.printlnf("DEBUGGING ENABLED");
    }    
    if(message == "debug off") {
        DEBUG = false;
        Serial.printlnf("DEBUGGING DISABLED");
    }    
    if(message == "wifi") {

        Serial.printlnf("----WiFi CREDENTIAL INPUT----");
        Serial.printlnf("Input Network SSID: ");
        newMessage = false;
        while (! newMessage) {
            newMessage = false;
            getMessage();
            _SSID = newReadMessage;
            delay(100);
            if(DEBUG) Serial.printlnf("Still in the SSID loop");
        }    
        newMessage = false;
        Serial.printlnf("Input Network Password: ");
        while (! newMessage) {
            newMessage = false;
            getMessage();
            _Password = newReadMessage;
            delay(100);
            if(DEBUG) Serial.printlnf("Still in the Password loop");            
        }
        String newSSID = _SSID + _SSID + String(WiFi.SSID()) + _SSID;
        Serial.printlnf(newSSID);
        Serial.printlnf(_Password);

        Serial.printlnf("WiFi Credentials Succesfully Stored!");
        Serial.printlnf(" ");
        Serial.printlnf("Resetting Network Connection..........");
        WiFi.disconnect();
        Serial.printlnf(" ");
        WiFi.setCredentials(_SSID , _Password , WPA2);
        EEPROM.put(storedPassword, _Password); 
        EEPROM.put(storedSSID, _SSID);
        Serial.printlnf("Connected To: %s", WiFi.SSID());
        String signalStrength = "Signal Strength: " + String (WiFi.RSSI()) + " dB";
        Serial.printlnf(signalStrength);
        WiFi.connect();
        Particle.connect();
    }
    if(message == "clear wifi") {
        WiFi.clearCredentials();
        Serial.printlnf("WiFi Credentials Cleared");
    }    
    
    if(message == "wifi security") {
        WiFiAccessPoint ap[5];
        int found = WiFi.getCredentials(ap, 5);
        for (int i = 0; i < found; i++) {
            Serial.print("ssid: ");
            Serial.println(ap[i].ssid);

            Serial.print("security: ");
            Serial.println(ap[i].security);

            Serial.print("cipher: ");
            Serial.println(ap[i].cipher);
            
            Serial.print("rssi: ");
            Serial.println(String(ap[i].rssi));
        }        
    }
    
    if(message == "wifi reset") {
        Serial.printlnf("Resetting WiFi Connection........");
        WiFi.disconnect();
        delay(1000);
        WiFi.connect();
        Particle.connect();
        delay(1000);
    }    
    
    if(message == "reset") {
        Serial.printlnf("RESETTING");
        delay(200);
        System.reset();
    }
    
    if(message == "read registers") {
        for(int i = READ_BUF_SIZE; i >= 0 ; i--) {
            Serial.print(String(i) + ": ");
            if (readBuf[i] == 0) Serial.println("nill");
            else Serial.println(readBuf[i]);
        }
          clearMessage();
    }
}

void getMessage() {
    newMessage = false;
        readBufOffset = 0;
        while(Serial.available()) {
            if (readBufOffset < READ_BUF_SIZE) {
                char c = Serial.read();
                if (c != '\n') {
                    readBuf[readBufOffset++] = c;
                 //   Serial.print(c);
                }
                else {
                    readBuf[readBufOffset] = 0;
                    readBufOffset = 0;
                }
            }
            else {
                readBufOffset = 0;
            }
            if(DEBUG) Serial.printlnf("serial is available");
            
            newMessage = true;
        }
    newReadMessage = readBuf;
    for(int i = READ_BUF_SIZE; i >= 0 ; i--) {
        Serial.print(readBuf[i]);
        readBuf[i] = 0;
    }      

}

void clearMessage() {
    for(int i = READ_BUF_SIZE; i >= 0 ; i--) {
        readBuf[i] = 0;
    }
    Serial.printlnf("buffer cleared");
}

Problem solved. Possibility 2 was the issue. It seems that calling a System.reset() and/or WiFi.clearCredentials() does not reset the WiFi chip or its connection so the previously-saved credentials are still held and the new ones are just stored.