diff --git a/src/core/CoolBoard.cpp b/src/core/CoolBoard.cpp index 61670896..f4105fa5 100644 --- a/src/core/CoolBoard.cpp +++ b/src/core/CoolBoard.cpp @@ -658,7 +658,7 @@ void CoolBoard::updateFirmware(String firmwareVersion, String firmwareUrl, delete this->coolWifi; INFO_LOG("Starting firmware update..."); t_httpUpdate_return ret = - ESPhttpUpdate.update(firmwareUrl, "", firmwareUrlFingerprint, true); + ESPhttpUpdate.update(firmwareUrl, "", firmwareUrlFingerprint); switch (ret) { case HTTP_UPDATE_FAILED: ERROR_VAR("HTTP Update failed, code:", ESPhttpUpdate.getLastError()); @@ -668,6 +668,8 @@ void CoolBoard::updateFirmware(String firmwareVersion, String firmwareUrl, case HTTP_UPDATE_OK: INFO_LOG("HTTP update succeeded!"); break; + case HTTP_UPDATE_NO_UPDATES: + break; } } else { ERROR_LOG("Cannot connect to Wifi, cancelling firmware update..."); diff --git a/src/core/CoolBoardSensors.cpp b/src/core/CoolBoardSensors.cpp index ec9cbda6..ad6e7406 100644 --- a/src/core/CoolBoardSensors.cpp +++ b/src/core/CoolBoardSensors.cpp @@ -57,11 +57,11 @@ void CoolBoardSensors::begin() { } this->setEnvSensorSettings(); delay(100); - uint8_t envSensorStatus = this->envSensor.begin(); + this->envSensor.begin(); // Make sure sensors had enough time to turn on. // BME280 requires 2ms to start up. delay(1000); - DEBUG_VAR("BME280 status after begin is:", envSensorStatus); + DEBUG_VAR("BME280 status after begin is:", this->envSensor.begin()); DEBUG_LOG("Builtin sensors started"); } diff --git a/src/core/ExternalSensor.h b/src/core/ExternalSensor.h index b55c8684..217b0379 100644 --- a/src/core/ExternalSensor.h +++ b/src/core/ExternalSensor.h @@ -45,7 +45,7 @@ class BaseExternalSensor { BaseExternalSensor() {} virtual uint8_t begin() { return (-2); } virtual float read() { return (-2); } - virtual float read(int16_t *a) { return (-42, 42); } + virtual float read(int16_t *a) { return (-42); } virtual float read(int16_t *a, int16_t *b, float *c) { return (-42.42); } virtual float read(uint32_t *a, uint32_t *b, uint32_t *c) { return (-42.42); } virtual float read(int16_t *a, int16_t *b, int16_t *c, int16_t *d) { @@ -74,7 +74,7 @@ template class ExternalSensor : public BaseExternalSensor { template <> class ExternalSensor : public BaseExternalSensor { public: - ExternalSensor(uint8_t i2c_addr) { sensor = NDIR_I2C(i2c_addr); } + ExternalSensor(uint8_t i2c_addr) : sensor(i2c_addr){} virtual uint8_t begin() { if (sensor.begin()) { delay(10000); @@ -93,7 +93,7 @@ template <> class ExternalSensor : public BaseExternalSensor { } private: - NDIR_I2C sensor = NULL; + NDIR_I2C sensor; }; template <> @@ -169,23 +169,17 @@ template <> class ExternalSensor : public BaseExternalSensor { ; float T = sensor.calculateTemperature(); sensor.setTempOffset(T - 25.0); + return(0); } virtual float read(int16_t *a, int16_t *b, float *c) { - uint16_t internC, internV; - float internT; - if (sensor.available()) { - internT = sensor.calculateTemperature(); + *c = sensor.calculateTemperature(); if (!sensor.readData()) { - internC = sensor.geteCO2(); - internV = sensor.getTVOC(); + *a = sensor.geteCO2(); + *b = sensor.getTVOC(); } } - - *a = (int16_t)internC; - *b = (int16_t)internV; - *c = internT; return (0.0); } @@ -271,7 +265,9 @@ template <> class ExternalSensor : public BaseExternalSensor { public: ExternalSensor() { sensor = Gauges(); } - virtual uint8_t begin() {} + virtual uint8_t begin(){ + return(0); + } virtual float read(uint32_t *a, uint32_t *b, uint32_t *c) { uint32_t A, B, C; @@ -293,9 +289,11 @@ template <> class ExternalSensor : public BaseExternalSensor { template <> class ExternalSensor : public BaseExternalSensor { public: ExternalSensor() : sensor(SHT1X_DATA_PIN, SHT1X_CLOCK_PIN) {} - virtual uint8_t begin() {} + virtual uint8_t begin() { + return(0); + } virtual float read(float *a, float *b) { - float A, B, C; + float A, B; A = sensor.readHumidity(); B = sensor.readTemperatureC(); *a = A; @@ -312,6 +310,7 @@ template <> class ExternalSensor : public BaseExternalSensor { ExternalSensor() : sensor() {} virtual uint8_t begin() { sensor.start(); + return(0); } virtual float read(float *a, float *b) { diff --git a/src/core/ExternalSensors.cpp b/src/core/ExternalSensors.cpp index e29507b3..88f68e27 100644 --- a/src/core/ExternalSensors.cpp +++ b/src/core/ExternalSensors.cpp @@ -65,7 +65,7 @@ void ExternalSensors::begin() { sensors[i].exSensor->begin(); sensors[i].exSensor->read(&C02, &VOT, &Temp); } else if ((sensors[i].reference) == "Adafruit_ADS1015") { - int16_t channel0, channel1, channel2, channel3, diff01, diff23; + int16_t channel0, channel1, channel2, channel3; int16_t gain0, gain1, gain2, gain3; std::unique_ptr> analogI2C( new ExternalSensor(sensors[i].address)); @@ -76,7 +76,7 @@ void ExternalSensors::begin() { &gain2, &channel3, &gain3); } else if ((sensors[i].reference) == "Adafruit_ADS1115") { - int16_t channel0, channel1, channel2, channel3, diff01, diff23; + int16_t channel0, channel1, channel2, channel3; int16_t gain0, gain1, gain2, gain3; std::unique_ptr> analogI2C( @@ -92,13 +92,11 @@ void ExternalSensors::begin() { sensors[i].exSensor = gauge.release(); sensors[i].exSensor->read(&A, &B, &C); } else if ((sensors[i].reference) == "SHT1x") { - float A, B, C; std::unique_ptr> CoolSHT1x( new ExternalSensor()); sensors[i].exSensor = CoolSHT1x.release(); sensors[i].exSensor->begin(); } else if ((sensors[i].reference) == "SDS011") { - float A, B; std::unique_ptr> sds011( new ExternalSensor()); sensors[i].exSensor = sds011.release(); @@ -130,7 +128,7 @@ void ExternalSensors::read(JsonObject &root) { root[sensors[i].kind2] = T; } else if ((sensors[i].reference == "Adafruit_ADS1015") || (sensors[i].reference == "Adafruit_ADS1115")) { - int16_t channel0, channel1, channel2, channel3, diff01, diff23; + int16_t channel0, channel1, channel2, channel3; int16_t gain0, gain1, gain2, gain3; sensors[i].exSensor->read(&channel0, &gain0, &channel1, &gain1, @@ -154,7 +152,7 @@ void ExternalSensors::read(JsonObject &root) { root[sensors[i].kind1] = B; root[sensors[i].kind2] = C; } else if (sensors[i].reference == "SHT1x") { - float A, B, C; + float A, B; sensors[i].exSensor->read(&A, &B); root[sensors[i].kind0] = A; root[sensors[i].kind1] = B; diff --git a/src/extras/CoolAdafruit_CCS811.cpp b/src/extras/CoolAdafruit_CCS811.cpp index dd8c2466..9824b0c1 100644 --- a/src/extras/CoolAdafruit_CCS811.cpp +++ b/src/extras/CoolAdafruit_CCS811.cpp @@ -86,8 +86,8 @@ void Adafruit_CCS811::setEnvironmentalData(uint8_t humidity, double temperature) humidity would be 0x61, 0x00.*/ /* Temperature is stored as an unsigned 16 bits integer in 1/512 - degrees; there is an offset: 0 maps to -25°C. The default value is - 25°C = 0x64, 0x00. As an example 23.5% temperature would be + degrees; there is an offset: 0 maps to -25�C. The default value is + 25�C = 0x64, 0x00. As an example 23.5% temperature would be 0x61, 0x00. The internal algorithm uses these values (or default values if not set by the application) to compensate for changes in @@ -171,7 +171,6 @@ void Adafruit_CCS811::_i2c_init() void Adafruit_CCS811::read(uint8_t reg, uint8_t *buf, uint8_t num) { - uint8_t value; uint8_t pos = 0; //on arduino we need to read in 32 byte chunks diff --git a/src/extras/CoolNDIR_I2C.cpp b/src/extras/CoolNDIR_I2C.cpp index 69b58a03..b6bfd4ac 100644 --- a/src/extras/CoolNDIR_I2C.cpp +++ b/src/extras/CoolNDIR_I2C.cpp @@ -207,7 +207,6 @@ uint8_t NDIR_I2C::receive(uint8_t *pbuf, uint8_t n) { uint8_t NDIR_I2C::read_register(uint8_t reg_addr, uint8_t *pval) { - uint8_t result; WIRE.beginTransmission(i2c_addr); WIRE.write(reg_addr << 3); @@ -227,7 +226,6 @@ uint8_t NDIR_I2C::read_register(uint8_t reg_addr, uint8_t *pval) uint8_t NDIR_I2C::write_register(uint8_t reg_addr, uint8_t *pdata, uint8_t n) { - uint8_t result; WIRE.beginTransmission(i2c_addr); WIRE.write(reg_addr << 3); diff --git a/src/extras/WiFiManagerReadFileButton.cpp b/src/extras/WiFiManagerReadFileButton.cpp index cf2db8e9..0b5bb656 100644 --- a/src/extras/WiFiManagerReadFileButton.cpp +++ b/src/extras/WiFiManagerReadFileButton.cpp @@ -736,7 +736,7 @@ bool WiFiManager::handleFileRead(String path){ if(SPIFFS.exists(pathWithGz)) path += ".gz"; File file = SPIFFS.open(path, "r"); - size_t sent = server->streamFile(file, contentType); + server->streamFile(file, contentType); Serial.println(server->streamFile(file, contentType)); file.close(); return true;