diff --git a/application.c b/application.c index 7f54d1a..637dae2 100644 --- a/application.c +++ b/application.c @@ -306,25 +306,126 @@ static void ir_action(const struct ir_nec_code_t* code) if (code->repeat) { // don't handle long button press repeating the code return; } - if (0 != code->address) { // current remote uses this address - return; - } - switch (code->command) { - case 0x30: // power button - strobe_toggle(); - printf("toggle strobe\n"); - break; - case 0x88: // 1 button - strobe_play(strobe_single, LENGTH(strobe_single)); - printf("strobe animation 1\n"); - break; - case 0x48: // 2 button - strobe_play(strobe_double, LENGTH(strobe_double)); - printf("strobe animation 2\n"); - break; - default: - printf("unknown code\n"); - break; + if (0x00f7 == code->address) { // flat LED IR remote + switch (code->command) { // choose animation depending on button + case 0x00: // UP + strobe_toggle(); + printf("toggle strobe\n"); + break; + case 0x80: // DOWN + printf("start flickering\n"); + flicker_off = false; // let flickering happen in main loop + break; + case 0xc0: // ON + strobe_on(); + printf("light on\n"); + break; + case 0x40: // OFF + strobe_off(); + flicker_off = true; // stop flickering + printf("light off\n"); + break; + case 0x20: // red + case 0x10: // orange + case 0x30: // orange + case 0x08: // orange + case 0x28: // organe + printf("1 strobe\n"); + strobe_play(strobe1, LENGTH(strobe1)); + break; + case 0xa0: // green + case 0x90: // green + case 0xb0: // green + case 0x88: // green + case 0xa8: // green + printf("2 strobes\n"); + strobe_play(strobe2, LENGTH(strobe2)); + break; + case 0x60: // blue + case 0x50: // blue + case 0x70: // blue + case 0x48: // blue + case 0x68: // blue + printf("3 strobes\n"); + strobe_play(strobe3, LENGTH(strobe3)); + break; + case 0xe0: // W + case 0xd0: // flash + case 0xc8: // fade + case 0xf0: // strobe + printf("5 strobes\n"); + strobe_play(strobe5, LENGTH(strobe5)); + break; + case 0xe8: // smooth + printf("10 strobes\n"); + strobe_play(strobe10, LENGTH(strobe10)); + break; + default: + printf("unknown code\n"); + break; + } + } else if (0x407f == code->address) { // iDual remote + switch (code->command) { // choose animation depending on button + case 0x08: // brightness down + strobe_toggle(); + printf("toggle strobe\n"); + break; + case 0x90: // brightness up + printf("start flickering\n"); + flicker_off = false; // let flickering happen in main loop + break; + case 0x80: // ON + strobe_on(); + printf("light on\n"); + break; + case 0x40: // OFF + strobe_off(); + flicker_off = true; // stop flickering + printf("light off\n"); + break; + case 0x88: // left + case 0x48: + case 0xc8: + case 0x28: + printf("1 strobe\n"); + strobe_play(strobe1, LENGTH(strobe1)); + break; + case 0x68: // middle-left + case 0xe8: + case 0x18: + case 0x98: + printf("2 strobes\n"); + strobe_play(strobe2, LENGTH(strobe2)); + break; + case 0x50: // middle-right + case 0xd0: + case 0x30: + case 0xb0: + printf("3 strobes\n"); + strobe_play(strobe3, LENGTH(strobe3)); + break; + case 0xc0: // right + case 0x20: + case 0xa0: + case 0x60: + printf("5 strobes\n"); + strobe_play(strobe5, LENGTH(strobe5)); + break; + case 0x70: // circle + case 0xa8: + case 0x58: + case 0xf0: + case 0xe0: + case 0x10: + printf("10 strobes\n"); + strobe_play(strobe10, LENGTH(strobe10)); + break; + default: + printf("unknown code\n"); + break; + } + } else { + printf("unknown remote\n"); } }