mirror of
https://github.com/skogaby/OpeNITHM.git
synced 2026-09-22 22:58:16 +03:00
Making some adjustments to IR auto calibration
This commit is contained in:
@@ -120,14 +120,16 @@ void AirSensor::analogCalibrate() {
|
||||
}
|
||||
|
||||
// take some initial readings before the main loop so we can establish baselines
|
||||
uint16_t max_values[6] = { 0, 0, 0, 0, 0, 0 };
|
||||
for (int sample = 0; sample < CALIBRATION_SAMPLES; sample++) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
max_values[i] = max(max_values[i], getValue(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
// determine the current thresholds for trigger
|
||||
// and release based on the configured delta threhsold
|
||||
// and the current readings
|
||||
uint16_t value = getValue(i);
|
||||
|
||||
states[i] = false;
|
||||
calcThresholds(i, value);
|
||||
calcThresholds(i, max_values[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
|
||||
#include <FastLED.h>
|
||||
|
||||
#define AIR_LED_DELAY 135
|
||||
#define AIR_LED_DELAY 100
|
||||
#define CALIBRATION_SAMPLES 100
|
||||
|
||||
#ifndef KEY_DIVIDERS
|
||||
extern CRGB leds[16];
|
||||
@@ -30,7 +31,7 @@ extern CRGB leds[31];
|
||||
|
||||
class AirSensor {
|
||||
private:
|
||||
int deltaThreshold = 80;
|
||||
int deltaThreshold = 45;
|
||||
double releaseThreshold = 0.5;
|
||||
int calibrationCounter;
|
||||
bool calibrated;
|
||||
|
||||
Reference in New Issue
Block a user