-
Gerhard Sittig authored
Since tastes and requirements might differ, introduce support for a user specified character set in the construction of ASCII art graphs of signal levels. The syntax is "charset=<low><high>[<fall><rise>]", the default remains backwards compatible with existing consumers. In comparison to assuming a fixed character set, this change addresses several distinct aspects: Users can adjust the output for "higher visual contrast", or "straight lines" instead of dotted patterns, or "increased difference in height" for low and high signal levels, or "filled" (block like, "wall of text") appearance of periods with high levels. User adjustable characters are needed, as no single fixed set can satisfy the differing expectations. Perception of the output heavily depends on specific terminals and fonts in use. Then there is the issue of levels versus edges, and how their timing relates. By default edges are drawn at a point in time where the signal was sampled and was deteremined to already _have_ changed and have settled to the new level, which means that the position of edges in the resulting graph might be off by up to one sample period. Strictly speaking, the available set of samples only contains levels, and does not hint where exactly an edge might have occured. Though this might be considered rather nitpicky, representing the graph without edges does better reflect the input data, and might simplify postprocessing. Compare the previously only supported format (still the default, -O ascii): 1:...................................................../"""""""""""""""""""" 1:""""""""""""""""""""""""""""""""\......................................... 1:.......................................................................... to those example alternatives: $ sigrok-cli -i file.sr -O ascii:charset=_\"\\/ 1:_____________________________________________________/"""""""""""""""""""" 1:""""""""""""""""""""""""""""""""\_________________________________________ 1:__________________________________________________________________________ $ sigrok-cli -i file.sr -O ascii:charset=_\" 1:_____________________________________________________""""""""""""""""""""" 1:""""""""""""""""""""""""""""""""__________________________________________ 1:__________________________________________________________________________ $ sigrok-cli -i file.sr -O ascii:charset=_^ 1:_____________________________________________________^^^^^^^^^^^^^^^^^^^^^ 1:^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__________________________________________ 1:__________________________________________________________________________ $ sigrok-cli -i file.sr -O ascii:charset=_M 1:_____________________________________________________MMMMMMMMMMMMMMMMMMMMM 1:MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM__________________________________________ 1:__________________________________________________________________________ $ sigrok-cli -i file.sr -O ascii:charset=_X 1:_____________________________________________________XXXXXXXXXXXXXXXXXXXXX 1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX__________________________________________ 1:__________________________________________________________________________ Signed-off-by: Gerhard Sittig <gerhard.sittig@gmx.net>
0150fdca