Skip to content

Commit

Permalink
Merge pull request #119 from kike-canaries/fix_co2_alt_issues
Browse files Browse the repository at this point in the history
Fix co2 alt issues
  • Loading branch information
hpsaturn authored Aug 27, 2021
2 parents 1a9e951 + 73f3039 commit db97555
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/configlib/ConfigApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ bool ConfigApp::saveAltitudeOffset(float offset) {
saveFloat("altoffset", offset);
Serial.print("-->[CONF] sensor altitude offset: ");
Serial.println(offset);
if(mRemoteConfigCallBacks!=nullptr) this->mRemoteConfigCallBacks->onAltitudeOffset(offset);
return true;
}

Expand Down
1 change: 1 addition & 0 deletions lib/configlib/ConfigApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class RemoteConfigCallbacks {
public:
virtual ~RemoteConfigCallbacks () {};
virtual void onCO2Calibration();
virtual void onAltitudeOffset(float altitude);
};

#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_CFGHANDLER)
Expand Down
7 changes: 4 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ platform = espressif32
framework = arduino
upload_speed = 1500000
monitor_speed = 115200
version = 0.4.0
revision = 815
version = 0.4.1
revision = 818
target = dev
monitor_filters = time
extra_scripts = pre:prebuild.py
Expand All @@ -25,7 +25,8 @@ lib_deps =
bblanchon/ArduinoJson @ ^6
tobiasschuerg/ESP8266 Influxdb @ ^3.8.0
https://github.com/hpsaturn/esp32FOTA.git
hpsaturn/CanAirIO Air Quality Sensors Library @ ^0.2.8

hpsaturn/CanAirIO Air Quality Sensors Library @ ^0.2.9

[esp32_common]
platform = espressif32
Expand Down
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ class MyRemoteConfigCallBacks : public RemoteConfigCallbacks {
Serial.println("-->[MAIN] onRemoteConfig CO2 Calibration");
sensors.setCO2RecalibrationFactor(418); // ==> Calibration factor on outdoors
};

void onAltitudeOffset (float altitude) {
Serial.println("-->[MAIN] onRemoteConfig new Altitude Offset");
sensors.setCO2AltitudeOffset(altitude);
};
};

/// sensors data callback
Expand Down Expand Up @@ -183,7 +188,7 @@ void setup() {
delay(500);
gui.showMain();
refreshGUIData();
delay(500);
delay(600);
sensors.loop();
sensors.setSampleTime(cfg.stime); // config sensors sample time (first use)
}
Expand Down

0 comments on commit db97555

Please sign in to comment.