summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip J Freeman <elektron@halo.nu>2022-11-09 22:21:43 -0800
committerVito Caputo <vcaputo@pengaru.com>2022-11-09 22:39:13 -0800
commitd5953892db5729fec6ffd5d8a42456c514782de4 (patch)
treeef5f4c9535d7954ea1e6ea402bae682bc3ec90eb /src
parent0fb1ebed2f4ed97d2b5789b4cb0d564c5ca19bf5 (diff)
modules/strobe: force flash even at low FPS
At low framerates, the strobe module timer can expire from frame to frame. This has the effect of appearing "always on." This condition was obscuring output in compose mode. #BirdwalkCommit #WinterStormWarning
Diffstat (limited to 'src')
-rw-r--r--src/modules/strobe/strobe.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/strobe/strobe.c b/src/modules/strobe/strobe.c
index 4616df4..bff1e64 100644
--- a/src/modules/strobe/strobe.c
+++ b/src/modules/strobe/strobe.c
@@ -17,9 +17,6 @@
/* TODO:
* - Make period setting more flexible
- * - Currently if the frame rate can't keep up with the period, strobe will
- * just stick on. There should probably be a force_flash={yes,no} setting
- * to ensure a flash still occurs when the frame rate can't keep up.
*/
#define STROBE_DEFAULT_PERIOD .1
@@ -34,6 +31,7 @@ typedef struct strobe_context_t {
strobe_setup_t setup;
unsigned ticks;
unsigned flash:1;
+ unsigned flash_ready:1;
} strobe_context_t;
@@ -66,8 +64,12 @@ static void strobe_prepare_frame(til_module_context_t *context, unsigned ticks,
*res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_slice_per_cpu };
- if (ticks - ctxt->ticks >= (unsigned)(ctxt->setup.period * 1000.f))
+ if (ctxt->flash_ready && (ticks - ctxt->ticks >= (unsigned)(ctxt->setup.period * 1000.f))){
ctxt->flash = 1;
+ ctxt->flash_ready = 0;
+ } else {
+ ctxt->flash_ready = 1;
+ }
}
© All Rights Reserved