// // Attempt to have a litle datapath in there for sending blinkm cmds over IR // Doesn't work very reliably yet // static void get_data(void) { uint8_t i,j,d[8]; // the data, at most 8 bytes uint16_t v,len=0; j=200; while( !(len = ir_getkey()) ) { // length of packet _delay_ms(1); j--; if( j == 0 ) // FIXME: dumb timeout goto dataerror; } len = (len>8) ? 8 : len; // enforce bounds for( i=0; i<len; i++ ) { j = 200; while( !(v=ir_getkey()) ) { // wait for key then store it _delay_ms(1); j--; if( j == 0 ) // FIXME: dumb timeout goto dataerror2; } d[i] = v; } datadone: /* // this takes too long, 2400 bps sucks softuart_printHex(len); softuart_putc('='); for( i=0;i<len;i++) { softuart_printHex( d[i] ); softuart_putc(','); } */ // now do something with that data if( len == 4 ) { softuart_putc('*'); blinkm_sendCmd3( d[0], d[1],d[2],d[3] ); } mode = MODE_OFF; return; dataerror2: softuart_putc('!'); dataerror: softuart_putc('!'); goto datadone; // so we can at least see the partial data }
// a little hello fanfare static void fanfare( uint8_t times ) { for( int i=0;i<times; i++ ) { #if DEBUG > 0 softuart_putc('*'); #else statled_set(1); #endif blinkm_setRGB( 0x09,0x09,0x09); _delay_ms(150); #if DEBUG > 0 #else statled_set(0); #endif blinkm_setRGB( 0x00,0x00,0x00); _delay_ms(150); } }
// main routine int main(void) { // initiate software-uart for serial communication softuart_init(); // initialize input and output ports io_init(); struct { unsigned heating:1; unsigned ready:1; } state; // pwm-counter uint8_t pwm_ctr = 0; // while .. forever while(1) { // read temp uint16_t val = io_get_temp_adc(); // detect sensor shortage or breakage if(val < 24 || val > 1000) { // write message to serial softuart_puts_p(PSTR("ACD-Value out of range: ")); softuart_puts_uint16(val); softuart_putc('\n'); // turn heater off io_set_heating(0); // make ready-led blink io_set_ready(0); _delay_ms(250); io_set_ready(1); _delay_ms(250); // try again continue; } // pwm switching difference uint8_t pwm = 0; if(val > Vshould) { pwm = val - Vshould; } // pwm switch if (pwm < pwm_ctr) { state.heating = 0; } else { state.heating = 1; } // pwm increases with the temperature rising // 11+ = heating is always-on // 5 = heating is 1/2 the time on // 0 = heating is always-off if(pwm < 5) { state.ready = 1; } else if(pwm > 8) { state.ready = 0; } // pwm counter increment if(++pwm_ctr >= 10) pwm_ctr = 0; // set heater status io_set_heating(state.heating); // set ready status io_set_ready(state.ready); // write status to serial softuart_puts_p(PSTR("ADC-Value: ")); softuart_puts_uint16(val); softuart_puts_p(PSTR(", ADC-Goal: ")); softuart_puts_uint16(Vshould); softuart_puts_p(PSTR(", Ready: ")); softuart_puts_uint16(state.ready); softuart_puts_p(PSTR(", Heating: ")); softuart_puts_uint16(state.heating); softuart_putc('\n'); // wait 1/4 second _delay_ms(250); } // end of program return 0; }
int main( void ) { init_system(); // initialise host app, pins, watchdog, etc init_timer_isr(); // configure timer ISR to fire regularly softuart_init(); softuart_puts("\nbattir3\n"); ir_init(); i2c_init(); blinkm_stop(); blinkm_setRGB( 0,0,0 ); _delay_ms(300); // a little hello fanfare for( int i=0;i<2; i++ ) { softuart_printHex16( i ); softuart_puts("!"); blinkm_setRGB( 0x02,0x02,0x02); _delay_ms(50); blinkm_setRGB( 0x01,0x01,0x01); _delay_ms(50); } blinkm_setRGB( 0,0,0 ); blinkm_playScript(0,0); sei(); // enable interrupts softuart_puts(":\n"); int power_on = 1; // loop forever for( ; ; ) { if( time_to_measure ) { time_to_measure = 0; // clear flag: time to measure touch uint16_t key = ir_getkey(); if( key==0 ) // no key continue; softuart_puts("k:"); softuart_printHex16( key ); softuart_putc('\n'); if( key == IRKEY_ONE ) { blinkm_fadeToRGB( 0xff,0x00,0x00 ); } else if( key == IRKEY_TWO ) { blinkm_fadeToRGB( 0x00,0xff,0x00 ); } else if( key == IRKEY_THREE ) { blinkm_fadeToRGB( 0x00,0x00,0xff ); } else if( key == IRKEY_FOUR ) { blinkm_fadeToRGB( 0xff,0xff,0x00 ); } else if( key == IRKEY_FIVE ) { blinkm_fadeToRGB( 0x00,0xff,0xff ); } else if( key == IRKEY_SIX ) { blinkm_fadeToRGB( 0xff,0x00,0xff ); } else if( key == IRKEY_SEVEN ) { blinkm_fadeToRGB( 0x11,0x11,0x11 ); } else if( key == IRKEY_EIGHT ) { blinkm_fadeToRGB( 0x80,0x80,0x80 ); } else if( key == IRKEY_NINE ) { blinkm_fadeToRGB( 0xff,0xff,0xff ); } else if( key == IRKEY_ZERO ) { blinkm_fadeToRGB( 0x00,0x00,0x00 ); } else if( key == IRKEY_VOLUP ) { blinkm_setFadespeed( 80 ); } else if( key == IRKEY_VOLDN ) { blinkm_setFadespeed( 5 ); } else if( key == IRKEY_POWER ) { if( power_on ) { blinkm_stop(); blinkm_fadeToRGB( 0x00,0x00,0x00 ); power_on = 0; } else { blinkm_playScript(0,0); power_on = 1; } _delay_ms(500); // arbitrary wait to approximate key debounce } else if( key == IRKEY_PLAY ) { blinkm_playScript( 0, 0 ); } } } // for }
int main( void ) { CLKPR = _BV( CLKPCE ); // enable clock prescale change #if F_CPU == 500000 CLKPR = _BV(CLKPS2) ; // div clock by 16 (8MHz -> 0.5MHz) #else CLKPR = 0; // full speed (8MHz) #endif #if F_CPU == 500000 TCCR1 |= _BV(CS12); // clock/8 see calc below @0.5MHz #endif #if F_CPU == 8000000 TCCR1 |= _BV(CS12)|_BV(CS11)|_BV(CS10); // clock/64 see calc below @8MHz #endif TIFR |= _BV( TOV1 ); // clear interrupt flag TIMSK |= _BV( TOIE1 ); // enable timer 1 overflow interrupt sei(); // enable interrupts LED_DDR |= _BV( LED_PIN ); // make output softuart_init(); softuart_puts("\nfreem_p6\n"); _delay_ms(300); // wait for power to stabilize before doing i2c ir_init(); i2c_init(); #if DEBUG > 0 softuart_puts("300ms? "); lastmillis = millis; _delay_ms(300); // timing test, just chill a bit, yo softuart_printDec16( millis-lastmillis ); // should be close to 300 #endif blinkm_turnOff(); // a little hello fanfare for( int i=0;i<3; i++ ) { #if DEBUG > 0 softuart_puts("*"); #else statled_set(1); #endif blinkm_setRGB( 0x09,0x09,0x09); _delay_ms(150); #if DEBUG > 0 #else statled_set(0); #endif blinkm_setRGB( 0x00,0x00,0x00); _delay_ms(150); } hue = 0; bri = 255; //mode = MODE_RANDMOOD; // start out in moodlight mode lastmillis = 0-MILLIS_MOOD; blinkm_fadeToHSB( rand(),255,bri ); // loop forever for( ; ; ) { handle_key(); // read a key, maybe change mode, or hue/bri //get_ir_data(); // FIXME: this could be refactored to be more efficient if( mode == MODE_RANDMOOD ) { if( millis - changemillis > MILLIS_MOOD ) { changemillis = millis; hue = rand(); softuart_puts("rhb:"); softuart_printHex(hue); softuart_putc(','); softuart_printHex(bri); softuart_putc('\n'); } blinkm_setFadespeed( FADESPEED_RANDMOOD ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_RANDFAST ) { if( millis - changemillis > MILLIS_FAST ) { changemillis = millis; hue = rand(); blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri ); } blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_HUE ) { blinkm_setFadespeed( FADESPEED_RANDMOOD ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_FLASH ) { if( millis - changemillis > MILLIS_FAST ) { changemillis = millis; bri = (bri==255) ? 0:255; blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri); } } } // for }
// // Parse the key presses from IR remote // static void handle_key(void) { key = ir_getdata( buf ); if( key == 0 ) { // no IR data of any kind return; } else if( key == 1 ) { // got CtrlM 8-byte packet #if DEBUG >0 softuart_puts("ctrlm:"); softuart_printHex( buf[1] ); softuart_putc(','); softuart_printHex( buf[2] ); softuart_putc(','); softuart_printHex( buf[3] ); softuart_putc(','); softuart_printHex( buf[4] ); softuart_putc(','); softuart_printHex( buf[5] ); softuart_putc(','); softuart_printHex( buf[6] ); softuart_putc('\n'); #else statled_set(1); #endif if( buf[2] == 0xff && buf[3] == 0xff ) { // set freem addr cmd freem_addr = buf[1]; eeprom_write_byte( &ee_freem_addr, freem_addr ); // write address } else if( buf[1] == freem_addr || buf[1] == 0 ) { i2csendaddr = buf[2]; blinkm_sendCmd3( buf[3], buf[4], buf[5], buf[6] ); } #if DEBUG >0 #else statled_set(0); #endif return; // done with data mode } // Otherwise, it's an RC code #if DEBUG > 0 softuart_puts("k:"); softuart_printHex16( key ); softuart_putc('\n'); #else statled_set(1); #endif if( !(key == IRKEY_VOLUP || key == IRKEY_VOLDN) ) { blinkm_stopScript(); blinkm_setFadespeed( FADESPEED_DEFAULT ); } if( key == IRKEY_POWER ) { #if DEBUG > 0 softuart_puts("off\n"); #endif mode = MODE_OFF; blinkm_turnOff(); } else if( key == IRKEY_CHUP ) { mode = MODE_HUE; if( bri==0 ) bri = 120; hue +=5; } else if( key == IRKEY_CHDN ) { mode = MODE_HUE; if( bri==0 ) bri = 120; hue -=5; } else if( key == IRKEY_VOLUP ) { if( bri >= 250 ) bri = 255; else bri += 10; } else if( key == IRKEY_VOLDN ) { if( bri < 5 ) bri = 0; else bri -= 10; } else if( key == IRKEY_ONE ) { mode = MODE_RANDMOOD; if( bri == 0 ) bri = 127; } else if( key == IRKEY_TWO ) { mode = MODE_RANDFAST; if( bri == 0 ) bri = 127; } else if( key == IRKEY_THREE ) { mode = MODE_FLASH; } else if( key == IRKEY_FOUR ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0xff,0x00 ); } else if( key == IRKEY_FIVE ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x00,0xff,0xff ); } else if( key == IRKEY_SIX ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0x00,0xff ); } else if( key == IRKEY_SEVEN ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x11,0x11,0x11 ); } else if( key == IRKEY_EIGHT ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x80,0x80,0x80 ); } else if( key == IRKEY_NINE ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0xff,0xff ); } else if( key == IRKEY_ZERO ) { mode = MODE_PLAYSCRIPT; blinkm_setFadespeed( FADESPEED_DEFAULT ); blinkm_playScript( 0,0 ); } //else if( key == IRKEY_FREEM_DATA_ON ) { // mode = MODE_DATA; // get_data(); //} //else if( key == IRKEY_FREEM_DATA_OFF ) { // mode = MODE_OFF; // /* softuart_puts("m:"); softuart_printHex(mode); softuart_puts(" hb:"); // print little summary softuart_printHex(hue); softuart_putc(','); softuart_printHex(bri); softuart_putc('\n'); */ #if DEBUG > 0 #else statled_set(0); #endif }
int main( void ) { CLKPR = _BV( CLKPCE ); // enable clock prescale change #if F_CPU == 500000 CLKPR = _BV(CLKPS2) ; // div clock by 16 (8MHz -> 0.5MHz) #else CLKPR = 0; // full speed (8MHz) #endif #if F_CPU == 500000 TCCR1 |= _BV(CS12); // clock/8 see calc below @0.5MHz #endif #if F_CPU == 8000000 TCCR1 |= _BV(CS12)|_BV(CS11)|_BV(CS10); // clock/64 see calc below @8MHz #endif TIFR |= _BV( TOV1 ); // clear interrupt flag TIMSK |= _BV( TOIE1 ); // enable timer 1 overflow interrupt sei(); // enable interrupts LED_DDR |= _BV( LED_PIN ); // make output softuart_init(); softuart_putsP("\nfreem_p7\n"); _delay_ms(300); // wait for power to stabilize before doing i2c // load up our address freem_addr = eeprom_read_byte( &ee_freem_addr ); softuart_putsP("addr:"); softuart_printHex(freem_addr);softuart_putc('\n'); ir_init(); i2c_init(); #if DEBUG > 1 softuart_puts("300ms? "); _delay_ms(300); // timing test, just chill a bit, yo softuart_printDec16( millis-lastmillis ); // should be close to 300 #endif blinkm_turnOff(); fanfare( 3 ); mode = MODE_RANDMOOD; // start out in moodlight mode changemillis = millis - 2*MILLIS_MOOD; // loop forever for( ; ; ) { handle_key(); // read a key, maybe change mode, or hue/bri changemillisdiff = millis - changemillis; // FIXME: this could be refactored to be more efficient if( mode == MODE_RANDMOOD ) { if( changemillisdiff > MILLIS_MOOD ) { softuart_putsP("rhb:"); softuart_printHex(hue); softuart_putc(','); softuart_printHex(bri); softuart_putc('\n'); changemillis = millis; hue = rand(); } blinkm_setFadespeed( FADESPEED_RANDMOOD ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_RANDFAST ) { if( changemillisdiff > MILLIS_FAST ) { changemillis = millis; hue = rand(); blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri ); } blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_WHITE ) { blinkm_setFadespeed( FADESPEED_RANDMOOD ); blinkm_fadeToRGB( bri, bri, bri ); } else if( mode == MODE_HSB ) { blinkm_setFadespeed( FADESPEED_RANDMOOD ); blinkm_fadeToHSB( hue, 255, bri ); } else if( mode == MODE_FLASH ) { if( changemillisdiff > MILLIS_FAST ) { softuart_putsP("ms:"); softuart_printHex16(changemillisdiff); softuart_putc(','); softuart_printHex16(millis); softuart_putc('\n'); changemillis = millis; bri = (keyheld) ? 255 : (bri==0) ? 255:0; blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri); } } else if( mode == MODE_FLASHONCE ) { if( changemillis == 0 ) { // start blinkm_setFadespeed( FADESPEED_RANDFAST ); blinkm_fadeToHSB( hue, 255, bri); changemillis = millis; } else if( changemillisdiff > MILLIS_FAST ) { //stop blinkm_fadeToHSB( 0,0,0); mode = MODE_OFF; changemillis = 0; } } } // for }
// // Parse the key presses from IR remote // static void handle_key(void) { if( (millis - keylast_millis) > KEYMILLIS_HOLD ) { keyheld = 0; } key = ir_getdata( buf ); if( key == 0 ) { // no IR data of any kind return; } else if( key == 1 ) { // got CtrlM 8-byte packet #if DEBUG >0 softuart_putsP("ctrlm:"); //softuart_printHex( buf[0] ); softuart_putc(','); // start byte 0x55 softuart_printHex( buf[1] ); softuart_putc(','); // freem_addr softuart_printHex( buf[2] ); softuart_putc(','); // blinkm_addr softuart_printHex( buf[3] ); softuart_putc(','); // blinkm_cmd softuart_printHex( buf[4] ); softuart_putc(','); // blinkm_arg1 softuart_printHex( buf[5] ); softuart_putc(','); // blinkm_arg2 softuart_printHex( buf[6] ); softuart_putc(':'); // blinkm_arg3 //softuart_printHex( buf[7] ); softuart_putc('\n'); // checksum #else statled_set(1); #endif mode = MODE_OFF; if( buf[2] == 0xff && buf[3] == 0xff ) { // set freem addr cmd softuart_putsP("new freem addr\n"); freem_addr = buf[1]; eeprom_write_byte( &ee_freem_addr, freem_addr ); // write address fanfare(5); // let people know we did the deed } else if( buf[1] == freem_addr || buf[1] == 0 ) { softuart_putsP("me!"); i2csendaddr = buf[2]; blinkm_sendCmd3( buf[3], buf[4], buf[5], buf[6] ); } #if DEBUG >0 softuart_putc('\n'); #else statled_set(0); #endif return; // done with data mode } // Otherwise, it's an RC code // okay, we have these cases: // no presses for long time, then keypress // hold-down key, same key every 50ms or so // press key, wait a little bit, press key again // press key, press another key if( key == keylast ) { // same key if( (millis - keylast_millis) < KEYMILLIS_MIN ) { // a repeat if( millis - keymillis > KEYMILLIS_HOLD ) { // since start of key keyheld = 1; } } else { // or press and press again, reset key start time keymillis = millis; } } else { // a new key, reset keymillis = millis; keyheld = 0; } keylast = key; keylast_millis = millis; #if DEBUG > 1 softuart_puts("k:"); softuart_printHex16( key ); softuart_putc('\n'); #else statled_set(1); #endif if( !(key == IRKEY_VOLUP || key == IRKEY_VOLDN) ) { blinkm_stopScript(); blinkm_setFadespeed( FADESPEED_DEFAULT ); } if( key == IRKEY_POWER ) { softuart_putsP("off\n"); mode = MODE_OFF; blinkm_turnOff(); } else if( key == IRKEY_CHUP ) { // increase hue, for current mode if( mode == MODE_OFF ) mode = MODE_HSB; hue+=2; softuart_putsP("h+:"); softuart_printHex(hue); softuart_putc('\n'); } else if( key == IRKEY_CHDN ) { // decrease hue, for current mode if( mode == MODE_OFF ) mode = MODE_HSB; softuart_putsP("h-:"); softuart_printHex(hue); softuart_putc('\n'); } else if( key == IRKEY_VOLUP ) { // increase brightness, for current mode if( mode == MODE_OFF ) mode = MODE_HSB; if( bri < 253 ) bri+=3; else bri = 255; softuart_putsP("b+:"); softuart_printHex(bri); softuart_putc('\n'); } else if( key == IRKEY_VOLDN ) { // increase brightness, for current mode if( mode == MODE_OFF ) mode = MODE_HSB; if( bri > 2 ) bri-=3; else bri = 0; softuart_putsP("b-:"); softuart_printHex(bri); softuart_putc('\n'); } else if( key == IRKEY_ONE ) { // mode: random mood light softuart_putsP("mood\n"); mode = MODE_RANDMOOD; if( bri == 0 ) bri = 255; // fix brightness on startup } else if( key == IRKEY_TWO ) { // mode: fast random softuart_putsP("rand\n"); mode = MODE_RANDFAST; if( bri == 0 ) bri = 255; // fix brightness on startup if( keyheld ) { // reset hue/bri on holding key hue = 0; bri = 255; } } else if( key == IRKEY_THREE ) { // mode: beacon flash softuart_putsP("flash\n"); mode = MODE_FLASH; if( keyheld ) { // reset hue/bri on holding key hue = 0; bri = 255; } } else if( key == IRKEY_FOUR ) { // mode: fixed color softuart_putsP("hsb\n"); mode = MODE_HSB; if( bri == 0 ) bri = 255; if( keyheld ) { // reset hue/bri on holding key softuart_putc('+'); hue+=2; } //blinkm_fadeToHSB( hue, 0xff, bri ); } else if( key == IRKEY_FIVE ) { // mode: single flash at color softuart_putsP("flash1\n"); mode = MODE_FLASHONCE; changemillis = 0; if( keyheld ) { // reset hue/bri on holding key hue = 0; bri = 255; } } else if( key == IRKEY_SIX ) { softuart_putsP("rand1\n"); mode = MODE_HSB; bri = rand(); hue = rand(); } else if( key == IRKEY_SEVEN ) { // low-white at vol up/dn brightness softuart_putsP("lwhite\n"); mode = MODE_WHITE; bri = 0x11; blinkm_fadeToRGB( bri, bri, bri ); } else if( key == IRKEY_EIGHT ) { // mid-white at vol up/dn brightness softuart_putsP("mwhite\n"); mode = MODE_WHITE; bri = 0x80; blinkm_fadeToRGB( bri, bri, bri ); } else if( key == IRKEY_NINE ) { // low-white at vol up/dn brightness softuart_putsP("white\n"); mode = MODE_WHITE; blinkm_fadeToRGB( bri, bri, bri ); if( keyheld ) { // make brighter on key hold bri += 10; // will just wrap around } } else if( key == IRKEY_ZERO ) { softuart_putsP("play0\n"); mode = MODE_PLAYSCRIPT; blinkm_setFadespeed( FADESPEED_DEFAULT ); blinkm_playScript( 0,0 ); } #if DEBUG > 0 #else statled_set(0); #endif key = 0; }
// // Parse the key presses from IR remote // static void handle_key(void) { key = ir_getkey(); if( key==0 ) // no key return; #if DEBUG > 1 softuart_puts("k:"); softuart_printHex16( key ); softuart_putc('\n'); #endif #if DEBUG==0 statled_toggle(); #endif if( !(key == IRKEY_VOLUP || key == IRKEY_VOLDN) ) { blinkm_stopScript(); blinkm_setFadespeed( FADESPEED_DEFAULT ); } if( key == IRKEY_POWER ) { mode = MODE_OFF; blinkm_turnOff(); } else if( key == IRKEY_CHUP ) { mode = MODE_HUE; if( bri==0 ) bri = 120; hue +=5; } else if( key == IRKEY_CHDN ) { mode = MODE_HUE; if( bri==0 ) bri = 120; hue -=5; } else if( key == IRKEY_VOLUP ) { if( bri >= 250 ) bri = 255; else bri += 10; } else if( key == IRKEY_VOLDN ) { if( bri < 5 ) bri = 0; else bri -= 10; } else if( key == IRKEY_ONE ) { mode = MODE_RANDMOOD; if( bri == 0 ) bri = 127; } else if( key == IRKEY_TWO ) { mode = MODE_RANDFAST; if( bri == 0 ) bri = 127; } else if( key == IRKEY_THREE ) { mode = MODE_FLASH; } else if( key == IRKEY_FOUR ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0xff,0x00 ); } else if( key == IRKEY_FIVE ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x00,0xff,0xff ); } else if( key == IRKEY_SIX ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0x00,0xff ); } else if( key == IRKEY_SEVEN ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x11,0x11,0x11 ); } else if( key == IRKEY_EIGHT ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0x80,0x80,0x80 ); } else if( key == IRKEY_NINE ) { mode = MODE_NUMKEY; blinkm_fadeToRGB( 0xff,0xff,0xff ); } else if( key == IRKEY_ZERO ) { mode = MODE_PLAYSCRIPT; blinkm_setFadespeed( FADESPEED_DEFAULT ); blinkm_playScript( 0,0 ); } //else if( key == IRKEY_FREEM_DATA_ON ) { // mode = MODE_DATA; // get_data(); // } //else if( key == IRKEY_FREEM_DATA_OFF ) { // mode = MODE_OFF; //} /* softuart_puts("m:"); softuart_printHex(mode); softuart_puts(" hb:"); // print little summary softuart_printHex(hue); softuart_putc(','); softuart_printHex(bri); softuart_putc('\n'); */ }