From c1cc505e0a9035ed7dd5b0d7119df816a63fc598 Mon Sep 17 00:00:00 2001 From: ZodiusInfuser Date: Wed, 18 Aug 2021 12:19:10 +0100 Subject: [PATCH] Tweak to rotary, for consistency --- examples/plasma_2040/plasma2040_rotary.cmake | 7 ++++--- examples/plasma_2040/plasma2040_rotary.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/plasma_2040/plasma2040_rotary.cmake b/examples/plasma_2040/plasma2040_rotary.cmake index 5dfc7087..a9a63214 100644 --- a/examples/plasma_2040/plasma2040_rotary.cmake +++ b/examples/plasma_2040/plasma2040_rotary.cmake @@ -1,6 +1,7 @@ -add_executable(plasma2040_rotary plasma2040_rotary.cpp) +set(OUTPUT_NAME plasma2040_rotary) +add_executable(${OUTPUT_NAME} plasma2040_rotary.cpp) -target_link_libraries(plasma2040_rotary +target_link_libraries(${OUTPUT_NAME} pico_stdlib plasma2040 breakout_encoder @@ -9,4 +10,4 @@ target_link_libraries(plasma2040_rotary button ) -pico_add_extra_outputs(plasma2040_rotary) +pico_add_extra_outputs(${OUTPUT_NAME}) diff --git a/examples/plasma_2040/plasma2040_rotary.cpp b/examples/plasma_2040/plasma2040_rotary.cpp index 650491d4..260ef9a6 100644 --- a/examples/plasma_2040/plasma2040_rotary.cpp +++ b/examples/plasma_2040/plasma2040_rotary.cpp @@ -16,6 +16,9 @@ using namespace pimoroni; // Set how many LEDs you have const uint N_LEDS = 30; +// How many times the LEDs will be updated per second +const uint UPDATES = 60; + // Pick *one* LED type by uncommenting the relevant line below: // APA102-style LEDs with Data/Clock lines. AKA DotStar @@ -67,7 +70,7 @@ void gauge(uint v, uint vmax = 100) { int main() { stdio_init_all(); - led_strip.start(60); + led_strip.start(UPDATES); bool encoder_detected = enc.init(); enc.clear_interrupt_flag(); @@ -147,6 +150,6 @@ int main() { // Sleep time controls the rate at which the LED buffer is updated // but *not* the actual framerate at which the buffer is sent to the LEDs - sleep_ms(1000 / 60); + sleep_ms(1000 / UPDATES); } }