Skip to content

Commit 0753adc

Browse files
Merge pull request adafruit#1257 from adafruit/pb-moon-clock
Minor Moon Clock changes and bug fixlets
2 parents 342671c + 8a8428e commit 0753adc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Matrix_Portal_Moon_Clock/code.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def __init__(self, datetime, hours_ahead, utc_offset):
175175
DISPLAY = MATRIX.display
176176
ACCEL = adafruit_lis3dh.LIS3DH_I2C(busio.I2C(board.SCL, board.SDA),
177177
address=0x19)
178+
_ = ACCEL.acceleration # Dummy reading to blow out any startup residue
179+
time.sleep(0.1)
178180
DISPLAY.rotation = (int(((math.atan2(-ACCEL.acceleration.y,
179181
-ACCEL.acceleration.x) + math.pi) /
180182
(math.pi * 2) + 0.875) * 4) % 4) * 90
@@ -368,7 +370,7 @@ def __init__(self, datetime, hours_ahead, utc_offset):
368370
GROUP[0] = TILE_GRID
369371

370372
# Update percent value (5 labels: GROUP[1-4] for outline, [5] for text)
371-
if PERCENT >= 100:
373+
if PERCENT >= 99.95:
372374
STRING = '100%'
373375
else:
374376
STRING = '{:.1f}'.format(PERCENT + 0.05) + '%'
@@ -421,4 +423,5 @@ def __init__(self, datetime, hours_ahead, utc_offset):
421423
GROUP[7].x = CENTER_X - GROUP[7].bounding_box[2] // 2
422424
GROUP[7].y = TIME_Y + 10
423425

426+
DISPLAY.refresh() # Force full repaint (splash screen sometimes sticks)
424427
time.sleep(5)

0 commit comments

Comments
 (0)