src/analog/functions.h

Thu, 18 Aug 2022 17:07:47 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 18 Aug 2022 17:07:47 +0200
changeset 398
49cf387e9070
parent 322
e7ca120d93c7
permissions
-rw-r--r--

After brewing show final IBU on the first tab.

316
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /***************************************************************************
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * Copyright (C) 2006-2008 by Tomasz Ziobrowski *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 * http://www.3electrons.com *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * e-mail: t.ziobrowski@3electrons.com *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * (at your option) any later version. *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * GNU General Public License for more details. *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * along with this program; if not, write to the *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 * Free Software Foundation, Inc., *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 ***************************************************************************/
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 #ifndef _FUNCTIONS_H_
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 #define _FUNCTIONS_H_
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include <assert.h>
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 #include <cmath>
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 //#include <iostream> // dla testów
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 using namespace std;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 /**
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 * Znajduje największą wartość mniejszą od scaleSize/steps i
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 * jednocześnie będącą całkowicie podzielną przez wartość
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 * 10^N gdzie n jest dowolną liczbą całkowitą.
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 * dla 5,2,1 jest to odpowiedniio {...,500,50,5,0.5,...},
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 * {...200,20,2,0.2,0.02,...} etc.
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 */
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 double minimalStep(double scaleSize, int steps);
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 /**
322
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
45 * Template function for determining the scale in a given interval with a designated number of scale points.
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
46 * On the basis of the minimum and maximum value that we want to achieve, sets the values of m_min and m_max
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
47 * in such a way that the entire scale range (m_max-m_min) was divisible by the number of scale points and
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
48 * the distance between the scale points was the value which is a multiplication of number 5.
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
49 * Additionally, it is possible to shift the scale left or right so that it starts as close to the minimum
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
50 * value or ends as close to the maximum value.
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
51 *
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
52 * @param m_minimum - minimum value on the scale to be visible
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
53 * @param m_maximum - maximum value on the scale to be visible
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
54 * @param m_min - the computed starting value of the scale
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
55 * @param m_max - the computed end value of the scale
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
56 * @param stesp - number of nodes to have in the scale
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
57 * @param left - whether the scale should be left or right aligned (default is right).
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
58 * @return - The function returns the value true if the values of m_min and m_max
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
59 * changed their value as a result of changing the range.
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
60 * Based on this value, it is known whether it is necessary, for example,
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
61 * to redraw the scale - giving previously previous values of the scale range
e7ca120d93c7 More Polish to English translations
Michiel Broek <mbroek@mbse.eu>
parents: 316
diff changeset
62 */
316
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 template <typename T>
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 bool range(T m_minimum,T m_maximum, T & m_min, T & m_max,unsigned int steps, bool left = false,double inc = 5.0)
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 {
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 //cout<<"("<<m_minimum<<","<<m_maximum<<") ("<<m_min<<","<<m_max<<")"<<endl;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 T max_tmp = m_max, min_tmp = m_min;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69 m_max=m_maximum;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 m_min=m_minimum;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 assert( m_max > m_min );
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 // assert( (m_max - m_min) > 0 );
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73 // if (m_max<0) left!=left;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 T diff = abs(m_max - m_min);
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 T scale = 0, factor = 0 ;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 while (inc * steps > (m_maximum-m_minimum))
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 if (inc/10 > 0 ) inc/=10;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 else break;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 bool done = false;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 while ( diff > scale )
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 { factor+=static_cast<T>(inc); scale = factor * steps; }
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 while (!done)
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 {
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 // dirty hack to have zero equal exactly zero
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 if (m_max<0) m_max=m_min - fmodf(m_min,steps);
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 else m_max = 0.0;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 while ( m_max < m_maximum ) m_max +=factor;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 m_min = m_max - scale;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 if (m_min <= m_minimum ) done = true;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 else { factor+=static_cast<T>(inc); scale = factor * steps; }
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 }
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 // Wprowadzenie koretkty by skala nie przesuwała się w lewo na osi X
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 if (left)
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 while (m_min + factor <= m_minimum)
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 {
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 m_min+=factor;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 m_max+=factor;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 }
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 // cout<<"Min:"<<m_min<<" Max:"<<m_max<<endl;
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 return (m_max != max_tmp) | (m_min != min_tmp);
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 }
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109
dcd472be9ae8 Added led, manometer, thermometer and wallclock from the abandoned AnalogWidgets project as plugins. There is some work to do but it's already usable for the monitor screens.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 #endif // _FUNCTIONS_H_

mercurial