lkml.org 
[lkml]   [2002]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -ac] Panicking in morse code, v2
Date
Nice joke.  Unfortunately, this code is too useful to ignore.  I distinctly 
remember finding myself in the position of having completed the firmware of
an embedded device without properly recording the correspondence of led blink
patterns to error codes, the result being that if the firmware had ever failed
(luckily it never did) nobody would have been quite sure why. How much more
useful, satisfying and stylish to have encoded the failure messages in morse.

On Saturday 20 July 2002 01:02, Andrew Rodland wrote:
> Thanks a million to the unnamed linux<AT>horizon.com for some great
> suggestions/info. v2 of the morse-panic patch features better
> punctuation handling, proper morse-like timings, and something like 1/5
> the static data requirement, thanks to the varicode algo that I
> couldn't come up with myself. :)

Indeed, that one had me scratching my head, even with the code in front of
me. Let me describe the encoding method for the benefit of anybody not
energetic or foolish enough to puzzle it out for themselves:

- The sequence is encoded from low bit to high, zero=dit, one=dah

- The sequence always terminates with a one=dah, which is dropped,
followed by an infinite string of zeros.

The infinite string of zeros is shifted in from the top of the byte, hence
the terminating condition morse <= 1, which prudently covers the impossible
case of morse == 0.

This deserves a comment.

Note that there is a bug waiting to bite: you need to declare morse as
unsigned char, otherwise you will be unable to make good on your claim that
up to 7 morse bits can be encoded.

--
Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:27    [W:0.175 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site