LCD on Openwrt

TP-Link TL-WR703N
Console ttyATH0, 115200
64M RAM ; CPU 265.42BogoMIOS
OpenWRT 14.07
LCD4Linux

TP-Link TL-MR3420 v1
Console ttyS0 115200
64M RAM ; CPU 265.42BogoMIPS
OpenWRT 12.09
LCD4Linux 0.11

Serial port pintout

PCB edge< [G] [V] [Tx] [Rx] >near CPU heart sink.


root@RS-NET:~# cat /root/lcd4linux.conf
#  $Id: lcd4linux.conf.sample 1176 2012-02-21 03:53:17Z michael $
#  $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/lcd4linux.conf.sample $

Variables {
   tick 500
   tack 100
   minute 60000
}

Display PHAnderson {
    Driver 'PHAnderson'
    Port '/dev/ttyS0'
    Speed 9600
    Size '16x2'
    Blackligth 100
    Bootscreen '1234567890123456'
}

Widget RAM {
    class  'Text'
    expression meminfo('MemTotal')/1024
    postfix ' MB RAM'
    width  11
    precision 0
    align  'R'
    update tick
}

Widget Busy {
    class 'Text'
    expression proc_stat::cpu('busy', 500)
    prefix 'Busy'
    postfix '%'
    width 9
    precision 1
    align 'R'
    update tick
}

Widget BusyBar {
    class 'Bar'
    expression  proc_stat::cpu('busy',   500)
    expression2 proc_stat::cpu('system', 500)
    length 10
    direction 'E'
    update tack
}

Widget Load {
    class 'Text'
    expression loadavg(1)
    prefix 'Load'
    postfix loadavg(1)>1.0?'!':' '
    width 10
    precision 1
    align 'R'
    update tick
}

Widget LoadBar {
    class 'Bar'
    expression  loadavg(1)
    max 2.0
    length 10
    direction 'E'
    update tack
}

Widget Eth0 {
    class 'Text'
    expression (netdev('eth0', 'Rx_bytes', 500)+netdev('eth0', 'Tx_bytes', 500))/1024
    prefix 'eth0'
    postfix ' '
    width 10
    precision 0
    align 'R'
    update tick
}

Widget Eth0Bar {
    class 'Bar'
    expression  netdev('eth0', 'Rx_bytes', 500)
    expression2 netdev('eth0', 'Tx_bytes', 500)
    length 14
    direction 'E'
    update tack
}

Widget PPP {
    class 'Text'
    expression (ppp('Rx:0', 500)+ppp('Tx:0', 500))
    prefix 'PPP'
    width 9
    precision 0
    align 'R'
    update tick
}

Widget Uptime {
    class 'Text'
    expression uptime('%d days %H:%M:%S')
    width 20
    align 'R'
    prefix 'Up '
    update 1000
}

# debugging widgets

Widget BarTest {
    class 'Bar'
    # test::bar(barno,maxval,startval,delta) - move a test value between 0 and max.
    # delta= step to change value by each time it's read.
    # barno - ten different test bar values can be set up, with barno=0..9
    # if delta=0, just returns the value of bar n instead of changing it.
    expression test::bar(0,30,25,1)
    expression2 test::bar(1,30,0,1)
    length 8
    # max 50
    direction 'E'
    update 10
}

Widget BarTestVal {
    class 'Text'
    expression test::bar(0,100,50,0)
    prefix 'Test '
    width 9
    update 200
}

Widget LightningTest {
    class 'icon'
    speed 500
    visible test::onoff(0)
    bitmap {
        row1 '...***'
        row2 '..***.'
        row3 '.***..'
        row4 '.****.'
        row5 '..**..'
        row6 '.**...'
        row7 '**....'
        row8 '*.....'
    }
}

# Icons

Widget Heartbeat {
    class 'Icon'
    speed 800
    Bitmap {
        Row1 '.....|.....'
        Row2 '.*.*.|.*.*.'
        Row3 '*****|*.*.*'
        Row4 '*****|*...*'
        Row5 '.***.|.*.*.'
        Row6 '.***.|.*.*.'
        Row7 '..*..|..*..'
        Row8 '.....|.....'
    }
}

