feat: set dhcp hostname
This commit is contained in:
parent
e5207e00de
commit
f88dcd6376
2 changed files with 3 additions and 2 deletions
|
@ -16,4 +16,4 @@ upload_protocol = esptool
|
||||||
lib_deps =
|
lib_deps =
|
||||||
adafruit/Adafruit NeoPixel@^1.11.0
|
adafruit/Adafruit NeoPixel@^1.11.0
|
||||||
sstaub/NTP@^1.6
|
sstaub/NTP@^1.6
|
||||||
https://git.kabelsalat.ch/s3lph/Arduino-Library-SoftDhcp.git@^0.0.1
|
https://git.kabelsalat.ch/s3lph/Arduino-Library-SoftDhcp.git@^0.0.2
|
||||||
|
|
|
@ -54,7 +54,7 @@ void setupNtp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void expired() {
|
void expired() {
|
||||||
//Serial.println("DHCP lease expired, stopping NTP");
|
Serial.println("DHCP lease expired, stopping NTP");
|
||||||
ntp.stop();
|
ntp.stop();
|
||||||
ntpInitialized = false;
|
ntpInitialized = false;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
dhcp.onLease(setupNtp);
|
dhcp.onLease(setupNtp);
|
||||||
dhcp.onExpire(expired);
|
dhcp.onExpire(expired);
|
||||||
|
dhcp.hostname("ambient-lighting-clock");
|
||||||
dhcp.requestOption(DHCP_TIME_SERVERS);
|
dhcp.requestOption(DHCP_TIME_SERVERS);
|
||||||
dhcp.begin();
|
dhcp.begin();
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
|
|
Loading…
Reference in a new issue