X-Git-Url: http://git.rrze.uni-erlangen.de/gitweb/?p=moodlight.git;a=blobdiff_plain;f=console.c;fp=console.c;h=d884017f3822f284e33fd775bdf089e55a7bc637;hp=8dff9f4b72ecef5c2d034fd52f6e9bd6657f5a0e;hb=4307b86abbc1664bf3de89518962491a9e491653;hpb=e001c0863c4fee6b80e36464cdbd05b0c8ce25a9 diff --git a/console.c b/console.c index 8dff9f4..d884017 100644 --- a/console.c +++ b/console.c @@ -1,4 +1,4 @@ -/* $Id: console.c,v 1.4 2010/07/24 20:55:48 simimeie Exp $ +/* $Id: console.c,v 1.5 2010/07/25 20:40:44 simimeie Exp $ * Functions for a serial console. */ @@ -349,6 +349,7 @@ ISR(USART_RX_vect) { saveeepromsettings(); console_printpgm_noirq_P(PSTR("Settings written to EEPROM."));*/ } else if (strcmp_P(inputbuf, PSTR("status")) == 0) { + uint8_t v; console_printpgm_noirq_P(PSTR("Current status:\r\n")); console_printpgm_noirq_P(PSTR("red = ")); console_printhex8_noirq(ledpwm_re); @@ -358,34 +359,38 @@ ISR(USART_RX_vect) { console_printhex8_noirq(ledpwm_bl); console_printpgm_noirq_P(PSTR(", brightness = ")); console_printhex8_noirq(ledpwm_bri); + console_printpgm_noirq_P(PSTR("\r\nvalues ")); + for (v = 0; v < 3; v++) { + console_printhex8_noirq(ledpwm_val[v] >> 8); + console_printhex8_noirq(ledpwm_val[v] & 0xff); + console_printpgm_noirq_P(PSTR(" ")); + } } else if (strncmp_P(inputbuf, PSTR("r "), 2) == 0) { uint8_t v; v = strtoul(&inputbuf[2], NULL, 0); ledpwm_re = v; - ledpwm_setled(LEDPWM_REDLED, (((uint16_t)ledpwm_re * ledpwm_bri) / 255)); + ledpwm_setled(LEDPWM_REDLED, ((uint16_t)ledpwm_re * ledpwm_bri)); console_printpgm_noirq_P(PSTR("RED value set to 0x")); console_printhex8_noirq(v); } else if (strncmp_P(inputbuf, PSTR("g "), 2) == 0) { uint8_t v; v = strtoul(&inputbuf[2], NULL, 0); ledpwm_gr = v; - ledpwm_setled(LEDPWM_GREENLED, (((uint16_t)ledpwm_gr * ledpwm_bri) / 255)); + ledpwm_setled(LEDPWM_GREENLED, ((uint16_t)ledpwm_gr * ledpwm_bri)); console_printpgm_noirq_P(PSTR("GREEN value set to 0x")); console_printhex8_noirq(v); } else if (strncmp_P(inputbuf, PSTR("b "), 2) == 0) { uint8_t v; v = strtoul(&inputbuf[2], NULL, 0); ledpwm_bl = v; - ledpwm_setled(LEDPWM_BLUELED, (((uint16_t)ledpwm_bl * ledpwm_bri) / 255)); + ledpwm_setled(LEDPWM_BLUELED, ((uint16_t)ledpwm_bl * ledpwm_bri)); console_printpgm_noirq_P(PSTR("BLUE value set to 0x")); console_printhex8_noirq(v); } else if (strncmp_P(inputbuf, PSTR("bri "), 2) == 0) { uint8_t v; v = strtoul(&inputbuf[4], NULL, 0); ledpwm_bri = v; - ledpwm_setled(LEDPWM_REDLED, (((uint16_t)ledpwm_re * ledpwm_bri) / 255)); - ledpwm_setled(LEDPWM_GREENLED, (((uint16_t)ledpwm_gr * ledpwm_bri) / 255)); - ledpwm_setled(LEDPWM_BLUELED, (((uint16_t)ledpwm_bl * ledpwm_bri) / 255)); + ledpwm_set(ledpwm_re, ledpwm_gr, ledpwm_bl, ledpwm_bri); console_printpgm_noirq_P(PSTR("brightness set to 0x")); console_printhex8_noirq(v); } else if (strcmp_P(inputbuf, PSTR("rfstatus")) == 0) {