Improve semantics of the 'sequence' command to led(4) devices:

use lowercase for off and upper case for on.

Approved by:	re@
This commit is contained in:
Poul-Henning Kamp 2003-11-27 20:23:32 +00:00
parent 8e2d74a486
commit 9491306ad3
2 changed files with 14 additions and 14 deletions

View File

@ -108,9 +108,9 @@ digit a two second pause after which the sequence is repeated.
.It Ic s%s .It Ic s%s
string. string.
This gives full control over the announciator. This gives full control over the announciator.
Letters 'a' ... 'j' turns the announciator on for from 1/10th to one full Letters 'A' ... 'J' turns the announciator on for from 1/10th to one full
second. second.
Letters 'A' ... 'J' turns the announciator off for 1/10th Letters 'a' ... 'j' turns the announciator off for 1/10th
to one full second. The sequence is immediately repeated. to one full second. The sequence is immediately repeated.
.It Ic m%s .It Ic m%s
morse. morse.

View File

@ -52,7 +52,7 @@ led_timeout(void *p)
sc->count--; sc->count--;
continue; continue;
} }
sc->func(sc->private, sc->ptr[0] >= 'a' ? 1 : 0); sc->func(sc->private, sc->ptr[0] >= 'a' ? 0 : 1);
sc->count = sc->ptr[0] & 0xf; sc->count = sc->ptr[0] & 0xf;
if (*(++sc->ptr) == '\0') if (*(++sc->ptr) == '\0')
sc->ptr = sc->str; sc->ptr = sc->str;
@ -121,7 +121,7 @@ led_write(dev_t dev, struct uio *uio, int ioflag)
i = s[1] - '1'; i = s[1] - '1';
else else
i = 0; i = 0;
sbuf_printf(sb, "%c%c", 'a' + i, 'A' + i); sbuf_printf(sb, "%c%c", 'A' + i, 'a' + i);
break; break;
/* /*
* Digits, flashes out numbers. * Digits, flashes out numbers.
@ -135,15 +135,15 @@ led_write(dev_t dev, struct uio *uio, int ioflag)
if (i == 0) if (i == 0)
i = 10; i = 10;
for (; i > 1; i--) for (; i > 1; i--)
sbuf_cat(sb, "aA"); sbuf_cat(sb, "Aa");
sbuf_cat(sb, "aJ"); sbuf_cat(sb, "Aj");
} }
sbuf_cat(sb, "JJ"); sbuf_cat(sb, "jj");
break; break;
/* /*
* String, roll your own. * String, roll your own.
* 'A-J' gives "off" for n/10 sec. * 'a-j' gives "off" for n/10 sec.
* 'a-j' gives "on" for n/10 sec. * 'A-J' gives "on" for n/10 sec.
* no delay before repeat * no delay before repeat
* 'sAaAbBa' becomes _-_--__- * 'sAaAbBa' becomes _-_--__-
*/ */
@ -168,15 +168,15 @@ led_write(dev_t dev, struct uio *uio, int ioflag)
case 'm': case 'm':
for(s++; *s; s++) { for(s++; *s; s++) {
if (*s == '.') if (*s == '.')
sbuf_cat(sb, "Aa"); sbuf_cat(sb, "aA");
else if (*s == '-') else if (*s == '-')
sbuf_cat(sb, "Ac"); sbuf_cat(sb, "aC");
else if (*s == ' ') else if (*s == ' ')
sbuf_cat(sb, "B"); sbuf_cat(sb, "b");
else if (*s == '\n') else if (*s == '\n')
sbuf_cat(sb, "D"); sbuf_cat(sb, "d");
} }
sbuf_cat(sb, "J"); sbuf_cat(sb, "j");
break; break;
default: default:
break; break;