积分充值 天气与日历 切换到宽版
扫描二维码关注官方公众号
返回列表 发布新帖

[玩法/技巧] 搞定属于自己的LCD,小白教你修改CONF文件(完工,真累)

 火...
44807 349
发表于 2014-5-18 12:19:49 | 显示全部楼层 阅读模式

来吧兄弟,一起玩一起讨论!

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 xjcsuper 于 2014-5-18 23:43 编辑

      首先,LINUX不是我的强项,可以说是一个小白,另外鉴于目前网上关于LCD4linux的相关资料比较少,而现在坛里大家在用的LCD4linux都是大神重编译好的,也没有相关的说明文档,对于conf配置脚本用的参数定义什么的大家也许感到无从下手,(大神们列外)。在当O大还没有放出128X128的配置文件时,我花了一晚上时间,将O大百度盘上的320X240的配置文件,着手修改为128X128的,利用的图片素材也是原来的,虽然没 O大的漂亮,但也在修改当中对配置文件的各项参数有了一些理解。当看到O大的那个交替显示天气 时间的CONF时我又从中学到了交替显示信息的方法。O大放出了非常完美的CONF,在此再次感谢。但我想很多人都想根据自己的需求和个性定制自己的LCD,为了帮还在为此奋斗人们实现这个愿望,小生决定把我所理解的分享给大家,做出自己的LCD界面。本人表达水平有限,如有不妥和不对之处还望各路大神指教,改之
      慢慢来吧,码字不容易,我慢慢来
      在讲配置文件前,先讲下LCD,以1.5寸128X128的LCD为例,就是横向128个像素,纵向128个像素,共16384个像素点组成了这块屏。了解LCD的像素有利于我们后面在设置各个小部件的位置.
     一个完整的CONF文件一般有四部分,由开头的基本环境设置,包括了USB端口,字体规格,前景色,背景色,LCD显示方向,亮度等;接下来是各个小部件的设定,小部件基本上有图像,文本,进度条,及计时器种类(可能还有更多的,在我参考的CONF中只发现了这些);然后是布局设定,这里定义了所有小部件的在屏幕上的位置;最后是变量的参数设定,变量是为了方便在前面的小部件设定设置参数而将一些常用的参数如文件目录、更新时间、网口号等赋值到一个变量上,使以后修改设置变得轻松。
  下面我就一部分一部分来说一下详细的设定及我了解的参数意义。

一、开头的基本环境设置
以开头段的代码例子来说明一下,#后面是注解
Display dpf {
Driver     'DPF'  #驱动的设备类型吧,DPF是指数码相框,不用改
Port       'usb0'  #USB端口,这里不需要改
Font       '6x8'  #定义字体大小,6X8表示一个字符横向占用6个像素,纵向占用8个像素,知道这个对后面小部件设定位置很重要
Foreground 'ffffff'    #前景色
Background 'ffffff00'   #背景色
Basecolor  '000000'   #基本颜色,这在个设定可以自己改改测试,一般不需要动
Orientation 0          # LCD的显示方向,这里可以设置0-3分别表示正常、旋转90°,180°,270°显示
Backlight  backlight   # 背光亮度控制,可以设成0-7,0可以关闭背光,7最亮,而这里用的是backlight,是一个变量,也就是根据文件末尾设定的这个变量的值来决定开初始的背光亮度。
}

二,小部件的设定
目前我理解的小部件有图像,文本,进度条,计时器四类,通过这四类小部件可以添加用来显示时间的图片素材,及各类文字显示状态进度条,及不可见的定时用来改变一些变量的值等等。下面同样通过例子说明。

1.图像小部件
Widget Month1 {  #小部件Month1,这里的Month1只是一个名称,可以自己定义,这里意思是月份的第一位数,也就是十位
class 'Image'    #这里指定的部件的类型为'Image'即图像
file imgadir . 'date'. substr(strftime('%m', time()),0,1) . '.png'  #指定图像的具体位置,这里稍后做下详解
reload 1  #设定1重新加载
update tick #更新时间设置,这就是理新这个图像的时间,单位是MS,这里用了变量tick代替
inverted 0  #设定图像是否反色差显示,类似于底片色吧,0否,1是,一般不用改
visible 1   #这里设置图像是否可见,1为可见
}  #以上一个完整的图像小部件设定,这里设定了具显示哪个图像素材,多久更新一次,及图像是否可见这些定义

