implement IR channel/brightness +/-
This commit is contained in:
parent
0d2784f3b4
commit
0ae82501b7
|
@ -593,6 +593,8 @@ error:
|
|||
void ir_action(uint8_t address, uint8_t command)
|
||||
{
|
||||
enum IR_ACTIONS ir_code = IR_ACTION_END;
|
||||
static uint8_t channel = CHANNELS_1+CHANNELS_2;
|
||||
uint8_t step = 0xff/LEVELS;
|
||||
for (ir_code=0; ir_code<IR_ACTION_END; ir_code++) {
|
||||
if (ir_keys[ir_code][0]==address && ir_keys[ir_code][1]==command) {
|
||||
break;
|
||||
|
@ -610,14 +612,47 @@ void ir_action(uint8_t address, uint8_t command)
|
|||
PINB |= (1<<nPS_ON);
|
||||
break;
|
||||
case MODE:
|
||||
mode = (mode+1)%MODES;
|
||||
printf("selecting mode %u/%u\n",mode+1,MODES);
|
||||
channel_flag = true;
|
||||
break;
|
||||
case BRIGHTNESS_UP:
|
||||
if (channel<CHANNELS_1+CHANNELS_2) {
|
||||
if (brightness[mode][channel]<0xff-step) {
|
||||
brightness[mode][channel] += step;
|
||||
} else {
|
||||
brightness[mode][channel] = 0xff;
|
||||
}
|
||||
printf("increasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||
}
|
||||
channel_flag = true;
|
||||
break;
|
||||
case BRIGHTNESS_DOWN:
|
||||
if (channel<CHANNELS_1+CHANNELS_2) {
|
||||
if (brightness[mode][channel]>step) {
|
||||
brightness[mode][channel] -= step;
|
||||
} else {
|
||||
brightness[mode][channel] = 0x00;
|
||||
}
|
||||
printf("increasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||
}
|
||||
channel_flag = true;
|
||||
break;
|
||||
case CHANNEL_NEXT:
|
||||
if (channel<CHANNELS_1+CHANNELS_2) {
|
||||
channel = (channel+1)%(CHANNELS_1+CHANNELS_2);
|
||||
} else {
|
||||
channel = 0x00;
|
||||
}
|
||||
printf("selecting channel ch %u %u (%u)\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||
break;
|
||||
case CHANNEL_PREVIOUS:
|
||||
if (0==channel) {
|
||||
channel = CHANNELS_1+CHANNELS_2-1;
|
||||
} else {
|
||||
channel--;
|
||||
}
|
||||
printf("selecting channel ch %u %u (%u)\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||
break;
|
||||
default:
|
||||
printf("unhandled IR action: %u\n", ir_code);
|
||||
|
|
Loading…
Reference in New Issue