Changeset 5070
- Timestamp:
- 12/11/07 22:48:34 (7 months ago)
- Files:
-
- lm-sensors/branches/lm-sensors-3.0.0/CHANGES (modified) (1 diff)
- lm-sensors/branches/lm-sensors-3.0.0/prog/sensord/rrd.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/branches/lm-sensors-3.0.0/CHANGES
r5069 r5070 10 10 Warn about outputs found in automatic mode 11 11 sensord: Fix rrd support (#2276) 12 Use the same colors for daily and weekly charts 12 13 sensors-detect: Drop PCA9540 detection 13 14 lm-sensors/branches/lm-sensors-3.0.0/prog/sensord/rrd.c
r5069 r5070 295 295 } 296 296 297 /* Compute an arbitrary color based on the sensor label. This is preferred 298 over a random value because this guarantees that daily and weekly charts 299 will use the same colors. */ 300 static int 301 rrdCGI_color 302 (const char *label) { 303 unsigned long color = 0, brightness; 304 const char *c; 305 306 for (c = label; *c; c++) { 307 color = (color << 6) + (color >> (*c & 7)); 308 color ^= (*c) * 0x401; 309 } 310 color &= 0xffffff; 311 /* Adjust very light colors */ 312 brightness = (color & 0xff) + ((color >> 8) & 0xff) + (color >> 16); 313 if (brightness > 672) 314 color &= 0x7f7f7f; 315 /* Adjust very dark colors */ 316 else if (brightness < 96) 317 color |= 0x808080; 318 return color; 319 } 320 297 321 static int 298 322 rrdCGI_LINE … … 300 324 struct gr *data = (struct gr *) _data; 301 325 if (!feature || (feature->rrd && (feature->type == data->type))) 302 printf ("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, (int) random () & 0xffffff, label);326 printf ("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel, rrdCGI_color(label), label); 303 327 return 0; 304 328 }
