mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-08 20:46:52 +03:00
HostName Änderungen aufgeräumt und standard Hostname auf "watermeter" gesetzt
This commit is contained in:
@@ -23,6 +23,8 @@ std::string ssid;
|
|||||||
std::string passphrase;
|
std::string passphrase;
|
||||||
std::string hostname;
|
std::string hostname;
|
||||||
|
|
||||||
|
std::string std_hostname = "watermeter";
|
||||||
|
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
|
|
||||||
|
|
||||||
@@ -107,8 +109,9 @@ void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _ho
|
|||||||
wifi_event_group = xEventGroupCreate();
|
wifi_event_group = xEventGroupCreate();
|
||||||
ssid = _ssid;
|
ssid = _ssid;
|
||||||
passphrase = _passphrase;
|
passphrase = _passphrase;
|
||||||
if(_hostname.length() <= 0){
|
hostname = _hostname;
|
||||||
_hostname = "watermeter";
|
if(hostname.length() <= 0){
|
||||||
|
hostname = std_hostname;
|
||||||
}
|
}
|
||||||
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
|
esp_log_level_set("wifi", ESP_LOG_NONE); // disable wifi driver logging
|
||||||
tcpip_adapter_init();
|
tcpip_adapter_init();
|
||||||
@@ -116,7 +119,7 @@ void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _ho
|
|||||||
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK( esp_wifi_start() );
|
ESP_ERROR_CHECK( esp_wifi_start() );
|
||||||
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , _hostname.c_str());
|
esp_err_t ret = tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA , hostname.c_str());
|
||||||
if(ret != ESP_OK ){
|
if(ret != ESP_OK ){
|
||||||
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
|
ESP_LOGE(MAIN_TAG,"failed to set hostname:%d",ret);
|
||||||
}
|
}
|
||||||
@@ -124,7 +127,7 @@ void initialise_wifi(std::string _ssid, std::string _passphrase, std::string _ho
|
|||||||
tcpip_adapter_ip_info_t ip_info;
|
tcpip_adapter_ip_info_t ip_info;
|
||||||
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
|
ESP_ERROR_CHECK(tcpip_adapter_get_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info));
|
||||||
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
|
printf("IPv4 : %s\n", ip4addr_ntoa(&ip_info.ip));
|
||||||
printf("HostName : %s\n", _hostname.c_str());
|
printf("HostName : %s\n", hostname.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -132,7 +135,7 @@ void LoadWlanFromFile(std::string fn, std::string &_ssid, std::string &_passphra
|
|||||||
{
|
{
|
||||||
string line = "";
|
string line = "";
|
||||||
std::vector<string> zerlegt;
|
std::vector<string> zerlegt;
|
||||||
_hostname = "iciruit";
|
_hostname = std_hostname;
|
||||||
|
|
||||||
FILE* pFile;
|
FILE* pFile;
|
||||||
fn = FormatFileName(fn);
|
fn = FormatFileName(fn);
|
||||||
|
|||||||
Reference in New Issue
Block a user