WiFi.config(...) parameter order

Hello.

I'm new to Arduino development. I'm working on an ESP32 and trying to connect it to WiFi using a static ip. I'm able to connect using DHCP just fine using WiFi.begin(...).

I'm using this piece of documentation to base my code off of. I'm currently using this method to verify the WiFi was set up correctly:

  void printWiFiStatus() {
    // print your WiFi IP address
    IPAddress ip = WiFi.localIP();
    Serial.print(F("Module IP address:             "));
    Serial.println(ip);
    Serial.flush();
  
    // print your WiFi gateway
    IPAddress gw = WiFi.gatewayIP();
    Serial.print(F("Module gateway IP address:     "));
    Serial.println(gw);
    Serial.flush();
  
    // print your WiFi subnet mask
    IPAddress sm = WiFi.subnetMask();
    Serial.print(F("Module subnet mask:            "));
    Serial.println(sm);
    Serial.flush();
  
    // print the received signal strength
    long rssi = WiFi.RSSI();
    Serial.print(F("Module signal strength (RSSI): "));
    Serial.print(rssi);
    Serial.println(F(" dBm"));
    Serial.flush();
  }

The values that were being printed were definitely wrong and it took a little bit of trial and error to fix it:

      WiFi.config(
        config::STATIC_IP,
        config::STATIC_GATEWAY,
        config::STATIC_SUBNET_MASK,
        config::DNS  
      );

This was the resulting output from Serial:

Module IP address:             192.168.1.100
Module gateway IP address:     192.168.1.1
Module subnet mask:            255.255.255.0
Module signal strength (RSSI): -61 dBm

My question is whether the order of the parameters depends on the board I'm deploying to or whether the documentation is incorrect. It's not enough that this is working just for this particular board. I'm trying to develop for a codebase that could potentially be deployed to several kinds of boards. Having to swap params around based on boards will get a little tidious...

I've also been told that setting the pin modes for the wifi module is a good best practice when writing board-agnostic code. I'm wonder if the pin modes affect the order of these parameters or if I were to screw up the pin modes whether that would also affect the order of the parameters. My current code doesn't bother with the pin modes, but that may be changing as my project progresses. Any advice or tips to that point would also be appreciated.

You're not using the right documentation, the documentation you linked to is for the Arduino WiFi library that comes with WiFi-enabled official Arduino boards. You need the documentation for ESP32:

Thanks for the clarification! Looks like this project is going to be a little more complicated than I initially thought...

It's probably best to abstract away these platform-specific differences in some helper functions in a separate file, selecting the correct implementation using #ifdef ESP32, for example.

Yep. That's becoming the plan.