Widget EKG {
    class 'Icon'
    speed 50
    Bitmap {
        Row1 '.....|.....|.....|.....|.....|.....|.....|.....'
        Row2 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
        Row3 '.....|....*|...*.|..*..|.*...|*....|.....|.....'
        Row4 '.....|....*|...**|..**.|.**..|**...|*....|.....'
        Row5 '.....|....*|...**|..**.|.**..|**...|*....|.....'
        Row6 '.....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....'
        Row7 '*****|*****|****.|***..|**..*|*..**|..***|.****'
        Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
    }
}
Widget Karo {
    class 'Icon'
    speed 200
    Bitmap {
        Row1 '.....|.....|.....|.....|..*..|.....|.....|.....'
        Row2 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
        Row3 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
        Row4 '.....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..'
        Row5 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....'
        Row6 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....'
        Row7 '.....|.....|.....|.....|..*..|.....|.....|.....'
        Row8 '.....|.....|.....|.....|.....|.....|.....|.....'
    }
}
Widget Heart {
    class 'Icon'
    speed 250
    Bitmap {
        Row1 '.....|.....|.....|.....|.....|.....'
        Row2 '.*.*.|.....|.*.*.|.....|.....|.....'
        Row3 '*****|.*.*.|*****|.*.*.|.*.*.|.*.*.'
        Row4 '*****|.***.|*****|.***.|.***.|.***.'
        Row5 '.***.|.***.|.***.|.***.|.***.|.***.'
        Row6 '.***.|..*..|.***.|..*..|..*..|..*..'
        Row7 '..*..|.....|..*..|.....|.....|.....'
        Row8 '.....|.....|.....|.....|.....|.....'
    }
}

Widget Test {
    class 'Text'
    expression '12345678901234'
    width 16
    foreground 'ff0000ff'
}

Widget Test1 {
    class 'Text'
    expression 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
    width 40
    align 'M'
    speed 100
}

Widget Test2 {
    class 'Text'
    expression '1234567890abcdefghijklmnopqrstuvwxyz'
    width 40
    align 'M'
    speed 150
}

Layout Default {
    Row1 {
        Col1  'OS'
    }
    Row2 {
        Col1  'CPU'
        Col10 'RAM'
    }
    Row3 {
        Col1  'Busy'
        Col10 'Rain'
        Col11 'BusyBar'
    }
    Row4 {
        Col1 'Load'
        Col11 'LoadBar'
    }
    Row5 {
        Col1  'Disk'
        Col11 'DiskBar'
    }
    Row6 {
        Col1  'Eth0'
        Col11 'Eth0Bar'
    }
}

Layout TestImage {
    Layer 2 {
        X1.Y1 'ImageTest'
    }
}

Layout TestIcons {
    Row1.Col1 'Timer'
    Row1.Col2 'Rain'
    Row1.Col3 'Squirrel'
    Row1.Col4 'Wave'
    Row1.Col5 'Blob'
    Row1.Col6 'Heart'
    Row1.Col7 'Karo'
    Row1.Col8 'EKG'
}

Layout Debug {
    #Row09.Col1 'Test'
    Row09.Col1 'Heartbeat'
}

Widget WANt {
    class 'Text'
    expression (netdev('eth1', 'Tx_bytes', 500))/1024
    postfix 't'
    width 5
    precision 0
    align 'R'
    update tick
}
Widget WANr {
    class 'Text'
    expression (netdev('eth1', 'Rx_bytes', 500))/1024
    postfix 'r'
    width 5
    precision 0
    align 'R'
    update tick
}
Widget LANt {
    class 'Text'
    expression (netdev('br-lan', 'Tx_bytes', 500))/1024
    postfix 'x'
    width 6
    precision 0
    align 'R'
    update tick
}
Widget LANr {
    class 'Text'
    expression (netdev('br-lan', 'Rx_bytes', 500))/1024
    postfix 'x'
    width 6
    precision 0
    align 'R'
    update tick
}
Widget WIFt {
    class 'Text'
    expression (netdev('wlan0', 'Tx_bytes', 500))/1024
    width 5
    precision 0
    align 'R'
    update tick
}
Widget WIFr {
    class 'Text'
    expression (netdev('wlan0', 'Rx_bytes', 500))/1024
    width 5
    precision 0
    align 'R'
    update tick
}

Layout L16x2 {
    Row1 {
        Col1  'WANt'
        Col6  'LANt'
        Col12 'WIFt'
    }
    Row2 {
        Col1  'WANr'
        Col6  'LANr'
        Col12 'WIFr'
    }
}

Display 'PHAnderson'
Layout 'L16x2'


root@RS-NET:~# cat /etc/init.d/lcd4linux

#!/bin/sh /etc/rc.common
# Copyright (C) 2007-2011 OpenWrt.org

START=99

SERVICE_USE_PID=1

start() {
        service_start /usr/bin/lcd4linux -f /root/lcd4linux.conf
}

stop() {
        service_stop /usr/bin/lcd4linux
}



lrwxrwxrwx    1 root     root            19 May  6 16:40 S99lcd4linux -> ../init.d/lcd4linux

Labels: my.