Skip to content

Commit

Permalink
Merge branch 'v5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Rossmann committed Dec 10, 2020
2 parents 6d618ae + 51578fb commit dc29896
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions Software/co2ampel/co2ampel.ino
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,15 @@ void setConfig(String& jsonString) {
}

void startCalibration() {

uint16_t calibration_ppm = configManager.getUintValue("calibration_ppm", SCD30_CALIBRATION_PPM);

ledSetColor(YELLOW2);
delay(600000); // wait 10min
bool ok = false;
uint8_t calCount=0;
while (!ok && calCount<5) {
ok = airSensor.setForcedRecalibrationFactor(SCD30_CALIBRATION_PPM);
ok = airSensor.setForcedRecalibrationFactor(calibration_ppm);
Serial.print("calibration status from sensor: ");
Serial.println(ok);
ledSetColor(BLUE);
Expand All @@ -158,8 +161,8 @@ void startCalibration() {
delay(60000);

// check the next 20 values whether they are within the specification: +-(30ppm+3%MV)
uint16_t co2min=SCD30_CALIBRATION_PPM-(30+0.03*SCD30_CALIBRATION_PPM);
uint16_t co2max=SCD30_CALIBRATION_PPM+(30+0.03*SCD30_CALIBRATION_PPM);
uint16_t co2min=calibration_ppm-(30+0.03*calibration_ppm);
uint16_t co2max=calibration_ppm+(30+0.03*calibration_ppm);
for (uint8_t i=0; i < 20; i++) {
while (!digitalRead(GPIO_SCD30_RDY) || ! airSensor.dataAvailable()) {
delay(500);
Expand Down
4 changes: 2 additions & 2 deletions Software/co2ampel/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define CONFIG_H

/******************************* Version **************************************/
#define VERSION 4
#define VERSION 5

/******************************* MQTT **************************************/

Expand Down Expand Up @@ -38,7 +38,7 @@ enum Color {GREEN, YELLOW, RED, BLUE, DARK, WHITE, GREEN2, YELLOW2, RED2};
#define SCD30_CALIBRATION_MIN_RUNTIME 180 //seconds
#define SCD30_MEASUREMENT_INTERVAL 2 // seconds (recalibrate, if you change this value)
#define SCD30_MIN_PPM 350
#define SCD30_CALIBRATION_PPM 450
#define SCD30_CALIBRATION_PPM 450 // overriden by calibration_ppm from config.json

/******************************* thresholds **************************************/
#define TH_GREEN 800 //overriden by th_green from config.json
Expand Down

0 comments on commit dc29896

Please sign in to comment.