kopia lustrzana https://github.com/pimoroni/pimoroni-pico
commit
5bc85c0e6d
|
@ -158,11 +158,13 @@ down_button = machine.Pin(CosmicUnicorn.SWITCH_VOLUME_DOWN, machine.Pin.IN, mach
|
||||||
|
|
||||||
|
|
||||||
def adjust_utc_offset(pin):
|
def adjust_utc_offset(pin):
|
||||||
global utc_offset
|
global utc_offset, last_second
|
||||||
if pin == up_button:
|
if pin == up_button:
|
||||||
utc_offset += 1
|
utc_offset += 1
|
||||||
|
last_second = None
|
||||||
if pin == down_button:
|
if pin == down_button:
|
||||||
utc_offset -= 1
|
utc_offset -= 1
|
||||||
|
last_second = None
|
||||||
|
|
||||||
|
|
||||||
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
||||||
|
@ -214,9 +216,11 @@ sync_time()
|
||||||
while True:
|
while True:
|
||||||
if cu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_UP):
|
if cu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_UP):
|
||||||
cu.adjust_brightness(+0.01)
|
cu.adjust_brightness(+0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if cu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
if cu.is_pressed(CosmicUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
||||||
cu.adjust_brightness(-0.01)
|
cu.adjust_brightness(-0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if cu.is_pressed(CosmicUnicorn.SWITCH_A):
|
if cu.is_pressed(CosmicUnicorn.SWITCH_A):
|
||||||
sync_time()
|
sync_time()
|
||||||
|
|
|
@ -159,11 +159,13 @@ down_button = machine.Pin(GalacticUnicorn.SWITCH_VOLUME_DOWN, machine.Pin.IN, ma
|
||||||
|
|
||||||
|
|
||||||
def adjust_utc_offset(pin):
|
def adjust_utc_offset(pin):
|
||||||
global utc_offset
|
global utc_offset, last_second
|
||||||
if pin == up_button:
|
if pin == up_button:
|
||||||
utc_offset += 1
|
utc_offset += 1
|
||||||
|
last_second = None
|
||||||
if pin == down_button:
|
if pin == down_button:
|
||||||
utc_offset -= 1
|
utc_offset -= 1
|
||||||
|
last_second = None
|
||||||
|
|
||||||
|
|
||||||
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
||||||
|
@ -215,9 +217,11 @@ sync_time()
|
||||||
while True:
|
while True:
|
||||||
if gu.is_pressed(GalacticUnicorn.SWITCH_BRIGHTNESS_UP):
|
if gu.is_pressed(GalacticUnicorn.SWITCH_BRIGHTNESS_UP):
|
||||||
gu.adjust_brightness(+0.01)
|
gu.adjust_brightness(+0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if gu.is_pressed(GalacticUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
if gu.is_pressed(GalacticUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
||||||
gu.adjust_brightness(-0.01)
|
gu.adjust_brightness(-0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if gu.is_pressed(GalacticUnicorn.SWITCH_A):
|
if gu.is_pressed(GalacticUnicorn.SWITCH_A):
|
||||||
sync_time()
|
sync_time()
|
||||||
|
|
|
@ -160,11 +160,13 @@ down_button = machine.Pin(StellarUnicorn.SWITCH_VOLUME_DOWN, machine.Pin.IN, mac
|
||||||
|
|
||||||
|
|
||||||
def adjust_utc_offset(pin):
|
def adjust_utc_offset(pin):
|
||||||
global utc_offset
|
global utc_offset, last_second
|
||||||
if pin == up_button:
|
if pin == up_button:
|
||||||
utc_offset += 1
|
utc_offset += 1
|
||||||
|
last_second = None
|
||||||
if pin == down_button:
|
if pin == down_button:
|
||||||
utc_offset -= 1
|
utc_offset -= 1
|
||||||
|
last_second = None
|
||||||
|
|
||||||
|
|
||||||
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
up_button.irq(trigger=machine.Pin.IRQ_FALLING, handler=adjust_utc_offset)
|
||||||
|
@ -216,9 +218,11 @@ sync_time()
|
||||||
while True:
|
while True:
|
||||||
if su.is_pressed(StellarUnicorn.SWITCH_BRIGHTNESS_UP):
|
if su.is_pressed(StellarUnicorn.SWITCH_BRIGHTNESS_UP):
|
||||||
su.adjust_brightness(+0.01)
|
su.adjust_brightness(+0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if su.is_pressed(StellarUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
if su.is_pressed(StellarUnicorn.SWITCH_BRIGHTNESS_DOWN):
|
||||||
su.adjust_brightness(-0.01)
|
su.adjust_brightness(-0.01)
|
||||||
|
last_second = None
|
||||||
|
|
||||||
if su.is_pressed(StellarUnicorn.SWITCH_A):
|
if su.is_pressed(StellarUnicorn.SWITCH_A):
|
||||||
sync_time()
|
sync_time()
|
||||||
|
|
Ładowanie…
Reference in New Issue