text: /****************************************************************************************************************************
    defines.h
    For ESP8266 boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
    Uploading SHT3x temperature and humidity data to Blynk
    
    Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
    Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
    Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager
    Licensed under MIT license
   *****************************************************************************************************************************/
  
  #ifndef defines_h
  #define defines_h
  
  
  #ifndef ESP8266
    #error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting.
  #endif
  
  #define BLYNK_PRINT         Serial
  #define BLYNK_HEARTBEAT     60
  
  #define DOUBLERESETDETECTOR_DEBUG     true    //false
  #define BLYNK_WM_DEBUG                1
  
  // #define USE_SPIFFS and USE_LITTLEFS   false        => using EEPROM for configuration data in WiFiManager
  // #define USE_LITTLEFS    true                       => using LITTLEFS for configuration data in WiFiManager
  // #define USE_LITTLEFS    false and USE_SPIFFS true  => using SPIFFS for configuration data in WiFiManager
  // Be sure to define USE_LITTLEFS and USE_SPIFFS before #include <BlynkSimpleEsp8266_WM.h>
  // From ESP8266 core 2.7.1, SPIFFS will be deprecated and to be replaced by LittleFS
  // Select USE_LITTLEFS (higher priority) or USE_SPIFFS
  
  #define USE_LITTLEFS                true
  //#define USE_LITTLEFS                false
  #define USE_SPIFFS                  false
  //#define USE_SPIFFS                  true
  
  #if USE_LITTLEFS
    //LittleFS has higher priority
    #define CurrentFileFS     F("LittleFS")
    #ifdef USE_SPIFFS
      #undef USE_SPIFFS
    #endif
    #define USE_SPIFFS                  false
  #elif USE_SPIFFS
    #define CurrentFileFS     F("SPIFFS")
  #else
    #define CurrentFileFS     F("EEPROM")
    // EEPROM_SIZE must be <= 4096 and >= CONFIG_DATA_SIZE (currently 172 bytes)
    #define EEPROM_SIZE    (4 * 1024)
    // EEPROM_START + CONFIG_DATA_SIZE must be <= EEPROM_SIZE
    #define EEPROM_START  0
  #endif
  
  // Force some params in Blynk, only valid for library version 1.0.1 and later
  #define TIMEOUT_RECONNECT_WIFI                    10000L
  #define RESET_IF_CONFIG_TIMEOUT                   true
  #define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET    5
  
  // Config Timeout 120s (default 60s)
  #define CONFIG_TIMEOUT                            120000L
  // Those above #define's must be placed before #include <BlynkSimpleEsp8266_WM.h>
  
  
  #define MODEM_RST            D0     // Pin D0 mapped to pin GPIO16/USER/WAKE of ESP8266. This pin is also used for Onboard-Blue LED. 
  #define MODEM_PWKEY          D5     // Pin D5 mapped to pin GPIO14/HSCLK of ESP8266
  #define MODEM_POWER_ON       D6     // Pin D6 mapped to pin GPIO12/HMISO of ESP8266
  
  #define MODEM_TX             D8     // Pin D8 mapped to pin GPIO15/TXD2/HCS of ESP8266
  #define MODEM_RX             D7     // Pin D7 mapped to pin GPIO13/RXD2/HMOSI of ESP8266
  
  #define I2C_SDA              D2     // Pin D2 mapped to pin GPIO4/SDA of ESP8266
  #define I2C_SCL              D1     // Pin D1 mapped to pin GPIO5/SCL of ESP8266
  
  // Select your modem:
  #define TINY_GSM_MODEM_SIM800
  //#define TINY_GSM_MODEM_SIM808
  //#define TINY_GSM_MODEM_SIM868
  //#define TINY_GSM_MODEM_SIM900
  //#define TINY_GSM_MODEM_SIM5300
  //#define TINY_GSM_MODEM_SIM5320
  //#define TINY_GSM_MODEM_SIM5360
  //#define TINY_GSM_MODEM_SIM7000
  //#define TINY_GSM_MODEM_SIM7100
  //#define TINY_GSM_MODEM_SIM7500
  //#define TINY_GSM_MODEM_SIM7600
  //#define TINY_GSM_MODEM_SIM7800
  //#define TINY_GSM_MODEM_UBLOX
  //#define TINY_GSM_MODEM_SARAR4
  //#define TINY_GSM_MODEM_M95
  //#define TINY_GSM_MODEM_BG96
  //#define TINY_GSM_MODEM_A6
  //#define TINY_GSM_MODEM_A7
  //#define TINY_GSM_MODEM_M590
  //#define TINY_GSM_MODEM_MC60
  //#define TINY_GSM_MODEM_MC60E
  //#define TINY_GSM_MODEM_XBEE
  //#define TINY_GSM_MODEM_SEQUANS_MONARCH
  
  // Increase RX buffer if needed
  #define TINY_GSM_RX_BUFFER 1024
  
  #include <TinyGsmClient.h>
  
  //#define USE_BLYNK_WM      false
  #define USE_BLYNK_WM      true
  
  #include <BlynkSimpleTinyGSM_M.h>
  
  #if USE_BLYNK_WM
    #define USE_DYNAMIC_PARAMETERS                    true
    
    #include <BlynkSimpleEsp8266_GSM_WFM.h>
  
  #else
    #include <BlynkSimpleEsp8266_GSM_WF.h>
    
    // Your WiFi credentials.
    #define ssid  "****"
    #define pass  "****"
    
    #define USE_LOCAL_SERVER      true
    //#define USE_LOCAL_SERVER      false
    
    #if USE_LOCAL_SERVER
      #define wifi_blynk_tok        "****"
      #define gsm_blynk_tok         "****"
      //#define blynk_server          "account.duckdns.org"
      // Use direct IPAddress in case GPRS can't use DDNS fast enough and can't connect
      #define blynk_server          "xxx.xxx.xxx.xxx"
    #else
      #define wifi_blynk_tok        "****"
      #define gsm_blynk_tok         "****"
      #define blynk_server          "blynk-cloud.com"
    #endif
    
    #define apn         "rogers-core-appl1.apn"
    #define gprsUser    ""    //"wapuser1"
    #define gprsPass    ""    //"wap"
  
  #endif    //USE_BLYNK_WM
  
  #define BLYNK_HARDWARE_PORT       8080
  
  // Set serial for debug console (to the Serial Monitor, default speed 115200)
  #define SerialMon Serial
  
  #include <SoftwareSerial.h>
  SoftwareSerial SerialAT(MODEM_RX, MODEM_TX); // RX, TX
  
  // Uncomment this if you want to see all AT commands
  #define DUMP_AT_COMMANDS      false
  
  #if DUMP_AT_COMMANDS
    #include <StreamDebugger.h>
    StreamDebugger debugger(SerialAT, SerialMon);
    TinyGsm modem(debugger);
  #else
    TinyGsm modem(SerialAT);
  #endif
  
  #define HOST_NAME   "8266-GSM-WiFi"
  
  #endif      //defines_h
  