Exemplo n.º 1
0
    def _update(self):
        # Before we do anything else let's make sure _count is
        # up to date
        if self._started_at:
            uptime = wasp.watch.rtc.get_uptime_ms()
            uptime //= 10
            self._count = uptime - self._started_at
            if self._count > 999*60*100:
                self._reset()

        # Update the statusbar
        wasp.system.bar.update()

        if self._last_count != self._count:
            centisecs = self._count
            secs = centisecs // 100
            centisecs %= 100
            minutes = secs // 60
            secs %= 60

            t1 = '{}:{:02}'.format(minutes, secs)
            t2 = '{:02}'.format(centisecs)

            draw = wasp.watch.drawable
            draw.set_font(fonts.sans36)
            draw.set_color(draw.lighten(wasp.system.theme('ui'), wasp.system.theme('contrast')))
            w = fonts.width(fonts.sans36, t1)
            draw.string(t1, 180-w, 120-36)
            draw.fill(0, 0, 120-36, 180-w, 36)

            draw.set_font(fonts.sans24)
            draw.string(t2, 180, 120-36+18, width=46)
            self._last_count = self._count
Exemplo n.º 2
0
    def _update(self):
        draw = wasp.watch.drawable

        # Update the status bar
        now = wasp.system.bar.update()

        # Update the step count
        count = watch.accel.steps
        t = str(count)
        w = fonts.width(fonts.sans36, t)
        draw.set_font(fonts.sans36)
        draw.set_color(0xfff0)
        draw.string(t, 228 - w, 132 - 18)
Exemplo n.º 3
0
    def _update(self):
        draw = wasp.watch.drawable

        # Update the status bar
        now = wasp.system.bar.update()

        # Update the step count
        count = watch.accel.steps
        t = str(count)
        w = fonts.width(fonts.sans36, t)
        draw.set_font(fonts.sans36)
        draw.set_color(
            draw.lighten(wasp.system.theme('spot1'),
                         wasp.system.theme('contrast')))
        draw.string(t, 228 - w, 132 - 18)
Exemplo n.º 4
0
    def _update(self):
        draw = wasp.watch.drawable

        # Update the status bar
        now = self._bar.update()

        # Reset the step counter if we have move onto the next day
        if now and now[2] != self._prev_day:
            watch.accel.steps = 0
            draw.fill(0, 60, 132 - 18, 180, 36)
            self._prev_day = now[2]

        # Update the step count
        count = watch.accel.steps
        t = str(count)
        w = fonts.width(fonts.sans36, t)
        draw.set_font(fonts.sans36)
        draw.set_color(0xfff0)
        draw.string(t, 228 - w, 132 - 18)
Exemplo n.º 5
0
    def _update(self):
        # Before we do anything else let's make sure _count is
        # up to date
        if self._started_at:
            uptime = wasp.watch.rtc.get_uptime_ms()
            uptime //= 10
            self._count = uptime - self._started_at
            if self._count > 999*60*100:
                self._reset()

        draw = wasp.watch.drawable

        # Lazy update of the clock and battery meter
        now = wasp.watch.rtc.get_localtime()
        if now[4] != self._last_clock[4]:
            t1 = '{:02}:{:02}'.format(now[3], now[4])
            draw.set_font(fonts.sans28)
            draw.set_color(0xe73c)
            draw.string(t1, 48, 12, 240-96)
            self._last_clock = now
            self._meter.update()

        if self._last_count != self._count:
            centisecs = self._count
            secs = centisecs // 100
            centisecs %= 100
            minutes = secs // 60
            secs %= 60

            t1 = '{}:{:02}'.format(minutes, secs)
            t2 = '{:02}'.format(centisecs)

            draw.set_font(fonts.sans36)
            draw.set_color(0xc67f)
            w = fonts.width(fonts.sans36, t1)
            draw.string(t1, 180-w, 120-36)
            draw.fill(0, 0, 120-36, 180-w, 36)

            draw.set_font(fonts.sans24)
            draw.string(t2, 180, 120-36+18, width=46)
            self._last_count = self._count
Exemplo n.º 6
0
    def _update(self):
        draw = wasp.watch.drawable

        # Lazy update of the clock and battery meter
        now = wasp.watch.rtc.get_localtime()
        if now[4] != self._last_clock[4]:
            t1 = '{:02}:{:02}'.format(now[3], now[4])
            draw.set_font(fonts.sans24)
            draw.string(t1, 48, 16, 240-96)
            self._last_clock = now
            self._meter.update()

            if now[2] != self._last_clock[2]:
                watch.accel.steps = 0
                draw.fill(60, 132-18, 180, 36)

        count = watch.accel.steps
        t = str(count)
        w = fonts.width(fonts.sans36, t)
        draw.set_font(fonts.sans36)
        draw.string(t, 228-w, 132-18)
Exemplo n.º 7
0
    def _draw_splits(self):
        draw = wasp.watch.drawable
        splits = self._splits
        if 0 == len(splits):
            draw.fill(0, 0, 120, 240, 120)
            return
        y = 240 - 12 - (len(splits) * 24)
        for i, s in enumerate(splits):
            if s:
                centisecs = s
                secs = centisecs // 100
                centisecs %= 100
                minutes = secs // 60
                secs %= 60

                t = '#{}  {:02}:{:02}.{:02}'.format(i+1, minutes, secs, centisecs)
            else:
                t = ''

            draw.set_font(fonts.sans24)
            w = fonts.width(fonts.sans24, t)
            draw.string(t, 0, y + (i*24), 240)
Exemplo n.º 8
0
    def _draw_splits(self):
        draw = wasp.watch.drawable
        splits = self._splits
        if 0 == len(splits):
            draw.fill(0, 0, 120, 240, 120)
            return
        y = 240 - 6 - (len(splits) * 24)

        n = self._nsplits
        for i, s in enumerate(splits):
            centisecs = s
            secs = centisecs // 100
            centisecs %= 100
            minutes = secs // 60
            secs %= 60

            t = '# {}   {:02}:{:02}.{:02}'.format(n, minutes, secs, centisecs)
            n -= 1

            draw.set_font(fonts.sans24)
            draw.set_color(0xe73c)
            w = fonts.width(fonts.sans24, t)
            draw.string(t, 0, y + (i * 24), 240)
Exemplo n.º 9
0
    def _update(self):
        draw = wasp.watch.drawable

        # Draw the icon
        draw.blit(feet, 12, 132 - 24)

        # Update the status bar
        now = wasp.system.bar.update()

        # Update the scroll indicator
        scroll = self._scroll
        scroll.up = False
        scroll.draw()

        # Update the step count
        count = watch.accel.steps
        t = str(count)
        w = fonts.width(fonts.sans36, t)
        draw.set_font(fonts.sans36)
        draw.set_color(
            draw.lighten(wasp.system.theme('spot1'),
                         wasp.system.theme('contrast')))
        draw.string(t, 228 - w, 132 - 18)