1
0
Fork 0

not connected. rm sim bits

jebbatime
ml server 2021-06-14 13:52:05 -06:00
parent 091ea48b50
commit 2dbfd10b31
2 changed files with 1 additions and 34 deletions

View File

@ -25,29 +25,6 @@ from drivers.cst816s import CST816S
from drivers.st7789 import ST7789_SPI
from drivers.vibrator import Vibrator
class Accelerometer:
"""Simulated accelerometer.
Accelerometers such as BMA421 are complex and most of the driver
is written in C. For that reason we simulate the accelerometer
rather than emulate (by comparison we emulate the ST7789).
"""
def reset(self):
self._steps = 3
@property
def steps(self):
"""Report the number of steps counted."""
if self._steps < 10000:
self._steps = int(self._steps * 1.34)
else:
self._steps += 1
return self._steps
@steps.setter
def steps(self, value):
self.reset()
class Backlight(object):
def __init__(self, level=1):
pass
@ -142,15 +119,11 @@ display = ST7789_SPI(240, 240, spi,
res=Pin("DISP_RST", Pin.OUT, quiet=True))
drawable = draw565.Draw565(display)
accel = Accelerometer()
battery = Battery()
button = Pin('BUTTON', Pin.IN, quiet=True)
rtc = RTC()
touch = CST816S(I2C(0), Pin('TP_INT', Pin.IN, quiet=True), Pin('TP_RST', Pin.OUT, quiet=True))
vibrator = Vibrator(Pin('MOTOR', Pin.OUT, value=0), active_low=True)
def connected():
return not (int(rtc.uptime / 30) & 1)
# Free memory cannot be measured on the simulator
free = 0

View File

@ -136,13 +136,7 @@ class NotificationBar:
draw = watch.drawable
(x, y) = self._pos
if wasp.watch.connected():
if wasp.system.notifications:
draw.blit(icons.notification, x+22, y,
fg=wasp.system.theme('notify-icon'))
else:
draw.fill(0, x+22, y, 30, 32)
elif wasp.system.notifications:
if wasp.system.notifications:
draw.blit(icons.notification, x, y,
fg=wasp.system.theme('notify-icon'))
draw.fill(0, x+30, y, 22, 32)