mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 06:06:23 +01:00
set dhcp hostname
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "udp.h"
|
||||
#include "web.h"
|
||||
#include "ips_display.h"
|
||||
#include "tag_db.h"
|
||||
|
||||
uint8_t WifiManager::apClients = 0;
|
||||
uint8_t x_buffer[100];
|
||||
@@ -103,8 +104,23 @@ bool WifiManager::connectToWifi(String ssid, String pass, bool savewhensuccessfu
|
||||
|
||||
_APstarted = false;
|
||||
WiFi.disconnect(false, true);
|
||||
WiFi.mode(WIFI_MODE_NULL);
|
||||
char hostname[32] = "OpenEpaperLink-AP\0";
|
||||
if (config.alias[0] != '\0') {
|
||||
int len = strlen(config.alias);
|
||||
int j = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
char c = config.alias[i];
|
||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '-') {
|
||||
hostname[j] = c;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
hostname[j] = '\0';
|
||||
}
|
||||
WiFi.setHostname(hostname);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.setSleep(WIFI_PS_NONE);
|
||||
WiFi.setSleep(WIFI_PS_MIN_MODEM);
|
||||
|
||||
terminalLog("Connecting to WiFi...");
|
||||
logLine("Connecting to WiFi...");
|
||||
|
||||
@@ -244,7 +244,7 @@ to save file system space">
|
||||
<div><span id="runstate"></div>
|
||||
<div><span id="apstatecolor">⬤</span> <span id="apstate">loading</span></div>
|
||||
<div><span id="apconfigbutton">AP config</span></div>
|
||||
<div><a href="/edit" target="littlefs" class="filebutton">file system</a></div>
|
||||
<div><a href="/edit" target="littlefs" class="filebutton">File System</a></div>
|
||||
</div>
|
||||
<div id="filterOptions">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user