fix: channels bits for group 2 missing; add set all brightness; customisation (I only use 3+3 outputs)
This commit is contained in:
parent
0ae82501b7
commit
b4bbf97ec2
|
@ -72,9 +72,12 @@ PGM_P const help_table[] PROGMEM = {
|
||||||
help_16
|
help_16
|
||||||
};
|
};
|
||||||
|
|
||||||
volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD};
|
//volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD};
|
||||||
volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2] = {&DDRC,&DDRC,&DDRC,&DDRC,&DDRC,&DDRD,&DDRD,&DDRD,&DDRD,&DDRD};
|
volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD};
|
||||||
const uint8_t BITS[CHANNELS_1+CHANNELS_2] = {PC0,PC1,PC2,PC3,PC4};
|
//volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2] = {&DDRC,&DDRC,&DDRC,&DDRC,&DDRC,&DDRD,&DDRD,&DDRD,&DDRD,&DDRD};
|
||||||
|
volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2] = {&DDRC,&DDRC,&DDRC,&DDRD,&DDRD,&DDRD};
|
||||||
|
//const uint8_t BITS[CHANNELS_1+CHANNELS_2] = {PC0,PC1,PC2,PC3,PC4,PD2,PD3,PD4,PD5,PD7};
|
||||||
|
const uint8_t BITS[CHANNELS_1+CHANNELS_2] = {PC0,PC1,PC2,PD2,PD3,PD4};
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
#define INPUT_MAX 255 /* max length for user input string */
|
#define INPUT_MAX 255 /* max length for user input string */
|
||||||
|
@ -624,6 +627,15 @@ void ir_action(uint8_t address, uint8_t command)
|
||||||
brightness[mode][channel] = 0xff;
|
brightness[mode][channel] = 0xff;
|
||||||
}
|
}
|
||||||
printf("increasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
printf("increasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||||
|
} else if (channel==CHANNELS_1+CHANNELS_2) {
|
||||||
|
for (uint8_t i=0; i<CHANNELS_1+CHANNELS_2; i++) {
|
||||||
|
if (brightness[mode][i]<0xff-step) {
|
||||||
|
brightness[mode][i] += step;
|
||||||
|
} else {
|
||||||
|
brightness[mode][i] = 0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("increasing brightness all channels\n");
|
||||||
}
|
}
|
||||||
channel_flag = true;
|
channel_flag = true;
|
||||||
break;
|
break;
|
||||||
|
@ -634,13 +646,22 @@ void ir_action(uint8_t address, uint8_t command)
|
||||||
} else {
|
} else {
|
||||||
brightness[mode][channel] = 0x00;
|
brightness[mode][channel] = 0x00;
|
||||||
}
|
}
|
||||||
printf("increasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
printf("decreasing brightness ch %u %u: %u\n",(channel/CHANNELS_1)+1,(channel%CHANNELS_1)+1,brightness[mode][channel]);
|
||||||
|
} else if (channel==CHANNELS_1+CHANNELS_2) {
|
||||||
|
for (uint8_t i=0; i<CHANNELS_1+CHANNELS_2; i++) {
|
||||||
|
if (brightness[mode][i]>step) {
|
||||||
|
brightness[mode][i] -= step;
|
||||||
|
} else {
|
||||||
|
brightness[mode][i] = 0x00;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("decreasing brightness all channels\n");
|
||||||
}
|
}
|
||||||
channel_flag = true;
|
channel_flag = true;
|
||||||
break;
|
break;
|
||||||
case CHANNEL_NEXT:
|
case CHANNEL_NEXT:
|
||||||
if (channel<CHANNELS_1+CHANNELS_2) {
|
if (channel<=CHANNELS_1+CHANNELS_2) {
|
||||||
channel = (channel+1)%(CHANNELS_1+CHANNELS_2);
|
channel = (channel+1)%(CHANNELS_1+CHANNELS_2+1);
|
||||||
} else {
|
} else {
|
||||||
channel = 0x00;
|
channel = 0x00;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +669,7 @@ void ir_action(uint8_t address, uint8_t command)
|
||||||
break;
|
break;
|
||||||
case CHANNEL_PREVIOUS:
|
case CHANNEL_PREVIOUS:
|
||||||
if (0==channel) {
|
if (0==channel) {
|
||||||
channel = CHANNELS_1+CHANNELS_2-1;
|
channel = CHANNELS_1+CHANNELS_2;
|
||||||
} else {
|
} else {
|
||||||
channel--;
|
channel--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
#define nPS_ON PB2 /* ATX power supply ON switch */
|
#define nPS_ON PB2 /* ATX power supply ON switch */
|
||||||
|
|
||||||
/* channel definitions */
|
/* channel definitions */
|
||||||
#define CHANNELS_1 5 /* the number of outputs for channel 1 */
|
//#define CHANNELS_1 5 /* the number of outputs (zo use) for channel 1 (up to 5) */
|
||||||
#define CHANNELS_2 5 /* the number of outputs for channel 2 */
|
#define CHANNELS_1 3 /* the number of outputs (zo use) for channel 1 (up to 5) */
|
||||||
|
//#define CHANNELS_2 5 /* the number of outputs (to use) for channel 2 (up tp 5) */
|
||||||
|
#define CHANNELS_2 3 /* the number of outputs (to use) for channel 2 (up tp 5) */
|
||||||
extern volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2]; /* channel ports */
|
extern volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2]; /* channel ports */
|
||||||
extern volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2]; /* channel I/O configuration registers */
|
extern volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2]; /* channel I/O configuration registers */
|
||||||
extern const uint8_t BITS[CHANNELS_1+CHANNELS_2]; /* channel bits */
|
extern const uint8_t BITS[CHANNELS_1+CHANNELS_2]; /* channel bits */
|
||||||
|
|
Loading…
Reference in New Issue