Skip to content

Commit 074337a

Browse files
authored
Merge pull request #304 from airgradienthq/fix/api-root
FIX: HTTP domain configuration changes applied for OTA too
2 parents 764e2ea + 4daa817 commit 074337a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

examples/OneOpenAir/OneOpenAir.ino

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ void loop() {
352352
static bool pmsConnected = false;
353353
if (pmsConnected != ag->pms5003.connected()) {
354354
pmsConnected = ag->pms5003.connected();
355-
Serial.printf("PMS sensor %s ", pmsConnected?"connected":"removed");
355+
Serial.printf("PMS sensor %s \n", pmsConnected?"connected":"removed");
356356
}
357357
}
358358
} else {
@@ -566,7 +566,15 @@ void checkForFirmwareUpdate(void) {
566566
firmwareUpdateInProgress = true;
567567

568568
agOta->setHandlerCallback(otaHandlerCallback);
569-
agOta->updateIfAvailable(ag->deviceId().c_str(), GIT_VERSION);
569+
570+
String httpDomain = configuration.getHttpDomain();
571+
if (httpDomain != "") {
572+
Serial.printf("httpDomain configuration available, start OTA with custom domain\n",
573+
httpDomain.c_str());
574+
agOta->updateIfAvailable(ag->deviceId().c_str(), GIT_VERSION, httpDomain.c_str());
575+
} else {
576+
agOta->updateIfAvailable(ag->deviceId().c_str(), GIT_VERSION);
577+
}
570578

571579
// Only goes to this line if firmware update is not success
572580
// Handled by otaHandlerCallback

0 commit comments

Comments
 (0)