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() { void calibrate() {
int reading; int reading;
float s;
int i, j;
int wait = 200;
LOG("Calibrating atomizer actuation..."); LOG_NEW_LINE 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 LOG("Calibration loop "); LOG(i); LOG_NEW_LINE
// do some readings on current state // do some readings on current state
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
reading = analogRead(pinSensor); reading = analogRead(pinSensor);
minmax.put( reading ); minmax.put( reading );
delay(wait);
} }
toggle(); // change state toggle(); // change state
// do some more readings // do some more readings
for(int i = 0; i < 10; i++) {
for(int k = 0; k < 10; k++) {
reading = analogRead(pinSensor); reading = analogRead(pinSensor);
minmax.put( reading ); minmax.put( reading );
delay(wait);
} }
toggle(); // change state again toggle(); // change state again

7
src/main.cpp

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

Loading…
Cancel
Save