Browse Source

improved the calibration process

master
Luis Rodil-Fernandez 3 years ago
parent
commit
32069f0424
  1. 11
      src/atomizer.h
  2. 7
      src/main.cpp

11
src/atomizer.h

@ -32,26 +32,27 @@ class Atomizer {
void calibrate() {
int reading;
float s;
int i, j;
int wait = 200;
LOG("Calibrating atomizer actuation..."); LOG_NEW_LINE
for(i = 0; i < 5; i++) {
for(int i = 1; i < 5; i++) {
LOG("Calibration loop "); LOG(i); LOG_NEW_LINE
// do some readings on current state
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
reading = analogRead(pinSensor);
minmax.put( reading );
delay(wait);
}
toggle(); // change state
// do some more readings
for(int i = 0; i < 10; i++) {
for(int k = 0; k < 10; k++) {
reading = analogRead(pinSensor);
minmax.put( reading );
delay(wait);
}
toggle(); // change state again

7
src/main.cpp

@ -1,4 +1,7 @@
#include <Arduino.h>
#define LOG_ENABLED
#include <easywifi.h>
#include <derfunke.h>
#include <nanolog.h>
@ -49,12 +52,12 @@ void setup() {
Serial.println("Brace! Brace! trying to continue without wifi...");
}
fog.calibrate();
mqtt_init();
Serial.println("Initializing DHT sensor...");
dht.begin();
fog.calibrate();
}
void dht_report_reading(tDHTReading &r) {

Loading…
Cancel
Save