Widget Month2 {  #同上一段代码,这段指定了月份的第二位数,也就是个位,两个图片组合在一起就形成了05这样一个图片显示的月份
class 'Image'
file imgadir . 'date'. substr(strftime('%m', time()),1,1) . '.png'
reload 1
update tick
inverted 0
visible 1
}
在上面的图像小部件代码中,file imgadir . 'date'. substr(strftime('%m', time()),0,1) . '.png' 这一段就当前05月来说等价于 file '/usr/share/lcd4linux/mytheme/img/date0.png' .也就是指定显示date0.png,这个0数字的图片素材。其中的imgadir是个变量,这表示了在CONF文件末尾的变量定义段代码中 imgadir '/usr/share/lcd4linux/mytheme/img/'这段变量定义中的'/usr/share/lcd4linux/mytheme/img/',后面紧跟的符号.为连接符意为将前面的变量跟后面的'date'字符连接起来,单引号中的内容是指定为字符,而不是其它的变量或命令,连接起来就成了'/usr/share/lcd4linux/mytheme/img/date',然后再是连接符.连接的substr(strftime('%m', time()),0,1) 这一段是一段表达式得到的月份的第一个数字0,strftime('%m', time())得到提十进制的月份数字05,而substr是取字符命令,和后面的0,1一起就表示取05这个字符串中从左边0位开如右边第一个字,也就是0,同理substr(strftime('%m', time()),1,1)的意思就是取了05字符串中的第一位后面的一个字,就是5,因此,再连接上后面的'png'.就形成了图片素材的完整路径'/usr/share/lcd4linux/mytheme/img/date0.png' 和'/usr/share/lcd4linux/mytheme/img/date5.png' .这样表达不知大家理解了没有,总之就是利用函数得到相应变化图像素材的完整路径用来显示在屏上。

2.文本小部件
现在我们再来理解下文本小部件的代码定义,上例子
下面是用来显示内存总量的一段文本
Widget RAMText {   #这里同样是指定不部件的名称,可以自己定你不叫内存,叫abc可以,为了规范还是设成看得懂的好
class  'Text'     #指定部件类型为文本
expression meminfo('MemTotal')/1024   #这通过一个表达式得到内存的总量数值,KB单位,通过公式/1024得到的是MB单位数字
prefix 'RAM'   #定义这段文本前面要加上的字符,这里是在内存数值前面加上RAM文字,不需要可心删掉这行参数
postfix 'MB'   #定义文本段后面加上的字符,这里是在内存数值后面加上MB文字,这样就会形成RAM 1024MB这类显示,不需要可心删掉这行参数
precision  0  #这里定义精度,也就是通过表达式得到数字的精度,设定为小数点后面几位,0为整数,如需保留2位,设定为2
width  10   #宽度设定,10  指这一行文本部件的宽度,10表示可以显示10个字符
align  'R'    #这里是文本对齐,注意这里只是指表达式得到的数值对齐,而不会改变prefix和postfix定义的前后字符,这里R为右,L为左
update tick  #同前面的图像部件一样,通过变量定义了这段文本部件的更新时间,单位MS
Foreground 'ffffff'  #前景色,也就是字体颜色,如果不加这个参数则使用CONF开头代环境设定代码段的定义
Background 'FFFFFF00'  #背景色,同上
}

3.进度条小部件
进度条小部件有单进度条和双进度条两种

下面是一个单进度条,用来显示CPU的使用率
Widget CPUBar {   #这里同前面定义部件名称
class 'Bar'   #定义部件类型为进度条
expression  proc_stat::cpu('busy',   500)  #通过表达式得到CPU的使用率数值
length 10  #定义进度条的长度,这里的长度跟文本宽度是一个单位的,10表示10个字符
max  100  #这里可以定义进度条的最大值比例,比如说表达式得到的是50,这个设定100,那进度条就走一半,如果设150,进度条则走三分之一,这么说大家是否可以理解?
direction 'E'  #这个参数定义进度条方向,有E,W,N,S四个方向,E从左向右,W从右向左,N从下向上,S从上向下。
style 'H'   #风格设定,H的话,进度条多了一个边框,其它风格同样等大神解惑,不要边框可以去掉这行参数
update tack  #一样的是用变量定义部件的更新时间,单位MS,这里用的是tack变量,
Foreground '5f5f5f'    #进度条前景色
Background '00FF00FF'  #进度条背景色
BarColor0 'FF0000'  #第一条进度条的颜色
BarColor1 'EE3333'  #第二条进度条的颜色,这里只有一条这个就没用了
}

再来一段双进度条的网络显示例子,就注解下不同的地方
Widget NetBar {
class 'Bar'
expression netdev('eth0', 'Tx_bytes', 500) #通过表达式得到的上传数值,这个数值用在第一条进度条
expression2  netdev('eth0', 'Rx_bytes', 500) #通过表达式得到下载数值,这个数值用在第二条进度条
length 21
direction 'E'
style 'H'
update tack
Foreground '5f5f5f'
Background '3F3F3FFF'
BarColor0 '00FF00'  #第一条进度条的颜色
BarColor1 'FF0000'  #第二条进度条的颜色
}

4.计时器小部件
这个小部件有点不同,不是用来显示在屏上的,一般用来做一些变量的更新,重定义,后台运行什么的,我是这么理解的。

游客,如果您要查看本帖隐藏内容请回复

通过这段,大家应该了解了交替显示信息是怎么运作的了。

三、布局的设定
      前面我们已经了解了显示的种小部件是怎么配置的,但时该怎样让各个部件在相应的位置显示呢?这里我们来布局段代码。
这是我发的那篇CONF的布局代码,

