Suggestion: Change Sensor Value Background Color Upon Change of Sensor Value

Greetings Kind Regards Re/ 64 Pro v. 726-4800 May I suggest in order to easily notice changes in Sensor values such values be displayed w/ a changed text background color. As an example upon a change of value change the white text background to let's say orange then after a period of time let's say 5s (user settable of course) revert back to stable background color i.e. white, however if change occurs prior to this "stable" delay then from the orange to let's say green and so on. Thank You Kindly
 

SpeedyIV

Well-Known Member
You can already set a default color, and change to Red (critical) if the sensor value goes above or below user adjustable threshold values.

If I understand, you are asking for the color to change if the sensor value changes, then change the color back if the value stabilizes for a user settable period of time. If the value changes again before that time period has elapsed, it changes to a third color. Is this right? Questions that come to mind are:

  1. How much does the sensor value have to change to trigger the second color?
  2. Can the user set a threshold for this?
  3. Once it hits the threshold, does the color revert to the original color if the value stays at the new threshold value for longer than the user set time?
  4. If the value goes back to what is was originally within the time window, does the color change back to the original color or to the 3rd color?
  5. Does it only go back to the original color if the value stays within some new range for longer than the user set time, regardless of where it started or what the min and max values are at that time?
  6. Would the amount of change be percentage based or would each sensor have threshold steps for various colors (ex - VCore <1.00V=green, 1.00V<VCore<1.3V=yellow, 1.3V<VCore<1.4V=Orange, VCore >=1.4V=Red)?
Hysteresis could prevent the color from flickering. With either method (percentage or stepped), the behavior and range would depend on the sensor item. Some are binary (Yes or No), some are percentages so the range is 0% to 100%. then there are Frequencies, Voltages, Multipliers, Temps, MB. This could get complicated quickly.

Aquasuite can change the color of a gauge based on sensor value. You can break the range into sections and assign a color to each section. I'm not sure how many sections you can add, but at least 5. You can have the colors step or blend. I think something like this is doable, and I guess would require adding a bunch of options for colors, threshold values, and reset times in the Customize Values - Customize tab. This is something that Martin would have to weigh the investment to add all of this code verses how many people would use these features. It could become a "Color Quagmire" but the general idea of making the sensor item colors dynamic based on behavior (beyond what is already offered) is interesting.
 
Upon reflection on your thoughtful remarks it seems several possibilities exist i.e. to wit in particular

[1] Simple case i.e. any reading change no matter how small causes background color to change
[2] Same as [1] but with regard to reading change threshold
[3] Color is reading change amount dependent
[4] Same as [3] but with regard to change amount threshold
[5] Color is reading value dependent only
[6] Perhaps other possibilities exist not now apparent

The logic of each case is demonstrated via code below. Perhaps all questions can be answered by examination of same. - Kind Regards

// case 1
template<typename readingType>
struct sensor
{
color_type color;
time_type color_change_time;
readingType reading;
readingType previous_reading;
};
template<typename sensorType>
void on_sensor_reading(sensorType& sensor)
{
if(sensor.reading!=sensor.previous_reading)
{
if(sensor.color==STABLE_COLOR) sensor.color = FIRST_CHANGE_COLOR;
else if(sensor.color==FIRST_CHANGE_COLOR) sensor.color = SECOND_CHANGE_COLOR;
else if(sensor.color==SECOND_CHANGE_COLOR) sensor.color = FIRST_CHANGE_COLOR;
else oops();
sensor.color_change_time = NOW();
sensor.previous_reading = sensor.reading;
}
else
{
time_type now = NOW();
duration_type duration = now - sensor.color_change_time;
if(duration>=STABLE_DURATION) {
sensor.color = STABLE_COLOR;
sensor.color_change_time = now;
}
}
}

// case 2
template<typename readingType>
struct sensor
{
color_type color;
time_type color_change_time;
readingType reading;
readingType previous_reading;
readingType threshold;
};
template<typename sensorType>
void on_sensor_reading(sensorType& sensor)
{
if(sensor.reading!=sensor.previous_reading)
{
sensorType::readingType difference = absolute_value(sensor.reading-sensor.previous_reading);
if(difference>sensor.threshold)
{
if(sensor.color==STABLE_COLOR) sensor.color = FIRST_CHANGE_COLOR;
else if(sensor.color==FIRST_CHANGE_COLOR) sensor.color = SECOND_CHANGE_COLOR;
else if(sensor.color==SECOND_CHANGE_COLOR) sensor.color = FIRST_CHANGE_COLOR;
else oops();
sensor.color_change_time = NOW();
sensor.previous_reading = sensor.reading;
}
}
else
{
time_type now = NOW();
duration_type duration = now-sensor.color_change_time;
if(duration>=STABLE_DURATION) {
sensor.color = STABLE_COLOR;
sensor.color_change_time = now;
}
}
}

// case 3
template<typename readingType>
struct sensor
{
color_type color;
time_type color_change_time;
readingType reading;
readingType previous_reading;
};
template<typename readingType>
color_type set_color(readingType difference)
{
color_type color = // logic depending on difference
return color;
}
template<typename sensorType>
void on_sensor_reading(sensorType& sensor)
{
if(sensor.reading!=sensor.previous_reading)
{
readingType difference = absolute_value(reading-previous_reading);
sensor.color = set_color(difference);
color_change_time = NOW();
previous_reading = sensor.reading;
sensor.color_change_time = NOW();
sensor.previous_reading = sensor.reading;
} else
{
time_type now = NOW();
duration_type duration = now-sensor.color_change_time;
if(duration>=STABLE_DURATION) {
sensor.color = STABLE_COLOR;
sensor.color_change_time = now;
}
}
}

// case 4
template<typename readingType>
struct sensor
{
color_type color;
time_type color_change_time;
readingType reading;
readingType previous_reading;
readingType threshold;
};
template<typename readingType>
color_type set_color(readingType difference)
{
color_type color = // logic depending on difference
return color;
}
template<typename sensorType>
void on_sensor_reading(sensorType& sensor)
{
if(sensor.reading!=sensor.previous_reading)
{
sensorType::readingType difference = absolute_value(sensor.reading-sensor.previous_reading);
if(difference>sensor.threshold)
{
sensor.color = set_color(difference);
sensor.color_change_time = NOW();
sensor.previous_reading = sensor.reading;
}
} else
{
time_type now = NOW();
duration_type duration = now-sensor.color_change_time;
if(duration>=STABLE_DURATION) {
sensor.color = STABLE_COLOR;
sensor.color_change_time = now;
}
}
}

// case 5
template<typename readingType>
struct sensor
{
color_type color;
readingType reading;
};
template<typename readingType>
color_type set_color(readingType value)
{
color_type color = // logic depending on value
return color;
}
template<typename sensorType>
void on_sensor_reading(sensorType& sensor)
{
sensor.color = set_color(sensor.reading);
}
 
Top