Graynomad:
I can't find the definition for the cor_canalX objects but if you had them in an array the desenhar_barras_periodo() function could be reduced to something like thisvoid desenhar_barras_periodo () {
int x = (setor_selecionado * 38)+5;
int y = (setor_selecionado * 38)+39
for (int i = 1; i < 5; i++) {
if (bitRead(cor_selecionada,i) == true) {
myGLCD.setColor(cor_canals[i][0], cor_canals[i][1],cor_canals[i][2]);
myGLCD.drawRect(x, 80, y, 195);
desenhar_barras(cor_canals[i][0], cor_canals[i][1], cor_canals[i][2], x, 80, y, 195);
}
}
}
______ Rob
Hi!
Thank you by reply.
In the tab "ferduino" have definitions.
//*****************************************************************************************
//************************* LED design ****************************************************
//*****************************************************************************************
const byte cor_canal1[] = {255, 255, 255}; // Branco
const byte cor_canal2[] = {9, 184, 255}; // Azul
const byte cor_canal3[] = {58, 95, 205}; // Azul Royal
const byte cor_canal4[] = {255, 0, 0}; // Vermelho
const byte cor_canal5[] = {224, 102, 255}; // Violeta
It's very simple. You think that a matrix of two dimensions is better on this case?
It draw only a color of each time.
I can make this:
if((bitRead(cor_selecionada,1) == true) || (bitRead(cor_selecionada,2) == true) || ((bitRead(cor_selecionada,3) == true) || (bitRead(cor_selecionada,4) == true) || (bitRead(cor_selecionada,5) == true))
{
}
Best regards.