Layout mylayout {
Row07.Col1 'Kernel'                  #这里定义的是文本、图像、进度条这三种小部件的位置分部
Row08.Col1 'CPUText'               #Row08.Col1你可以把它理解为行和列,从屏的左上角开始
Row09.Col1 'CPUBar'                #前面我讲到的屏的像素128X128和字体大小定义6X8,用在这里更好理解了
Row07.Col12 'LoadText'            #换算过来128X128的屏能显示的字符就是16行21列,现在你再来看左边的参数,是不是一目了然
Row08.Col12 'RAMText'            #Row08.Col12 'RAMText'表示,RAMText这个部件显示的位置是第8行12列,很好理解吧
Row09.Col12 'RAMBar'              #加上我们设定这的文本部件宽度为10,也就是占用了第8行的后面一半的位置了
Row11.Col1 'SpaceText1'
Row12.Col1 'SpaceText2'
Row13.Col1 'SpaceText3'
Row11.Col7 'SpaceBar1'
Row12.Col7 'SpaceBar2'
Row13.Col7 'SpaceBar3'
Row10.Col1 'TypeText1'
Row10.Col10 'TypeText2'
Row10.Col16 'TypeText3'
Row11.Col15 'DiskText1'
Row12.Col15 'DiskText2'
Row13.Col15 'DiskText3'
Row11.Col11 'DiskBar1'
Row12.Col11 'DiskBar2'
Row13.Col11 'DiskBar3'
Row14.Col1 'NetText1'
Row15.Col1 'NetText2'
# Row11.Col1 'NetBar'
Row16.Col1 'IPText'

Layer 0 {
  X1.Y1 'Month1'                    #这里定义了图像部件显示的位置,用坐标X,Y来表示
  X1.Y14 'Month2'                  #图像控件因为图像大小没有规则,不能像前面以行列来布局,这里的XY其实指的是像素
  X1.Y27 'Month-Day'             #也是从屏的左上角开始,X纵向从上向下,Y横向从左向右
  X1.Y37 'Day1'                     #X1.Y37 'Day1' 这里表示了从上向下第1个,从左向右37个像素的位置显示日期十位数字图片
  X1.Y51 'Day2'                     #也很好理解吧,具体操作可能要反复多次修改这里的数值才能达到满意的效果
  X1.Y82 'Week1'
  X17.Y3 'Hour1'
  X17.Y26 'Hour2'
  X22.Y51 'Hourdot1'
  X34.Y51 'Hourdot2'
  X17.Y60 'Minute1'
  X17.Y83 'Minute2'
  X40.Y110 'Second1'
  X40.Y118 'Second2'
}
Timer1 'LcdLight'                       #这里就 定义计时器部件了,因为计时器是不显示的,所以就没有位置定义了
Timer2 'ShowExinfo'                  #只是以Timer1,Timer2这样累加来定义多个计时器,如果有3个,那就是Timer3
}
Layout 'mylayout'

四、变量参数设定
     变量参数设定的存在主要是为了方便修改一些设定,不用为了改个目录,改刷新时间一行行代码去找去替换,只要在这里一改全部OK
代码很简单
Variables {
backlight 2                             #变量名称是可以自己定义的,这人变量就是定义了开头的基础环境设置的背光亮度为2
tick 500                                #这几个tick,tack,tsck,second,minute变量是定义了前面各个部件用到更新时间参数
tack 200                               #比如tack 200,那么前面用到update  tack设定的部件的更新时间就是200ms
tsck 100
second 1000
minute 60000
netdevice 'eth0'                      #网络接口指定
imgadir   '/usr/share/lcd4linux/mytheme/img/'                   #图片素材目录
datadir   '/usr/share/lcd4linux/mytheme/data/'
SpaceDir1  '/volume1'
SpaceDir2  '/volumeSATA1/satashare1-1'
SpaceDir3  '/volumeSATA3/satashare3-1'
Diskname1  'sda'
Diskname2  'sdc1'
Diskname3  'sdf1'
}
总之这些变量根据你自己的需要命名和设定。看各位自己发挥了

写到这里应该差不多了吧,其实要把LCD弄得漂亮,精美的素材是缺少不了的。有美工底子的自己画图吧,期待大家的作品,谢谢所有耐着性子看完的朋友。写得不好和用词不当的地方还望见谅。




汗。刚没看到。早知道我不发了。。 
发表于 2014-5-18 20:29

本帖被以下淘专辑推荐:

评论349

xjcsuper楼主Lv.10 发表于 2014-5-18 12:20:09 | 显示全部楼层
本帖最后由 xjcsuper 于 2014-5-21 10:26 编辑

