Beispiel #1
0
    def __init__(self, side='L',*, mode=NORMAL, model=EMBEDDED_ARTISTS, use_flash=False, up_time=None):
        self.flash = None                       # Assume flash is unused
        self.in_context = False
        try:
            intside = {'l':0, 'r':1}[side.lower()]
        except (KeyError, AttributeError):
            raise ValueError("Side must be 'L' or 'R'")
        if model not in (EMBEDDED_ARTISTS, ADAFRUIT):
            raise ValueError('Unsupported model')
        if mode == FAST and use_flash:
            raise ValueError('Flash memory unavailable in fast mode')
        if mode == NORMAL and up_time is not None:
            raise ValueError('Cannot set up_time in normal mode')
        if mode == NORMAL:
            from epd import EPD
            self.epd = EPD(intside, model)
        elif mode == FAST:
            from epdpart import EPD
            self.epd = EPD(intside, model, up_time)
        else:
            raise ValueError('Unsupported mode {}'.format(mode))
        self.mode = mode
        self.font = Font()
        gc.collect()
        self.locate(0, 0)                       # Text cursor: default top left

        self.mounted = False                    # umountflash() not to sync
        if use_flash:
            from flash import FlashClass
            gc.collect()
            self.flash = FlashClass(intside)
            self.umountflash()                  # In case mounted by prior tests.
            self.mountflash()
        gc.collect()
Beispiel #2
0
            self.c1.set_text(self.sdate, x=10)

        if self.stime != ttime:
            self.stime = ttime
            self.c2.set_text(self.stime, x=4)


if __name__ == '__main__':

    from epd import EPD

    # Display layout instance
    L1 = Layout_1()

    # E-Paper Display instance
    epd = EPD(True, L1)

    for i in range(5):
        L1.inc_water(1)
        L1.inc_gas(0.01)
        L1.set_date_time()
        epd.update()

    L1.clear_all()
    epd.show()

    for i in range(5):
        L1.inc_water(1)
        L1.inc_gas(0.01)
        L1.set_date_time()
        epd.update()
Beispiel #3
0
            self.cdate.set_text(self.sdate, align=1)

        if self.stime != ttime:
            self.stime = ttime
            self.ctime.set_text(self.stime, x=3)


if __name__ == '__main__':

    from epd import EPD

    # Display Layout instance
    L2 = Layout_2()

    # E-Paper Display instance
    epd = EPD(False, L2)

    # Random values for test
    L2.water = 890
    L2.gas = 2.64
    L2.electricity = 0
    L2.day_electricity = 12.3

    L2.eur_water = 0.23
    L2.eur_gas = 0.66
    L2.eur_electricity = 1.79
    L2.eur_total = L2.eur_water + L2.eur_gas + L2.eur_electricity

    for i in range(5):
        L2.inc_water(1)
        L2.inc_gas(0.01)
Beispiel #4
0
        self.set_value_1(0)
        self.set_value_2(0)
        self.set_value_3(0)
        self.set_value_4(0)
        self.set_value_5(0)


if __name__ == '__main__':

    from epd import EPD

    # Display Layout instance
    L1 = Escale()

    # E-Paper Display instance
    epd = EPD(True, L1)  # TODO
    #    epd = EPD(True)
    #    epd.add( L1.components )
    #    epd.show()

    val = 123
    for i in range(10):
        val += .22
        val_25 = L1.round_to(val, 0.25)
        val_50 = L1.round_to(val, 0.5)
        val_1 = L1.round_to(val, 1.0)

        L1.set_value_1(val_25)
        L1.set_value_2(val_25)
        L1.set_value_3(val_50)
        L1.set_value_4(val_50)
Beispiel #5
0
            self.cdate.set_text(self.sdate, align=1)

        if self.stime != ttime:
            self.stime = ttime
            self.ctime.set_text(self.stime, x=5)


if __name__ == '__main__':

    from epd import EPD

    # Display Layout instance
    L2 = Layout_2()

    # E-Paper Display instance
    epd = EPD(False, L2, partial_update = True)
    
    # Random values for test
    L2.water           = 890
    L2.gas             = 2.64
    L2.electricity     = 0
    L2.day_electricity = 12.3

    L2.eur_water       = 0.23
    L2.eur_gas         = 0.66
    L2.eur_electricity = 1.79
    L2.eur_total       = L2.eur_water + L2.eur_gas + L2.eur_electricity

    for i in range(18):
        L2.egraph.set_bar(i, i+1)