text: /****************************************************************************************************************************
    defines.h
    For RP2040 boards using WIFI_GENERIC modules/shields, using much less code to support boards with smaller memory
    
    WiFiManager_Generic_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards 
    (https://github.com/khoih-prog/WiFiManager_Generic_Lite) to enable store Credentials in EEPROM/LittleFS for easy 
    configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
    
    Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_Generic_Lite
    Licensed under MIT license        
   *****************************************************************************************************************************/
  
  #ifndef defines_h
  #define defines_h
  
  /* Comment this out to disable prints and save space */
  #define DEBUG_WIFI_WEBSERVER_PORT     Serial
  #define WIFI_GENERIC_DEBUG_OUTPUT     Serial
  
  #define _WIFI_GENERIC_LOGLEVEL_       1
  
  #define DRD_GENERIC_DEBUG             true
  
  #if ( defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || \
        defined(ARDUINO_GENERIC_RP2040) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) )
    #if defined(WIFI_GENERIC_USE_RP2040)
      #undef WIFI_GENERIC_USE_RP2040
      #undef WIFI_USE_RP2040
    #endif
    #define WIFI_GENERIC_USE_RP2040     true
    #define WIFI_USE_RP2040             true
  #else
    #error This code is intended to run only on the RP2040 boards ! Please check your Tools->Board setting.
  #endif
  
    
  #if defined(WIFI_GENERIC_USE_RP2040) && defined(ARDUINO_ARCH_MBED)
  
    #warning Using ARDUINO_ARCH_MBED
    
    #if ( defined(ARDUINO_NANO_RP2040_CONNECT)    || defined(ARDUINO_RASPBERRY_PI_PICO) || \
          defined(ARDUINO_GENERIC_RP2040) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) )
      // Only undef known BOARD_NAME to use better one
      #undef BOARD_NAME
    #endif
    
    #if defined(ARDUINO_RASPBERRY_PI_PICO)
      #define BOARD_NAME      "MBED RASPBERRY_PI_PICO"
    #elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
      #define BOARD_NAME      "MBED ADAFRUIT_FEATHER_RP2040"
    #elif defined(ARDUINO_GENERIC_RP2040)
      #define BOARD_NAME      "MBED GENERIC_RP2040"
    #elif defined(ARDUINO_NANO_RP2040_CONNECT) 
      #define BOARD_NAME      "MBED NANO_RP2040_CONNECT"
    #else
      // Use default BOARD_NAME if exists
      #if !defined(BOARD_NAME)
        #define BOARD_NAME      "MBED Unknown RP2040"
      #endif
    #endif
  
  #endif
  
  /////////////////////////////////////////////
  
  // Add customs headers from v1.1.0
  #define USING_CUSTOMS_STYLE           true
  #define USING_CUSTOMS_HEAD_ELEMENT    true
  #define USING_CORS_FEATURE            true
  
  /////////////////////////////////////////////
  
  #define USE_WIFI_NINA             true
  #define USE_WIFI101               false
  #define USE_WIFI_CUSTOM           false
  
  #if USE_WIFI_NINA
  
    #warning Using WIFININA_Generic Library
    #define SHIELD_TYPE     "WiFiNINA using WiFiNINA_Generic Library"
  
    #include "WiFiNINA_Pinout_Generic.h"
    
  #elif USE_WIFI101
  
    #if defined(USE_WIFI_NINA)
      #undef USE_WIFI_NINA
    #endif
    
    #define USE_WIFI_NINA           false
  
    #define SHIELD_TYPE     "WINC1500 using WiFi101 Library"
    #warning Using WiFi101 Library
  
  #elif USE_WIFI_CUSTOM
  
    #if defined(USE_WIFI_NINA)
      #undef USE_WIFI_NINA
    #endif
    
    #define USE_WIFI_NINA           false
    
    #if defined(USE_WIFI101)
      #undef USE_WIFI101
    #endif
    
    #define USE_WIFI101             false
  
    #define SHIELD_TYPE     "Custom using Custom WiFi Library"
    #warning Using Custom WiFi Library. You must include here or compile error
  
    #define EspSerial Serial1
  
    #include "ESP8266_AT_WebServer.h"
  
    #define USE_ESP_AT_SHIELD       true
    #define WiFiWebServer ESP8266_AT_WebServer
    
  #else
  
    #define SHIELD_TYPE     "Default WiFi using WiFi Library"
    #warning Using fallback WiFi.h Library defined in WiFiWebServer Library.
    
  #endif
  
  /////////////////////////////////////////////
  
  // Permit running CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET times before reset hardware
  // to permit user another chance to config. Only if Config Data is valid.
  // If Config Data is invalid, this has no effect as Config Portal will persist
  #define RESET_IF_CONFIG_TIMEOUT                   true
  
  // Permitted range of user-defined RETRY_TIMES_RECONNECT_WIFI between 2-5 times
  #define RETRY_TIMES_RECONNECT_WIFI                3
  
  // Permitted range of user-defined CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET between 2-100
  #define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET    5
  
  // Config Timeout 120s (default 60s). Applicable only if Config Data is Valid
  #define CONFIG_TIMEOUT                      120000L
  
  /////////////////////////////////////////////
  
  // Permit input only one set of WiFi SSID/PWD. The other can be "NULL or "blank"
  // Default is false (if not defined) => must input 2 sets of SSID/PWD
  #define REQUIRE_ONE_SET_SSID_PW       false
  
  #define USE_DYNAMIC_PARAMETERS        true
  
  /////////////////////////////////////////////
  
  #define SCAN_WIFI_NETWORKS                  true
  
  // To be able to manually input SSID, not from a scanned SSID lists
  #define MANUAL_SSID_INPUT_ALLOWED           true
  
  /////////////////////////////////////////////
  
  #if (USE_WIFI_CUSTOM && USE_ESP_AT_SHIELD)
    // ESP-AT can't use longer than 2K HTML and DYNAMIC_PARAMETERS
    #undef USE_DYNAMIC_PARAMETERS
    #define USE_DYNAMIC_PARAMETERS                   false
    #warning Disable USE_DYNAMIC_PARAMETERS for ESP_AT_SHIELD
  
    // From 2-6 to keep HTML short for ESP8266-AT. Limited 6 in WiFiEspAT library anyway
    #define MAX_SSID_IN_LIST                  4
  
  #else
  
    // From 2-15
    #define MAX_SSID_IN_LIST                  8
  #endif
  
  /////////////////////////////////////////////
  
  #include <WiFiManager_Generic_Lite_RP2040.h>
  
  #define HOST_NAME   "RP2040-Master-Controller"
  
  #ifdef LED_BUILTIN
    #define LED_PIN     LED_BUILTIN
  #else
    #define LED_PIN     13
  #endif
  
  #endif      //defines_h
  