这里放一份我现在自用的最新CONF代码,效果请去这一帖看http://www.gebi1.com/thread-84333-1-1.html
  1. Display dpf {
  2.         Driver     'DPF'
  3.         Port       'usb0'
  4.         Font       '6x8'
  5.         Foreground 'ffffff'
  6.         Background 'ffffff00'
  7.         Basecolor  '000000'   #ffffff00
  8.         Orientation 0          # Orientation value from 0-3
  9.         Backlight  backlight   # Backlight variable control
  10. }

  11. Display Image {
  12.         Driver     'Image'
  13.         Format     'PNG'
  14.         Size       '128x128'
  15.         Font       '6x8'
  16.         Pixel      '4+1'
  17.         Gap        '-1x-1'
  18.         Border      10
  19.         Foreground 'ffffff'
  20.         Background 'ffffff00'
  21.         Halfground '#70c000'
  22. }



  23. Widget Month1 {
  24.         class 'Image'
  25.         file imgadir . 'date'. substr(strftime('%m', time()),0,1) . '.png'
  26.         reload 1
  27.         update tick
  28.         inverted 0
  29.         visible 1
  30. }

  31. Widget Month2 {
  32.         class 'Image'
  33.         file imgadir . 'date'. substr(strftime('%m', time()),1,1) . '.png'
  34.         reload 1
  35.         update tick
  36.         inverted 0
  37.         visible 1
  38. }

  39. Widget Month-Day {
  40.         class 'Image'
  41.         file imgadir . 'date-.png'
  42.         reload 1
  43.         update tick
  44.         inverted 0
  45.         visible 1
  46. }

  47. Widget Day1 {
  48.         class 'Image'
  49.         file imgadir . 'date'. substr(strftime('%d', time()),0,1) . '.png'
  50.         reload 1
  51.         update tick
  52.         inverted 0
  53.         visible 1
  54. }

  55. Widget Day2 {
  56.         class 'Image'
  57.         file imgadir . 'date'. substr(strftime('%d', time()),1,1) . '.png'
  58.         reload 1
  59.         update tick
  60.         inverted 0
  61.         visible 1
  62. }

  63. Widget Week1 {
  64.         class 'Image'
  65.         file imgadir . 'week'. strftime('%u', time()) . '.png'
  66.         reload 1
  67.         update tick
  68.         inverted 0
  69.         visible 1
  70. }

  71. Widget Hour1 {
  72.         class 'Image'
  73.         file imgadir . 'time'. substr(strftime('%H', time()),0,1) . '.png'
  74.         reload 1
  75.         update tick
  76.         inverted 0
  77.         visible 1
  78. }

  79. Widget Hour2 {
  80.         class 'Image'
  81.         file imgadir . 'time'. substr(strftime('%H', time()),1,1) . '.png'
  82.         reload 1
  83.         update tick
  84.         inverted 0
  85.         visible 1
  86. }

  87. Widget Hourdot1 {
  88.         class 'Image'
  89.         file imgadir . 'timedot.png'
  90.         reload 0
  91.         update tack
  92.         inverted 0
  93.         visible (time() % 2) & 1
  94. }

  95. Widget Hourdot2 {
  96.         class 'Image'
  97.         file imgadir . 'timedot.png'
  98.         reload 0
  99.         update tack
  100.         inverted 0
  101.         visible (time() % 2) & 1
  102. }


  103. Widget Minute1 {
  104.         class 'Image'
  105.         file imgadir . 'time'. substr(strftime('%M', time()),0,1) . '.png'
  106.         reload 1
  107.         update tick
  108.         inverted 0
  109.         visible 1
  110. }

  111. Widget Minute2 {
  112.         class 'Image'
  113.         file imgadir . 'time'. substr(strftime('%M', time()),1,1) . '.png'
  114.         reload 1
  115.         update tick
  116.         inverted 0
  117.         visible 1
  118. }

  119. Widget Second1 {
  120.         class 'Image'
  121.         file imgadir . 'ts'. substr(strftime('%S', time()),0,1) . '.png'
  122.         reload 1
  123.         update tick
  124.         inverted 0
  125.         visible 1
  126. }

  127. Widget Second2 {
  128.         class 'Image'
  129.         file imgadir . 'ts'. substr(strftime('%S', time()),1,1) . '.png'
  130.         reload 1
  131.         update tick
  132.         inverted 0
  133.         visible 1
  134. }



  135. Widget Kernel {
  136.         class  'Text'
  137.         expression uname('nodename')
  138.         width  8
  139.         align  'L'
  140.         update minute
  141.         Background 'FFFFFF00'
  142. }


  143. Widget CPUText {
  144.         class  'Text'
  145. #        expression uname('machine')
  146.         expression  proc_stat::cpu('busy',   500)
  147.         prefix 'CPU'
  148.         postfix '%'
  149.         precision  2
  150.         width  10
  151.         align  'R'
  152.         update tick
  153.         Background 'FFFFFF00'
  154. }

  155. Widget CPUBar {
  156.         class 'Bar'
  157.         expression  proc_stat::cpu('busy',   500)
  158.         length 10
  159.         max 100
  160.         direction 'E'  #E,W,N,S
  161.         style 'H'
  162.         update tack
  163.         Foreground '5f5f5f'
  164.         Background '00FF00FF'
  165.         BarColor0 'FF0000'
  166.         BarColor1 'EE3333'
  167. }

  168. Widget RAMText {
  169.         class  'Text'
  170.         expression showex?meminfo('MemTotal')/1024:meminfo('MemFree')/1024
  171.         prefix showex?'RAM':'Free'
  172.         postfix 'MB'
  173.         precision  0
  174.         width  10
  175.         align  'R'
  176.         update tick
  177.         Background 'FFFFFF00'
  178. }

  179. Widget RAMBar {
  180.         class 'Bar'
  181.         expression  meminfo('MemTotal') - meminfo('MemFree')
  182.         max meminfo('MemTotal')
  183.         length 10
  184.         direction 'E'
  185.         style 'H'
  186.         update tack
  187.         Foreground '5f5f5f'
  188.         Background '00FF00FF'
  189.         BarColor0 'FF0000'
  190.         BarColor1 'EE3333'
  191. }

  192. Widget LoadText {
  193.         class  'Text'
  194.         expression loadavg(1)-1
  195. #        expression i2c_sensors('temp2_input')
  196.         prefix 'Load:'
  197.         postfix loadavg(1)-1>1.0?'!':''
  198.         width  10
  199.         align  'R'
  200.         precision  1
  201.         update tack
  202.         Background 'FFFFFF00'
  203. }

  204. Widget TypeText1 {
  205.         class 'Text'
  206.         prefix showex?'Space':'Free'
  207.         width 6
  208.         align 'R'
  209.         update tick
  210.         Foreground 'ffffff'
  211.         Background 'FFFFFF00'
  212. }

  213. Widget TypeText2 {
  214.         class 'Text'
  215.         prefix 'DISK'
  216.         width 4
  217.         align 'R'
  218.         update tick
  219.         Foreground '00FF00'
  220.         Background 'FFFFFF00'
  221. }

  222. Widget TypeText3 {
  223.         class 'Text'
  224.         postfix 'Read Write'
  225.         width 10
  226.         align 'R'
  227.         update tick
  228.         Foreground 'ffffff'
  229.         Background 'FFFFFF00'
  230. }

  231. Widget DiskText1R {
  232.         class 'Text'
  233.         expression diskstats(Diskname1, 'read_sectors', 500)/2<1024?diskstats(Diskname1, 'read_sectors', 500)/2:diskstats(Diskname1, 'read_sectors', 500)/2/1024
  234.         postfix diskstats(Diskname1, 'read_sectors', 500)/2<1024?'K':'M'
  235.         precision  0
  236.         width 5
  237.         align 'R'
  238.         update tick
  239.         Foreground 'ffffff'
  240.         Background 'FFFFFF00'
  241. }

  242. Widget DiskText1W {
  243.         class 'Text'
  244.         expression diskstats(Diskname1, 'write_sectors', 500)/2<1024?diskstats(Diskname1, 'write_sectors', 500)/2:diskstats(Diskname1, 'write_sectors', 500)/2/1024
  245.         postfix diskstats(Diskname1, 'write_sectors', 500)/2<1024?'K':'M'
  246.         precision  0
  247.         width 5
  248.         align 'R'
  249.         update tick
  250.         Foreground 'ffffff'
  251.         Background 'FFFFFF00'
  252. }

  253. Widget DiskText2R {
  254.         class 'Text'
  255.         expression diskstats(Diskname2, 'read_sectors', 500)/2<1024?diskstats(Diskname2, 'read_sectors', 500)/2:diskstats(Diskname2, 'read_sectors', 500)/2/1024
  256.         postfix diskstats(Diskname2, 'read_sectors', 500)/2<1024?'K':'M'
  257.         precision  0
  258.         width 5
  259.         align 'R'
  260.         update tick
  261.         Foreground 'ffffff'
  262.         Background 'FFFFFF00'
  263. }

  264. Widget DiskText2W {
  265.         class 'Text'
  266.         expression diskstats(Diskname2, 'write_sectors', 500)/2<1024?diskstats(Diskname2, 'write_sectors', 500)/2:diskstats(Diskname2, 'write_sectors', 500)/2/1024
  267.         postfix diskstats(Diskname2, 'write_sectors', 500)/2<1024?'K':'M'
  268.         precision  0
  269.         width 5
  270.         align 'R'
  271.         update tick
  272.         Foreground 'ffffff'
  273.         Background 'FFFFFF00'
  274. }

  275. Widget DiskText3R {
  276.         class 'Text'
  277.         expression diskstats(Diskname3, 'read_sectors', 500)/2<1024?diskstats(Diskname3, 'read_sectors', 500)/2:diskstats(Diskname3, 'read_sectors', 500)/2/1024
  278.         postfix diskstats(Diskname3, 'read_sectors', 500)/2<1024?'K':'M'
  279.         precision  0
  280.         width 5
  281.         align 'R'
  282.         update tick
  283.         Foreground 'ffffff'
  284.         Background 'FFFFFF00'
  285. }

  286. Widget DiskText3W {
  287.         class 'Text'
  288.         expression diskstats(Diskname3, 'write_sectors', 500)/2<1024?diskstats(Diskname3, 'write_sectors', 500)/2:diskstats(Diskname3, 'write_sectors', 500)/2/1024
  289.         postfix diskstats(Diskname3, 'write_sectors', 500)/2<1024?'K':'M'
  290.         precision  0
  291.         width 5
  292.         align 'R'
  293.         update tick
  294.         Foreground 'ffffff'
  295.         Background 'FFFFFF00'
  296. }

  297. Widget DiskBar1 {
  298.         class 'Bar'
  299.         expression  diskstats(Diskname1, 'read_sectors',  500)
  300.         expression2 diskstats(Diskname1, 'write_sectors', 500)
  301.         length 2
  302.         direction 'E'
  303.         style 'H'
  304.         update tsck
  305.         Foreground '5f5f5f'
  306.         Background '3f3f3fFF'
  307.         BarColor0 '00FF00'
  308.         BarColor1 'FF0000'
  309. }

  310. Widget DiskBar2 {
  311.         class 'Bar'
  312.         expression  diskstats(Diskname2, 'read_sectors',  500)
  313.         expression2 diskstats(Diskname2, 'write_sectors', 500)
  314.         length 2
  315.         direction 'E'
  316.         style 'H'
  317.         update tsck
  318.         Foreground '5f5f5f'
  319.         Background '3f3f3fFF'
  320.         BarColor0 '00FF00'
  321.         BarColor1 'FF0000'
  322. }

  323. Widget DiskBar3 {
  324.         class 'Bar'
  325.         expression  diskstats(Diskname3, 'read_sectors',  500)
  326.         expression2 diskstats(Diskname3, 'write_sectors', 500)
  327.         length 2
  328.         direction 'E'
  329.         style 'H'
  330.         update tsck
  331.         Foreground '5f5f5f'
  332.         Background '3f3f3fFF'
  333.         BarColor0 '00FF00'
  334.         BarColor1 'FF0000'
  335. }

  336. Widget SpaceText1 {
  337.         class 'Text'
  338.         expression showex?statfs(SpaceDir1, 'blocks')*statfs(SpaceDir2, 'bsize')/1073741824:statfs(SpaceDir1, 'bavail')*statfs(SpaceDir2, 'bsize')/1073741824
  339.         postfix 'G'
  340.         precision  0
  341.         width 5
  342.         align 'R'
  343.         update tick
  344.         Foreground 'ffffff'
  345.         Background 'FFFFFF00'
  346. }

  347. Widget SpaceText2 {
  348.         class 'Text'
  349.         expression showex?statfs(SpaceDir2, 'blocks')*statfs(SpaceDir2, 'bsize')/1073741824:statfs(SpaceDir2, 'bavail')*statfs(SpaceDir2, 'bsize')/1073741824
  350.         postfix 'G'
  351.         precision  0
  352.         width 5
  353.         align 'R'
  354.         update tick
  355.         Foreground 'ffffff'
  356.         Background 'FFFFFF00'
  357. }

  358. Widget SpaceText3 {
  359.         class 'Text'
  360.         expression showex?statfs(SpaceDir3, 'blocks')*statfs(SpaceDir3, 'bsize')/1073741824:statfs(SpaceDir3, 'bavail')*statfs(SpaceDir3, 'bsize')/1073741824
  361.         postfix 'G'
  362.         precision  0
  363.         width 5
  364.         align 'R'
  365.         update tick
  366.         Foreground 'ffffff'
  367.         Background 'FFFFFF00'
  368. }


  369. Widget SpaceBar1 {
  370.         class 'Bar'
  371.         expression  statfs(SpaceDir1, 'blocks') - statfs(SpaceDir1, 'bavail')
  372.         length 3
  373.         direction 'E'
  374.         style 'H'
  375.         max statfs(SpaceDir1, 'blocks')
  376.         update tick
  377.         Foreground '5f5f5f'
  378.         Background '00FF00FF'
  379.         BarColor0 'FF0000'
  380.         BarColor1 'EE3333'
  381. }

  382. Widget SpaceBar2 {
  383.         class 'Bar'
  384.         expression  statfs(SpaceDir2, 'blocks') - statfs(SpaceDir2, 'bavail')
  385.         length 3
  386.         direction 'E'
  387.         style 'H'
  388.         max statfs(SpaceDir2, 'blocks')
  389.         update tick
  390.         Foreground '5f5f5f'
  391.         Background '00FF00FF'
  392.         BarColor0 'FF0000'
  393.         BarColor1 'EE3333'
  394. }

  395. Widget SpaceBar3 {
  396.         class 'Bar'
  397.         expression  statfs(SpaceDir3, 'blocks') - statfs(SpaceDir3, 'bavail')
  398.         length 3
  399.         direction 'E'
  400.         style 'H'
  401.         max statfs(SpaceDir3, 'blocks')
  402.         update tick
  403.         Foreground '5f5f5f'
  404.         Background '00FF00FF'
  405.         BarColor0 'FF0000'
  406.         BarColor1 'EE3333'
  407. }

  408. Widget NetText1 {
  409.         class 'Text'
  410.         expression netdev::fast(netdevice, 'Tx_bytes', 500)/1024<1024?netdev::fast(netdevice, 'Tx_bytes', 500)/1024:netdev::fast(netdevice, 'Tx_bytes', 500)/1024/1024
  411.         prefix 'U:'
  412.         postfix netdev::fast(netdevice, 'Tx_bytes', 500)/1024<1024?'K/s':'M/s'
  413.         width 9
  414.         precision  0
  415.         align 'R'
  416.         update tick
  417.         Foreground 'ffffff'
  418.         Background 'FFFFFF00'
  419. }

  420. Widget NetText2 {
  421.         class 'Text'
  422.         expression netdev::fast(netdevice, 'Rx_bytes', 500)/1024<1024?netdev::fast(netdevice, 'Rx_bytes', 500)/1024:netdev::fast(netdevice, 'Rx_bytes', 500)/1024/1024
  423.         prefix 'D:'
  424.         postfix netdev::fast(netdevice, 'Rx_bytes', 500)/1024<1024?'K/s':'M/s'
  425.         precision  0
  426.         width 9
  427.         align 'R'
  428.         update tick
  429.         Foreground 'ffffff'
  430.         Background 'FFFFFF00'
  431. }

  432. Widget NetBar {
  433.         class 'Bar'
  434.         expression netdev(netdev, 'Tx_bytes', 500)
  435.         expression2  netdev(netdev, 'Rx_bytes', 500)
  436.         length 2
  437.         direction 'N'
  438. #        style 'H'
  439.         update tack
  440.         Foreground '5f5f5f'
  441.         Background '3F3F3FFF'
  442.         BarColor0 '00FF00'
  443.         BarColor1 'FF0000'
  444. }

  445. Widget CpuTText {
  446.         class 'Text'
  447.         expression i2c_sensors('temp2_input')
  448.         postfix '.C'
  449.         precision  0
  450.         width 4
  451.         align 'R'
  452.         update tick
  453.         Foreground 'ffffff'
  454.         Background 'FFFFFF00'
  455. }

  456. Widget CpuTBar {
  457.         class 'Bar'
  458.         expression i2c_sensors('temp2_input')
  459.         length 2
  460.         max 100
  461.         direction 'N'
  462.         style 'H'
  463.         update tack
  464.         Foreground '5f5f5f'
  465.         Background '00FF00FF'
  466.         BarColor0 'FF0000'
  467.         BarColor1 'EE3333'
  468. }

  469. Widget MbTText {
  470.         class 'Text'
  471.         expression i2c_sensors('temp1_input')
  472.         postfix '.C'
  473.         precision  0
  474.         width 4
  475.         align 'R'
  476.         update tick
  477.         Foreground 'ffffff'
  478.         Background 'FFFFFF00'
  479. }

  480. Widget MbTBar {
  481.         class 'Bar'
  482.         expression i2c_sensors('temp1_input')
  483.         length 2
  484.         max 100
  485.         direction 'N'
  486.         style 'H'
  487.         update tack
  488.         Foreground '5f5f5f'
  489.         Background '00FF00FF'
  490.         BarColor0 'FF0000'
  491.         BarColor1 'EE3333'
  492. }

  493. Widget IPText {
  494.         class 'Text'
  495.         expression showex?(uptime('%dDays %H:%M:%S')):(netinfo::ipaddr(netdevice))
  496.         prefix showex?'Up:':'IP:'
  497.         width 21
  498.         align 'R'
  499.         update tick
  500.         Foreground 'fff000'
  501.         Background '5f5f5f'
  502. }

  503. Widget LcdLight{
  504.         class 'Timer'
  505.         expression LCD::backlight(file::readline(imgadir . 'lcds', strftime('%H', time()) + 1))
  506.         active 1
  507.         update minute
  508. }

  509. Widget ShowExinfo {
  510.         class 'Timer'
  511.         expression showex=(time() % 10 < 5)?1:0
  512.         active 1
  513.         update tick
  514. }

  515. Display 'DPF'

  516. #Display 'Image'

  517. Layout mylayout {
  518.         Row07.Col1 'Kernel'
  519.         Row08.Col1 'CPUText'
  520.         Row09.Col1 'CPUBar'
  521.         Row07.Col12 'LoadText'
  522.         Row08.Col12 'RAMText'
  523.         Row09.Col12 'RAMBar'
  524.         Row11.Col1 'SpaceText1'
  525.         Row12.Col1 'SpaceText2'
  526.         Row13.Col1 'SpaceText3'
  527.         Row11.Col6 'SpaceBar1'
  528.         Row12.Col6 'SpaceBar2'
  529.         Row13.Col6 'SpaceBar3'
  530.         Row10.Col1 'TypeText1'
  531.         Row10.Col7 'TypeText2'
  532.         Row10.Col12 'TypeText3'
  533.         Row11.Col11 'DiskText1R'
  534.         Row11.Col17 'DiskText1W'
  535.         Row12.Col11 'DiskText2R'
  536.         Row12.Col17 'DiskText2W'
  537.         Row13.Col11 'DiskText3R'
  538.         Row13.Col17 'DiskText3W'
  539.         Row11.Col9 'DiskBar1'
  540.         Row12.Col9 'DiskBar2'
  541.         Row13.Col9 'DiskBar3'
  542.         Row15.Col2 'CpuTText'
  543.         Row14.Col1 'CpuTBar'
  544.         Row15.Col7 'MbTText'
  545.         Row14.Col6 'MbTBar'
  546.         Row14.Col13 'NetText1'
  547.         Row15.Col13 'NetText2'
  548.         Row14.Col12 'NetBar'
  549.         Row16.Col1 'IPText'


  550.         Layer 0 {
  551.                 X1.Y1 'Month1'
  552.                 X1.Y14 'Month2'
  553.                 X1.Y27 'Month-Day'
  554.                 X1.Y37 'Day1'
  555.                 X1.Y51 'Day2'
  556.                 X1.Y82 'Week1'
  557.                 X17.Y3 'Hour1'
  558.                 X17.Y26 'Hour2'
  559.                 X22.Y51 'Hourdot1'
  560.                 X34.Y51 'Hourdot2'
  561.                 X17.Y60 'Minute1'
  562.                 X17.Y83 'Minute2'
  563.                 X40.Y110 'Second1'
  564.                 X40.Y118 'Second2'

  565.         }

  566.         Timer1 'LcdLight'
  567.         Timer2 'ShowExinfo'
  568. }

  569. Layout 'mylayout'

  570. Variables {
  571.         backlight 2
  572.         tick 500
  573.         tack 200
  574.         tsck 100
  575.         second 1000
  576.         minute 60000
  577.         netdevice 'eth0' #网络
  578.         imgadir   '/usr/share/lcd4linux/mytheme/img/'
  579.         datadir   '/usr/share/lcd4linux/mytheme/data/'
  580.         SpaceDir1  '/volume1'
  581.         SpaceDir2  '/volumeSATA1/satashare1-1'
  582.         SpaceDir3  '/volumeSATA3/satashare3-1'
  583.         Diskname1  'sda'
  584.         Diskname2  'sdc1'
  585.         Diskname3  'sdf1'
  586. }
