mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-15 17:52:08 +02:00
MDNS replace board with model
This commit is contained in:
@ -710,8 +710,10 @@ bool hasSensorSGP = true;
|
||||
bool hasSensorSHT = true;
|
||||
int pmFailCount = 0;
|
||||
uint32_t factoryBtnPressTime = 0;
|
||||
String mdnsModelName = "";
|
||||
AgSchedule dispLedSchedule(DISP_UPDATE_INTERVAL, displayAndLedBarUpdate);
|
||||
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL, updateServerConfiguration);
|
||||
AgSchedule configSchedule(SERVER_CONFIG_UPDATE_INTERVAL,
|
||||
updateServerConfiguration);
|
||||
AgSchedule serverSchedule(SERVER_SYNC_INTERVAL, sendDataToServer);
|
||||
AgSchedule co2Schedule(SENSOR_CO2_UPDATE_INTERVAL, co2Update);
|
||||
AgSchedule pmsSchedule(SENSOR_PM_UPDATE_INTERVAL, pmUpdate);
|
||||
@ -764,7 +766,6 @@ void setup() {
|
||||
connectToWifi();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send first data to ping server and get server configuration
|
||||
*/
|
||||
@ -1069,7 +1070,10 @@ static void webServerInit(void) {
|
||||
webServer.on("/metrics", HTTP_GET, webServerMetricsGet);
|
||||
webServer.begin();
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
MDNS.addServiceTxt("http", "_tcp", "board", ag.getBoardName());
|
||||
if (agServer.getModelName().isEmpty() != true) {
|
||||
MDNS.addServiceTxt("http", "_tcp", "model", agServer.getModelName());
|
||||
mdnsModelName = agServer.getModelName();
|
||||
}
|
||||
MDNS.addServiceTxt("http", "_tcp", "serialno", getDevId());
|
||||
MDNS.addServiceTxt("http", "_tcp", "fw_ver", ag.getVersion());
|
||||
|
||||
@ -1777,6 +1781,11 @@ static void updateServerConfiguration(void) {
|
||||
Serial.println("Connect to new mqtt broker failed");
|
||||
}
|
||||
}
|
||||
|
||||
if (mdnsModelName != agServer.getModelName()) {
|
||||
MDNS.addServiceTxt("http", "_tcp", "model", agServer.getModelName());
|
||||
mdnsModelName = agServer.getModelName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user