summaryrefslogtreecommitdiff
path: root/decoders/caliper
AgeCommit message (Collapse)Author
2020-07-18caliper: use common code for packet timeoutGerhard Sittig
The previous implementation unconditionally waited for up to 1ms, and optionally handled the user configured timeout period. Use common code instead to handle the full span of the timeout period. Which somewhat unclutters the .decode() routine's body by eliminating an unnecessary step in the sequence. This change also reduces indentation, and prefers Python's .format() over the old syntax.
2020-07-18caliper: use common code for bit accumulationGerhard Sittig
There is only one annotation, rename ss/es for consistency with other decoders. Move a conversion constant to the top of the source file, and rename some identifiers to increase readability of math expressions. There is no point in constructing numbers in MSB first order and then reversing their bit order. Prefer Python lists for accumulated bits, and common code for number conversion. Use one code block for the extraction and conversion of received data instead of a set of scattered lines. This shall increase readability of the data extraction, and eliminates redundancy in the implementation.
2020-07-18caliper: refactor and unobfuscate timeout handlingGerhard Sittig
Move math expressions with always identical values out of the loop, and improve readability of the packet timeout condition in the process.
2020-07-18caliper: slight refactoring of common piecesGerhard Sittig
Merge .reset_data() into .reset() since no other location called it. Move self.options[] lookup out of the loop, drop state from self when it's strictly local to .decode(). Use a common annotation emission routine, and vertically align text variants for zoom levels. This further reduces the lengths of a few text lines.
2020-07-18caliper: fixup boilerplate (and some coding style and whitespace)Gerhard Sittig
The caliper decoder was written against an older version of the library and failed to load in recent environments. Fixup the decoder boilerplate (eliminate ambiguous annotation class/row names, drop the IC tag) and address other style nits while we are here (rephrase user visible text, break a few long lines, adjust some of the indentation and whitespace issues, drop dead code). Remaining issues get addressed later.
2020-07-18caliper: introduce decoder for cheap generic calipersTomas Mudrunka