复制代码





回复 点赞

使用道具 举报

xjcsuper楼主Lv.10 发表于 2014-5-18 12:20:31 | 显示全部楼层
本帖最后由 xjcsuper 于 2014-5-18 22:19 编辑

忙完网吧后坐了几个小时终于写完这篇贴子
感谢出CONF配置文件的教程 看Conf比较累 有中文帮助是极好的 
发表于 2014-5-27 01:31
回复 点赞

使用道具 举报

wangfq332Lv.10 发表于 2014-5-18 12:25:33 | 显示全部楼层
支持分享了
回复 点赞

使用道具 举报

nbaLv.3 发表于 2014-5-18 13:02:44 | 显示全部楼层
板凳学习
回复 点赞

使用道具 举报

akaLv.10 发表于 2014-5-18 13:17:55 | 显示全部楼层
占楼备用,占楼备用
回复 点赞

使用道具 举报

jmdjjLv.10 发表于 2014-5-18 13:50:12 | 显示全部楼层
楼都站满了!
码字很累的啊  详情 回复
发表于 2014-5-18 16:34
回复 点赞

使用道具 举报

xjcsuper楼主Lv.10 发表于 2014-5-18 16:34:07 | 显示全部楼层

码字很累的啊
支持一个。  详情 回复
发表于 2014-5-18 17:28
回复 点赞

