Intended goal: enable repeat occurrences of the same character within flaps[], for specific applications of splitflap displays (e.g. countdown clocks with more than 10 flaps).
In the use-case of a countdown clock (e.g. train arrival time countdown) the flaps[] definition might look something like this:
Currently, when moving from the character '0' to the character '9', the module would turn from index 9 all the way around to index 0, passing over the duplicate '9' characters at indices 10, 20, and 30.
To achieve the goal outlined above, this pull request alters the FindFlapIndex function in Splitflap.ino:
FindFlapIndex takes the current value of target_flap_index as a second argument, and loops through flaps[] starting at that index instead of starting at 0. This finds the NEXT occurrence of the desired character, rather than the FIRST occurrence, enabling repeated occurrences of the same character within flaps[].
With this change, moving from the character '0' to the character '9' could be from index 9 to 10, or 19 to 20, or 29 to 30, or 39 to 0, minimizing the necessary rotation for splitflap implementations with repeated characters.
(This is my first-ever contribution to an open source project so if I am going about this the wrong way, my apologies, and please let me know what I can do differently. Thanks!)
Intended goal: enable repeat occurrences of the same character within
flaps[]
, for specific applications of splitflap displays (e.g. countdown clocks with more than 10 flaps).In the use-case of a countdown clock (e.g. train arrival time countdown) the
flaps[]
definition might look something like this:Currently, when moving from the character '0' to the character '9', the module would turn from index 9 all the way around to index 0, passing over the duplicate '9' characters at indices 10, 20, and 30.
To achieve the goal outlined above, this pull request alters the
FindFlapIndex
function inSplitflap.ino
:FindFlapIndex
takes the current value oftarget_flap_index
as a second argument, and loops throughflaps[]
starting at that index instead of starting at 0. This finds the NEXT occurrence of the desired character, rather than the FIRST occurrence, enabling repeated occurrences of the same character withinflaps[]
.With this change, moving from the character '0' to the character '9' could be from index 9 to 10, or 19 to 20, or 29 to 30, or 39 to 0, minimizing the necessary rotation for splitflap implementations with repeated characters.
(This is my first-ever contribution to an open source project so if I am going about this the wrong way, my apologies, and please let me know what I can do differently. Thanks!)