From ad43cdea35d90f0df0596bd76675583ad528ff96 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sun, 25 Jul 2021 18:53:58 +0300 Subject: [PATCH] remove random data and related started concept --- fan_control/include/collector.hpp | 2 -- fan_control/src/collector.cpp | 28 +++++----------------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/fan_control/include/collector.hpp b/fan_control/include/collector.hpp index 439139d..659e47e 100644 --- a/fan_control/include/collector.hpp +++ b/fan_control/include/collector.hpp @@ -25,8 +25,6 @@ protected: int week_counter = 0; int month_counter = 0; - boolean started = false; - void add_month(int from ) ; void switch_logic(float in , float out); diff --git a/fan_control/src/collector.cpp b/fan_control/src/collector.cpp index ec76d16..26758df 100644 --- a/fan_control/src/collector.cpp +++ b/fan_control/src/collector.cpp @@ -22,32 +22,21 @@ DHT dht_in(1, DHT11); // D2 on mini , tx, 01 on basic DHT dht_out(3, DHT11); // D1 on mini , rx 03 on basic Collector collector; -float min_ran = 10; -float max_ran = 30; - -float next_rand( float old ){ - float f = old + random(-10 , 10) / 100.0 ; - if( f > max_ran) f = max_ran ; - if( f < min_ran) f = min_ran ; - return f; -} void collector_setup(){ // Initialize device. dht_in.begin(); dht_out.begin(); - float last_in = 20; - float last_out = 20; - for( int a = 0; a < PER_HOUR*WEEK ; a += 1 ) { - collector.add_week( last_in , last_out ); - last_in = next_rand(last_in); - last_out = next_rand(last_out); - } pinMode(RELAY_BUILTIN , OUTPUT); digitalWrite( RELAY_BUILTIN , LOW); collector.start(); } +void Collector::start(){ + week_counter = 0; + month_counter = 0; +} + void collector_loop(){ delay(DELAY); // Get temperature event and print its value. @@ -72,14 +61,7 @@ void Collector::add(float in , float out) } } -void Collector::start(){ - started = true; - week_counter = 0; - month_counter = 0; -} - void Collector::switch_logic(float in , float out){ - if( !started ) return ; if(out > (in + 1.0) ){ digitalWrite( RELAY_BUILTIN , HIGH); DEBUG_OUT.println("Switching on" );