使用道具 举报

剑剑Lv.10 发表于 2014-5-18 17:28:40 | 显示全部楼层

支持一个。
U盘有价,数据无价。。。。。。
回复 点赞

使用道具 举报

xjcsuper楼主Lv.10 发表于 2014-5-18 21:13:03 | 显示全部楼层
写累了,顶一下吧
回复 点赞

使用道具 举报

cool-fireLv.10 发表于 2014-5-18 21:25:07 | 显示全部楼层
不错,学习了,感谢分享!!
回复 点赞

使用道具 举报

fh_xzLv.2 发表于 2014-5-18 21:26:36 | 显示全部楼层

支持分享
回复 点赞

使用道具 举报

fatlsjLv.2 发表于 2014-5-18 21:41:18 | 显示全部楼层
教学贴,好东西
回复 点赞

使用道具 举报

shisi80Lv.5 发表于 2014-5-18 21:48:51 | 显示全部楼层
感谢提供
回复 点赞

使用道具 举报

dsqaLv.10 发表于 2014-5-18 21:52:16 | 显示全部楼层
好吧,回复可见。。
码这么多字不容易,不回复可见沉得快啊  详情 回复
发表于 2014-5-18 21:53
回复 点赞

使用道具 举报

xjcsuper楼主Lv.10 发表于 2014-5-18 21:53:41 | 显示全部楼层
dsqa 发表于 2014-5-18 21:52
好吧,回复可见。。

