From: Michael R. <re...@eu...> - 2003-10-04 10:04:59
|
Hi lcd4linux-users, I want to give you some feedback about what has happened in my brain the past days... As some of you might know, I got two really cool displays from MatrixOrbital. They have features that lcd4linux does not support at the moment, so I tried to implement them: - Keypad support - temperature sensors - Fan RPM measurement - Fan PWM control You could dividethem into two parts: input functions (keypad, sensors) and output functions. I decided to work on the output first. The Fan PWM control acts like a normal GPO (which would be supported by lcd4linux), but it's not a 'digital' one (which could be switched on or of), but an analog one, which can have values from 0 (switched off) to 255 (full power). There's no support for such an analog GPO in lcd4linux. I started to modify this. Then I realized that building a value for such a GPO isn't that easy. Think of a combination of one or more temperature sensors, and the fan RPM control. How would you configure this? The best way would be the possibility to specify an algebraic expression, like fan1 = 1000+150*log(30+0.25*temp2) + 250*(25+0.18*temp3) such expressions would be cool with 'normal' GPO's, too. Now you can configure a GPO to be sensitive to any token, e.g. 'disk write: GPO1 %dw It would be activated whenever one single bit would go to the disk better would be GPO1 %dw>1000 or GPO1 %dw>%dr or anything you could think of... Then I found a little piece of code, called the "Expression Evaluator" by Mark Morley, and found this a very small and simple solution for my issues. The code supports 'normal' algebraic expressions (2+3), variable assignments (a=3; b=5; c=2*a+b), functions (sin(25*b), and can be easily extended or new functions added. To those concerned about size: It's really small, believe me! I cannot tell you exactly at the moment (as it does not compile), but I got an earlier version compiled and linked as a simple example, which has 10k. I already extended the code to support 'logical' expressions (a>5, b>10 & (c | d<100), and at the moment I'm implementing 'string' functions. As the code is that simple, and new functions can be easily registered, I thought this could be the basis for a redesign of some lcd4linux internals: Clients: Every client registers one or more new functions, and handles these functions with parameters: e.g. net(interface, direction) could be: net('*', 'r') or net('eth1', 'rw') So the long-wished 'statistices for each lan interface' could be solved this way One could do calculations with these functions: If you prefer PPP throughput in bytes/sec, you use ppp(0, r) If you prefer kB/sec, use ppp(0,r)/1024 If you prefer MB/h, use ppp(0,r)/1024/1024*3600 other advantage: the 'temp1.factor' and 'temp1.offset' would be obsolete... There would be a 'transform' function, where you could specify the field width and number of decimals, which is fixed now. Maybe like C printf(), maybe like dBase ('####.##') The layout config scheme would stay as it is, but would support such expressions, too. Code is not in the CVS by now, because it doesn't even compile. But this will change really quick... What do you think about this? Have you got any other ideas what we could solve with this method? Do you think this is a good idea? All comments are welcome! bye, Michael -- netWorks Vox: +43 316 698260 Michael Reinelt Fax: +43 316 692343 Geisslergasse 4 GSM: +43 676 3079941 A-8045 Graz, Austria e-mail: re...@eu... |