Exemplo n.º 1
0
    def __init__(self, settings):
        self.m_bStop = True
        self.m_lastInitAttempt = 0
        self.m_initRetryInterval = INIT_RETRY_INTERVAL
        self.m_used = True
        self.lcd = lcd()
        self.tnsocket = None
        self.m_timeLastSockAction = time.time()
        self.m_timeSocketIdleTimeout = 2
        self.m_strLineText = [None] * MAX_ROWS
        self.m_strLineType = [None] * MAX_ROWS
        self.m_bstrLineIcon = [None] * MAX_ROWS
        self.m_strDigits = [None] * MAX_BIGDIGITS
        self.m_iProgressBarWidth = 0
        self.m_iProgressBarLine = -1
        self.m_bstrIconName = b"BLOCK_FILLED"
        self.m_iBigDigits = int(8)  # 12:45:78 / colons count as digit
        self.m_iOffset = 1
        self.m_bstrSetLineCmds = ""
        self.m_cExtraIcons = None

        self.m_iColumns = 20  #test
        self.m_iRows = 4  #test

        # self.m_iColumns = int(settings.getColumns())
        # self.m_iRows  = int(lcdinfo.getRows())

        LcdBase.__init__(self, settings)
Exemplo n.º 2
0
def lcdControlProc(lcd_child_conn):
    p = current_process()
    logger = logging.getLogger("ispresso").getChild("lcdControlProc")
    logger.info('Starting:' + p.name + ":" + str(p.pid))

    lcd = lcddriver.lcd()

    last_line1 = ""
    last_line2 = ""

    while (True):
        time.sleep(0.25)
        while lcd_child_conn.poll():
            try:
                line1, line2, duration = lcd_child_conn.recv()
                if line1 is not None:
                    if last_line1 != line1:
                        lcd.lcd_display_string(line1.ljust(16), 1)
                        last_line1 = line1
                        time.sleep(duration)

                if line2 is not None:
                    if last_line2 != line2:
                        lcd.lcd_display_string(line2.ljust(16), 2)
                        last_line2 = line2
                        time.sleep(duration)

            except:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                logger.error(''.join('!! ' + line
                                     for line in traceback.format_exception(
                                         exc_type, exc_value, exc_traceback)))
                subprocess.call(['i2cdetect', '-y', '1'])
                try:
                    lcd = None
                    time.sleep(0.1)
                    lcd = lcddriver.lcd()
                    time.sleep(0.1)
                except:
                    logger.error(
                        "Trying to re-initialize the LCD by nulling it out and re-instantiating.  Couldln't pull it off :("
                    )
                continue
Exemplo n.º 3
0
def lcdControlProc(lcd_child_conn):
    p = current_process()
    logger = logging.getLogger("ispresso").getChild("lcdControlProc")
    logger.info("Starting:" + p.name + ":" + str(p.pid))

    lcd = lcddriver.lcd()
    while True:
        time.sleep(0.25)
        while lcd_child_conn.poll():
            try:
                line1, line2, duration = lcd_child_conn.recv()
                if line1 is not None:
                    lcd.lcd_display_string(line1.ljust(16), 1)
                    time.sleep(duration)
                if line2 is not None:
                    lcd.lcd_display_string(line2.ljust(16), 2)
                    time.sleep(duration)

            except:
                lcd.lcd_clear()
                exc_type, exc_value, exc_traceback = sys.exc_info()
                logger.error(
                    "".join("!! " + line for line in traceback.format_exception(exc_type, exc_value, exc_traceback))
                )
def printTime():
    display.lcd_clear()
    PrintTime()


def printLocation():
    display.lcd_clear()
    PrintLocation()


def printStatus():
    display.lcd_clear()
    PrintServerStatus()


display = lcddriver.lcd()

try:
    kp = keypad(columnCount=3)
    while True:
        print("writing to LCD display")

        digit = None
        while digit == None:
            digit = kp.getKey()
            print(digit)
            if (digit == 1):
                printStatus()
            elif (digit == 2):
                printLocation()
            elif (digit == 6):
Exemplo n.º 5
0
#!/usr/bin/env python

import time

from lcd import lcddriver

from i2clibraries import i2c_lcd_smbus

lcd1 = lcddriver.lcd()

lcd2 = i2c_lcd_smbus.i2c_lcd(0x3F, 1, 2, 1, 0, 4, 5, 6, 7, 3)
lcd2.command(lcd2.CMD_Display_Control | lcd2.OPT_Enable_Display)
lcd2.backLightOn()


def writeLcd1(message):

    lcd1.lcd_display_string(str(message), (message % 2) + 1)


def writeLcd2(message):

    lcd2.setPosition((message % 2) + 1, 0)
    lcd2.writeString(str(message))


if __name__ == "__main__":
    for count in [10 ** 2, 10 ** 3]:
        _start = time.time()

        for ii in xrange(0, count):
Exemplo n.º 6
0
#!/usr/bin/env python

# loading the class
from lcd import lcddriver
import random
import time
import sys

# lcd start
lcd = lcddriver.lcd()

# this command clears the display (captain obvious)
lcd.lcd_clear()

#open quotes file.
file = open("./quotes.txt","r")
lines = file.readlines()

def loadLCD(content):

	lcd_rows = 4
	current_row = 1
	max_row_length = 19
	line_text = ''
	word_arr = content.split()

	for word in word_arr:
		if len(word) + len(line_text) < 20:
			if line_text != '': 
				line_text += ' '
			line_text += word
Exemplo n.º 7
0
#!/usr/bin/python

from lcd import lcddriver
import time

lcd = lcddriver.lcd()

lcd.lcd_display_string("HI THERE", 1)

time.sleep(5)  # sleep 5 seconds

lcd.lcd_clear()

lcd = None


Exemplo n.º 8
0
 def __init__(self):
     self.display = lcd()
Exemplo n.º 9
0
#!/usr/bin/env python

import time

from lcd import lcddriver

from i2clibraries import i2c_lcd_smbus

lcd1 = lcddriver.lcd()

lcd2 = i2c_lcd_smbus.i2c_lcd(0x3f, 1, 2, 1, 0, 4, 5, 6, 7, 3)
lcd2.command(lcd2.CMD_Display_Control | lcd2.OPT_Enable_Display)
lcd2.backLightOn()


def writeLcd1(message):

    lcd1.lcd_display_string(str(message), (message % 2) + 1)


def writeLcd2(message):

    lcd2.setPosition((message % 2) + 1, 0)
    lcd2.writeString(str(message))


if __name__ == '__main__':
    for count in [10**2, 10**3]:
        _start = time.time()

        for ii in xrange(0, count):