码这么多字不容易,不回复可见沉得快啊
不会沉滴,我再你顶上去。  详情 回复
发表于 2014-5-18 21:56
回复 点赞

使用道具 举报

剑剑Lv.10 发表于 2014-5-18 21:56:18 | 显示全部楼层
xjcsuper 发表于 2014-5-18 21:53
码这么多字不容易,不回复可见沉得快啊

不会沉滴,我再你顶上去。
U盘有价,数据无价。。。。。。
回复 点赞

使用道具 举报

yuko4632Lv.10 发表于 2014-5-18 22:01:15 | 显示全部楼层
呵呵。。。支持。。。
回复 点赞

使用道具 举报

fenggenetLv.3 发表于 2014-5-18 22:13:36 | 显示全部楼层
很好,支持下。
回复 点赞

使用道具 举报

changqmLv.2 发表于 2014-5-18 22:19:38 | 显示全部楼层
不错,支持LZ
回复 点赞

使用道具 举报

回复

懒得打字嘛,点击右侧快捷回复 【本站酷狼4T,750元】
您需要登录后才可以回帖 登录 | 注册

本版积分规则

投诉/建议联系

support@gebi1.cn

未经授权禁止转载,复制和建立镜像,
如有违反,追究法律责任
  • 关注公众号
  • 添加微信客服
Copyright © 2001-2024 隔壁网 版权所有 All Rights Reserved. 粤ICP备14056481号-1
关灯 快速发帖
扫一扫添加微信客服
返回顶部
快速回复 返回顶部 返回列表