Add Possibility to Change Default IP Adresse

Usual IP Address of 192.168.4.1 change to 192.168.1.1 for futur compatibility with Skydemon

You can put your IP address in begin of config.h
pull/30/head
Fab501 2021-01-31 15:31:33 +01:00 zatwierdzone przez GitHub
rodzic 57cb211177
commit 5b2e39f957
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 34 dodań i 7 usunięć

Wyświetl plik

@ -4,7 +4,18 @@
#define DEFAULT_PPSdelay 100
#define DEFAULT_FreqPlan 0
#define DEFAULT_DispPage 3 // Fab501 Page to Display After Boot or Reset
#define WIFI_ADDRESS_IP1 192 // 192.168.1.1 for IP Address
#define WIFI_ADDRESS_IP2 168
#define WIFI_ADDRESS_IP3 1
#define WIFI_ADDRESS_IP4 1
#define WIFI_ADDRESS_GW1 0 // 0.0.0.0 for Gateway
#define WIFI_ADDRESS_GW2 0
#define WIFI_ADDRESS_GW3 0
#define WIFI_ADDRESS_GW4 0
#define WIFI_ADDRESS_MK1 255 // 255.255.255.0 for Mask
#define WIFI_ADDRESS_MK2 255
#define WIFI_ADDRESS_MK3 255
#define WIFI_ADDRESS_MK4 0
// #define WITH_HELTEC // HELTEC module: PCB LED on GPI025
// #define WITH_HELTEC_V2 // HELTEC module v2
@ -53,8 +64,8 @@
// #define WITH_BMX055 // BMX055 magnetic and IMU sensor
// #define WITH_LORAWAN // LoRaWAN connectivity
// #define WITH_FANET // FANET transmission and reception
#define WITH_LORAWAN // LoRaWAN connectivity
#define WITH_FANET // FANET transmission and reception
#define WITH_PAW // Add PAW transmission
#define WITH_PFLAA // PFLAU and PFLAA for compatibility with XCsoar and LK8000
@ -77,10 +88,10 @@
#define WITH_LOG // log own positions and other received to SPIFFS
// #define WITH_SDLOG // log own position and other data to uSD card
#define WITH_STRATUX
//#define WITH_STRATUX
#define WITH_BT_SPP // Bluetooth serial port for smartphone/tablet link
#define WITH_WIFI // attempt to connect to the wifi router for uploading the log files
// #define WITH_AP // Open Access Point MOde
#define WITH_AP // Open Access Point MOde
#define WITH_HTTP // Open Web Interface
// #define WITH_ENCRYPT // Encrypt (optionally) the position

Wyświetl plik

@ -1,5 +1,5 @@
#include <string.h>
#include "config.h" //Added By Fab501
#include "wifi.h"
#include "format.h"
@ -48,7 +48,23 @@ static esp_err_t WIFI_event_handler(void *ctx, system_event_t *event)
return ESP_OK; }
esp_err_t WIFI_Init(void)
{ esp_err_t Err;
{
//Fab501 test to change IP to 192.168.1.1 for comptability with SkyDemon
esp_netif_init();
ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t* wifiAP = esp_netif_create_default_wifi_ap();
esp_netif_ip_info_t ipInfo;
IP4_ADDR(&ipInfo.ip, WIFI_ADDRESS_IP1,WIFI_ADDRESS_IP2,WIFI_ADDRESS_IP3,WIFI_ADDRESS_IP4); // Change IP in config.h
IP4_ADDR(&ipInfo.gw, WIFI_ADDRESS_GW1,WIFI_ADDRESS_GW2,WIFI_ADDRESS_GW3,WIFI_ADDRESS_GW4); // Change GATEWAY in config.h
IP4_ADDR(&ipInfo.netmask, WIFI_ADDRESS_MK1,WIFI_ADDRESS_MK2,WIFI_ADDRESS_MK3,WIFI_ADDRESS_MK4); // change MASK in config.h
esp_netif_dhcps_stop(wifiAP);
esp_netif_set_ip_info(wifiAP, &ipInfo);
esp_netif_dhcps_start(wifiAP);
// end of Fab501 changes
esp_err_t Err;
tcpip_adapter_init();
Err = esp_event_loop_init(WIFI_event_handler, NULL); if(Err!=ESP_OK) return Err;
wifi_init_config_t Config = WIFI_INIT_CONFIG_DEFAULT();