Forum Software Ferduino code Little Change MainScreen Layout

Little Change MainScreen Layout


Post Number:#1 Post Wed Jul 06, 2016 10:09 pm
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
This is the first time I tried arduino program, because I was busy lately loose I tried to learn to understand the program code for arduino, ferduino and try Jarduino I browse line by line, and there is little enlightenment.

begins with a question link here: RAW To Ferduino

by not changing the function of ferduino, I tried to redesign the mainscreen, there is little function that I hide in mainscreen because I do not need.

This is mainscreen looks:
Image

1. Using a font of rinky dink Here links http://www.rinkydinkelectronics.com/r_fonts.php. I outlined to water temperature display and LED.

2. Icon from iAqua Iaqua Planted Forum

3. I want to show a graph WaveMaker in mainscreen, because it seemed alive, here I find a difficult problem, This graphic up and down does not work perfectly, not like in wavemaker Tab.

fernando, i hopefully can help solve my problem. :ympray:
I add the last line of code WaveMaker. copypaste from WaveMaker tab, if this is correct?

in ferduino tab i add line for fonts
 extern uint8_t GroteskBold16x32[];


Inicio tab.
//---------------------------------------Tela inicial ----------------------------------------------tela =0
void mainScreen(boolean refreshAll=false)
{
  int ledLevel, s, u;
  String oldval, rtc1, rtcm;
  oldval = day;
  day = String(t.date);                             //Atualiza se a data for diferente
  int offset = 0;
 
  setFont(SMALL, 255, 255, 0, 0, 0, 0);
  myGLCD.print(rtc.getTimeStr(FORMAT_LONG), 120, 10); 
  setFont(SMALL, 255, 355, 0, 0, 0, 0);
  myGLCD.print("|", 106, 10);

  myFiles.loadBitmap(7, 27, 15, 106, "L_Power.raw");
 
  myFiles.loadBitmap(240, 213, 24, 24, "1lightN.raw");
  myFiles.loadBitmap(268, 213, 24, 24, "1filtN.raw");
  myFiles.loadBitmap(296, 213, 24, 24, "1heatN.raw");
  myFiles.loadBitmap(324, 213, 24, 24, "1co2N.raw");
  myFiles.loadBitmap(352, 213, 24, 24, "1aux1N.raw");
   
  if ((oldval != day) || refreshAll)
  {
    setFont(SMALL, 255, 255, 0, 0, 0, 0);
    //myGLCD.print(rtc.getDOWStr(FORMAT_SHORT), 230, 227);
    myGLCD.printNumI(t.date, 20, 10); // myGLCD.printNumI(t.date, 230, 227);
    myGLCD.print(rtc.getMonthStr(FORMAT_SHORT), 40, 10);
    myGLCD.printNumI(t.year, 70, 10);

    char bufferLP[16];
    LP.toCharArray(bufferLP, 16);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(60, 213, 235, 226); //Apaga descrição da fase lunar.

    myGLCD.setColor(255, 255, 255);
    myGLCD.print(bufferLP, 75, 213); //Escreve descrição da fase lunar

    float lunarCycle = moonPhase(t.year,t.mon, t.date); //get a value for the lunar cycle

    if ((lunarCycle*100) < 0) //Print % of Full to LCD
    {
      myGLCD.print(" 0.00", 256+90, 78);
      myGLCD.print("%", 256+123, 78);
    }
    else
    {
      myGLCD.printNumF(lunarCycle*100, 1, 256+90, 78);
      myGLCD.print("%", 256+123, 78);
    }
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[182])));
    myGLCD.print(buffer, 57, 213); // tabela_textos[182] = "FASE LUNAR:""MOON:";
   
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[182])));
    myGLCD.print(buffer, 256+90, 68); // tabela_textos[182] = "TOP ""MOON PHASE:";
    }
   
  if ( refreshAll == true)                                  //Desenha elementos fixos
  {
    myGLCD.setColor(192, 236, 255);

    myGLCD.print(" ", 24, 20);  //100

    for (int i = 0; i < 90; i += 10)
    {
      myGLCD.printNumI(90-i, 32, 31 + offset);   // 90 até 10
      offset += 11;
    }

    myGLCD.print("0", 40, 130);

    myGLCD.setColor(255, 255, 255);

    myGLCD.drawRect(50, 138, 187, 138);       // Eixo X
    myGLCD.drawRect(50, 28, 50, 138);         // Eixo Y

    for (int i=0; i<10; i++)
    {
      myGLCD.drawLine(51,(i*11)+28,55,(i*11)+28);
    } // Marcador grande
    myGLCD.setColor(190, 190, 190); 

    for (int i=0; i<10; i++)
    {
      myGLCD.drawLine(51,(i*11)+34,53,(i*11)+34);
    } // Marcador pequeno

    for (int i=0; i<10; i++)
    {
      myGLCD.drawLine(79,(i*11)+28,187,(i*11)+28);
    }// Grade
   
    myGLCD.setColor(255, 255, 255);

     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[183])));
     myGLCD.print(buffer, 210, 50);  // tabela_textos[183] = "T.HEATSINK:" 

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[184])));
    myGLCD.print(buffer, 210, 7); // tabela_textos[184] = "TEMP. TANK:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[185])));
    myGLCD.print(buffer, 212, 98); // tabela_textos[185] = "PH DO AQUARIO:"

  // strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[187])));
  // myGLCD.print(buffer, 212, 70); // tabela_textos[187] = "DENSIDADE:"

  // strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[188])));
  // myGLCD.print(buffer, 212, 84); // tabela_textos[188] = "ORP:"

  // strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[189])));
  // myGLCD.print(buffer, 212, 98); // tabela_textos[189] = "CHILLER:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[190])));
    myGLCD.print(buffer, 212, 112); // tabela_textos[190] = "HEATER//AQUECEDOR:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[191])));
    myGLCD.print(buffer, 212, 126); // tabela_textos[191] = "REATOR:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[186])));
    myGLCD.print(buffer, 212, 140); // tabela_textos[186] =  "PH DO REATOR:"
   
    //strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[192])));
    //myGLCD.print(buffer, 212, 140); // tabela_textos[192] = "OZONIO:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[193])));
    myGLCD.print(buffer, 212, 154); // tabela_textos[193] = "ATO//REPOSICAO:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[194])));
    myGLCD.print(buffer, 212, 168); // tabela_textos[194] = "LEVEL//NIVEL:"

    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[195])));
    myGLCD.print(buffer, 212, 182); // tabela_textos[195] = "WATER CHANGE //TPA:" // Troca de Água Parcial
   
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[226])));
    myGLCD.print(buffer, 212, 195); // tabela_textos[226] = "T. ROOM:"   

    if(temporizador_1_ativado == 1)
    {
      myGLCD.setColor(0, 130, 255);
      strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[31])));
      myGLCD.print(buffer, 12, 144); // tabela_textos[31] = "TIMER 1:"
    }
    else
    {
      myGLCD.setColor(255, 255, 255);
      strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[31])));
      myGLCD.print(buffer, 12, 144); // tabela_textos[31] = "TIMER 1:"     
    }

    if(temporizador_2_ativado == 1)
    {
      myGLCD.setColor(0, 130, 255);
      strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[77])));
      myGLCD.print(buffer, 12, 156); // tabela_textos[77] = "TIMER 2:"
    }
    else
    {
      myGLCD.setColor(255, 255, 255);
      strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[77])));
      myGLCD.print(buffer, 12, 156); // tabela_textos[77] = "TIMER 2:"
    }     

    if(temporizador_3_ativado == 1)
    {
     myGLCD.setColor(0, 130, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[78])));
     myGLCD.print(buffer, 12, 168); // tabela_textos[78] = "TIMER 3:"
    }
    else
    {
     myGLCD.setColor(255, 255, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[78])));
     myGLCD.print(buffer, 12, 168); // tabela_textos[78] = "TIMER 3:"
    }     

    if(temporizador_4_ativado == 1)
    {
     myGLCD.setColor(0, 130, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[79])));
     myGLCD.print(buffer, 12, 180); // tabela_textos[79] = "TIMER 4:"
    }
    else
    {
     myGLCD.setColor(255, 255, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[79])));
     myGLCD.print(buffer, 12, 180); // tabela_textos[79] = "TIMER 4:"
    }   

    if(temporizador_5_ativado == 1)
    {
     myGLCD.setColor(0, 130, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[80])));
     myGLCD.print(buffer, 12, 192); // tabela_textos[80] = "TIMER 5:"
    }
    else
    {
     myGLCD.setColor(255, 255, 255);
     strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[80])));
     myGLCD.print(buffer, 12, 192); // tabela_textos[80] = "TIMER 5:"
    }     

    myGLCD.setColor(161, 127, 73);                 
    myGLCD.drawRect(7, 5, 199, 208);    //  LEFT RECT.
    myGLCD.drawRect(206, 92, 335, 208); //  RIGHT RECT. //myGLCD.drawRect(206, 92, 392, 208);
  } // Fim do refreshAll

 
  if ((whiteLed != wled_out) || refreshAll)  // Atualiza gráfico led branco   
  {
    whiteLed = wled_out;
    ledLevel = LedToPercent(wled_out);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(128, 144, 185, 156);   // Apaga potência anterior

    myGLCD.setColor(cor_canal1[0], cor_canal1[1], cor_canal1[2]);

    strcpy_P(buffer, (char*)pgm_read_word_near(&(nome_canal[1])));
    myGLCD.print(buffer, 128, 144); // nome_canal[1] = "BRA"

    offset = map(ledLevel, 100, 0, 28, 137);

    myGLCD.print(":", 152, 144);
    myGLCD.fillRect(59, offset, 79, 137);
    myGLCD.print(String(ledLevel), 160, 144);
    myGLCD.print("%", 186, 144);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(59, offset -1, 79, 27);      // Apaga barra anterior
  }
  if ((blueLed != bled_out) || refreshAll)       // Atualiza gráfico led azul
  {
    blueLed = bled_out;
    ledLevel = LedToPercent(bled_out);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(128, 156, 185, 168);     // Apaga potência anterior

    myGLCD.setColor(cor_canal2[0], cor_canal2[1], cor_canal2[2]);

    strcpy_P(buffer, (char*)pgm_read_word_near(&(nome_canal[2])));
    myGLCD.print(buffer, 128, 156); // nome_canal[2] = "AZU"

    offset = map(ledLevel, 100, 0, 28, 137);
    myGLCD.print(":", 152, 156);
    myGLCD.fillRect(85, offset, 105, 137);
    myGLCD.print(String(ledLevel), 160, 156);
    myGLCD.print("%", 186, 156);

    myGLCD.setColor(0, 0, 0);

    myGLCD.fillRect(85, offset - 1, 105, 27);       // Apaga barra anterior
  }
  if ((azulroyalLed != rbled_out) || refreshAll)      // Atualiza gráfico led azul royal
  {
    azulroyalLed = rbled_out;
    ledLevel = LedToPercent(rbled_out);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(128, 168, 185, 180);     // Apaga potência anterior

    myGLCD.setColor(cor_canal3[0], cor_canal3[1], cor_canal3[2]);

    strcpy_P(buffer, (char*)pgm_read_word_near(&(nome_canal[3])));
    myGLCD.print(buffer, 128, 168); // nome_canal[3] = "AZR"

    offset = map(ledLevel, 100, 0, 28, 137);
    myGLCD.print(":", 152, 168);
    myGLCD.fillRect(111, offset, 131, 137);
    myGLCD.print(String(ledLevel), 160, 168);
    myGLCD.print("%", 186, 168);

    myGLCD.setColor(0, 0, 0);

    myGLCD.fillRect(111, offset - 1, 131, 27);      // Apaga barra anterior
  }
  if ((vermelhoLed != rled_out) || refreshAll)    // Atualiza gráfico led  vermelho
  {
    vermelhoLed = rled_out;
    ledLevel = LedToPercent(rled_out);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(128, 180, 185, 192);     // Apaga potência anterior

    myGLCD.setColor(cor_canal4[0], cor_canal4[1], cor_canal4[2]);

    strcpy_P(buffer, (char*)pgm_read_word_near(&(nome_canal[4])));
    myGLCD.print(buffer, 128, 180); // nome_canal[4] = "VER"

    offset = map(ledLevel, 100, 0, 28, 137);
    myGLCD.print(":", 152, 180);
    myGLCD.fillRect(137, offset, 157, 137);
    myGLCD.print(String(ledLevel), 160, 180);
    myGLCD.print("%", 186, 180);

    myGLCD.setColor(0, 0, 0);

    myGLCD.fillRect(137, offset - 1, 157, 27);      // Apaga barra anterior
  }
  if ((violetaLed != uvled_out) || refreshAll)      // Atualiza gráfico led violeta
  {
    violetaLed = uvled_out;
    ledLevel = LedToPercent(uvled_out);

    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(128, 192, 185, 204);      // Apaga potência anterior
   
    myGLCD.setColor(cor_canal5[0], cor_canal5[1], cor_canal5[2]);

    strcpy_P(buffer, (char*)pgm_read_word_near(&(nome_canal[5])));
    myGLCD.print(buffer, 128, 192); // nome_canal[5] = "VIO"

    offset = map(ledLevel, 100, 0, 28, 137);
    myGLCD.print(":", 152, 192);
    myGLCD.fillRect(163, offset, 183, 137);
    myGLCD.print(String(ledLevel), 160, 192);
    myGLCD.print("%", 186, 192);
   
    myGLCD.setColor(0, 0, 0);
    myGLCD.fillRect(163, offset - 1, 183, 27);       // Apaga barra anterior
  } 
  myGLCD.setColor(0, 0, 0);                     
//  myGLCD.fillRect(313, 14, 353, 26);                // Apagar temperatura dissipador
//  myGLCD.fillRect(303, 32, 320, 40);                // Apagar temperatura agua
//  myGLCD.fillRect(324, 42, 390, 54);                // Apagar PH do aquario
//  myGLCD.fillRect(318, 56, 390, 68);                // Apagar PH do reator

     myGLCD.fillRect(310, 98, 300, 110);               // Apagar noticia de chiller ligado/desligado
//  myGLCD.fillRect(289, 112, 350, 124);              // Apagar noticia de aquecedor ligado/desligado
//  myGLCD.fillRect(270, 126, 320, 138);              // Apagar noticia de reator ligado/desligado
    myGLCD.fillRect(280, 154, 310, 166);              // Apagar noticia de reposicao ligado/desligado
    myGLCD.fillRect(280, 168, 310, 180);              // Apagar noticia de nivel normal/anormal
//  myGLCD.fillRect(310, 5, 375, 70);    //moon 310, 5, 65, 65,
//  myGLCD.fillRect(250, 182, 365, 193);              // Apagar noticia de TPA ligado/desligado
 // myGLCD.fillRect(312, 195, 360, 207);              // Apaga consumo de energia

  myGLCD.fillRect(80, 144, 110, 156);              // Apagar noticia de Timers 1 ligado/desligado
  myGLCD.fillRect(80, 156, 110, 168);              // Apagar noticia de Timers 2 ligado/desligado
  myGLCD.fillRect(80, 168, 110, 180);              // Apagar noticia de Timers 3 ligado/desligado
  myGLCD.fillRect(80, 180, 110, 192);              // Apagar noticia de Timers 4 ligado/desligado
  myGLCD.fillRect(80, 192, 110, 204);              // Apagar noticia de Timers 5 ligado/desligado
 
  myFiles.loadBitmap(296, 20, 14, 12, "c.raw"); //celcius indicator
  myFiles.loadBitmap(296, 60, 14, 12, "c.raw"); //celcius indicator
 
  myGLCD.setColor(0, 255, 0);  //HASIL MONITOR
//  myGLCD.printNumF(tempH, 2, 310, 14);   // heatsink
  myGLCD.printNumF(PHA, 2, 285, 98);     // PH aqua  myGLCD.printNumF(PHA, 2, 285, 42);
  myGLCD.printNumF(PHR, 1, 285, 140);    // PH reator
  myGLCD.printNumF(tempA, 1, 285, 195);  // Temperatura Room //myGLCD.printNumF(tempA, 1, 285, 195);

//====================================================temperature
   myGLCD.setColor(180, 255, 0);
   myGLCD.setFont(GroteskBold16x32);
   myGLCD.printNumF(tempH, 2, 212, 60);   // heatsink
   myGLCD.setColor(255, 11, 250);
   myGLCD.printNumF(tempC, 2, 212, 18);   // Temperatura da agua //myGLCD.printNumF(tempC, 2, 302, 28);   // Temperatura da agua
   myGLCD.setColor(255, 0, 0);
  if (bitRead(status_parametros,2)==true)
  {                               
    myGLCD.setFont(GroteskBold16x32);
    myGLCD.printNumF( tempC, 2, 212, 18);     // Temperatura em vermelho
  } 

//========================fonts normal/ lagi=========================================
   myGLCD.setFont(RusFont1);
   myGLCD.setColor(255, 0, 0);
  if (bitRead(status_parametros,3) == true)
  {                               
    myGLCD.printNumF(PHA, 1, 285, 42);       // PH do aquario em vermelho
  }   
  if (bitRead(status_parametros,6) == true)
  {                               
    myGLCD.printNumF(PHR, 1, 285, 140);       // PH do reator em vermelho
  }   
  if (bitRead(status_parametros,0) == true)
  {
   // myGLCD.setColor(0, 130, 255);
   // myGLCD.print("ON", 285, 98);     // Chiller ligado
   
    myFiles.loadBitmap(212, 213, 24, 24, "1circN.raw");
  }
  else
  {
    //myGLCD.setColor(0, 255, 0);
   // myGLCD.print("OF", 285, 98);          // Chiller desligado
    myFiles.loadBitmap(212, 213, 24, 24, "1circF.raw");
  }
  if (bitRead(status_parametros,1) == true)
  {
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 285, 112);           // Aquecedor ligado
  }
  else 
  {
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 285, 112);          // Aquecedor desligado
  }
  if (bitRead(status_parametros,5)== true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 285, 126);           // Reator ligado
  }
  else 
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 285, 126);          // Reator desligado
  }
  if (bitRead(Status,1) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 285, 154);           // Reposição ligada
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 285, 154);          // Reposição desligada
  }
  if (nivel_status==true)
  {             
    myGLCD.setColor(255, 0, 0);
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[196])));
    myGLCD.print(buffer, 285, 168);         // Nivel baixo em vermelho // tabela_textos[196] = "BAIXO!"
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[197])));
    myGLCD.print(buffer, 285, 168);          // Nível nornal // tabela_textos[197] = "NORMAL"
  }
  if ((bitRead(tpa_status,1)== true) && (bitRead(tpa_status,2)== false))
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 285, 182);           // TPA em andamento
  }
  else if ((bitRead(tpa_status,1) == false) && (bitRead(tpa_status,2) == false))
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 285, 182);           // TPA não esta em andamento
  }
  if (bitRead(tpa_status,2) == true)
  {             
    myGLCD.setColor(255, 0, 0);
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[86])));
    myGLCD.print(buffer, 285, 182);          // Sinaliza falha durante uma TPA // tabela_textos[86] = "FALHA!"
  }
  if (bitRead(temporizador_status,1) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 80, 144);           // Timer 1 ligado
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 80, 144);          // Timer 1 desligado
  }

  if (bitRead(temporizador_status,2) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 80, 156);           // Timer 2 ligado
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 80, 156);          // Timer 2 desligado
  }
  if (bitRead(temporizador_status,3) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 80, 168);           // Timer 3 ligado
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 80, 168);          // Timer 3 desligado
  }
  if (bitRead(temporizador_status,4) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 80, 180);           // Timer 4 ligado
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 80, 180);          // Timer 4 desligado
  }
  if (bitRead(temporizador_status,5) == true)
  {             
    myGLCD.setColor(0, 130, 255);
    myGLCD.print("ON", 80, 192);           // Timer 5 ligado
  }
  else
  {             
    myGLCD.setColor(0, 255, 0);
    myGLCD.print("OFF", 80, 192);          // Timer 5 desligado
  } 
  if(temperatura_alta == true)
  {
   myGLCD.setColor(255, 0, 0);
   strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[236])));//HIGH TEMPERATURE!
   myGLCD.print(buffer, 58, 90);          // Alerta de temperatura alta para os LEDS.
  }
  if(temperatura_baixou == true)
    {
    strcpy_P(buffer, (char*)pgm_read_word_near(&(tabela_textos[237]))); // "TEMP. BAIXOU!"
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(buffer, 58, 90);          // Alerta de que a temperatura esteve alta para os LEDS.
  }
 
  //=======================================wavemaker
 
  int Pump1PWM_t;
  int Pump2PWM_t;
  int bar = map(Pump1PWM, 0, 255, 198, 97);

  if (bar < 97 )
  {
    bar = 97;
  }
  if (bar > 198)
  {
    bar = 198;
  }

  int bar2 = map(Pump2PWM, 0, 255, 198, 97);   

  if (bar2 < 97)
  {
    bar2 = 97;
  }
  if (bar2 > 198)
  {
    bar2 = 198;
  }

  Pump1PWM_t = map(Pump1PWM, 0, 255, 0, 100); 
  Pump2PWM_t = map(Pump2PWM, 0, 255, 0, 100);

  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setColor(0, 0, 0);

  myGLCD.fillRect(341, bar - 1, 362, 91);
  myGLCD.fillRect(370, bar2 - 1, 391, 91);

  myGLCD.setColor(0, 0, 255);             

  myGLCD.fillRect(341, 198, 362, bar);
  myGLCD.fillRect(370, 198, 391, bar2);
 
  myGLCD.setColor(180, 180, 180);
  myGLCD.drawRect(341, 92, 362, 198); //rect wavemaker
  myGLCD.drawRect(370, 92, 391, 198); //rect wavemaker2

  myGLCD.setFont(RusFont1);

  if(Pump1PWM_t < 10)
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print("  ", 264+90, 200);
  }
  else if ((Pump1PWM_t >= 10) && (Pump1PWM_t <= 99))
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print(" ", 272+90, 200);
  }
  else
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
  }

  if(Pump2PWM_t < 10)
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print("   ", 293+90, 200);
  }
  else if((Pump2PWM_t >= 10) && (Pump2PWM_t <= 99))
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print(" ", 301+90, 200);
  }
  else
  {
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200); 
  }
 
}





Thanks Diztly wardizt

Post Number:#2 Post Wed Jul 06, 2016 10:39 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi Diztly!

I like to see user trying to make your own things. :)

There a small problem because the main screen is updated to each 5 seconds. So the graph won't work very well.

The best option is to create a new function like "void mainScreen_waveGraph()" in the tab "botoes_e_etc" or a new tab.

void mainScreen_waveGraph()
{
  int Pump1PWM_t;
  int Pump2PWM_t;
  int bar = map(Pump1PWM, 0, 255, 198, 97);

  if (bar < 97 )
  {
    bar = 97;
  }
  if (bar > 198)
  {
    bar = 198;
  }

  int bar2 = map(Pump2PWM, 0, 255, 198, 97);   

  if (bar2 < 97)
  {
    bar2 = 97;
  }
  if (bar2 > 198)
  {
    bar2 = 198;
  }

  Pump1PWM_t = map(Pump1PWM, 0, 255, 0, 100);
  Pump2PWM_t = map(Pump2PWM, 0, 255, 0, 100);

  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setColor(0, 0, 0);

  myGLCD.fillRect(341, bar - 1, 362, 91);
  myGLCD.fillRect(370, bar2 - 1, 391, 91);

  myGLCD.setColor(0, 0, 255);             

  myGLCD.fillRect(341, 198, 362, bar);
  myGLCD.fillRect(370, 198, 391, bar2);
 
  myGLCD.setColor(180, 180, 180);
  myGLCD.drawRect(341, 92, 362, 198); //rect wavemaker
  myGLCD.drawRect(370, 92, 391, 198); //rect wavemaker2

  myGLCD.setFont(RusFont1);

  if(Pump1PWM_t < 10)
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print("  ", 264+90, 200);
  }
  else if ((Pump1PWM_t >= 10) && (Pump1PWM_t <= 99))
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print(" ", 272+90, 200);
  }
  else
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump1PWM_t, 256+90, 200);
  }

  if(Pump2PWM_t < 10)
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print("   ", 293+90, 200);
  }
  else if((Pump2PWM_t >= 10) && (Pump2PWM_t <= 99))
  {
    myGLCD.setColor(255, 255, 255);
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200);
    myGLCD.setColor(0, 0, 0);
    myGLCD.print(" ", 301+90, 200);
  }
  else
  {
    myGLCD.printNumI(Pump2PWM_t, 285+90, 200);
  }
}


Then on loop call the function on this way:

if(dispScreen == 0)
{
  mainScreen_waveGraph();
}


BTW: Again you don't told me what's the problem exactly.

This graphic up and down does not work perfectly, not like in wavemaker Tab.


It can be many things!

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#3 Post Fri Jul 22, 2016 7:11 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
thanks Fernando,
Now the bargraph is working properly, but every 6 seconds the bar paused for a moment, whether this problem can be resolved ? even if it can not be resolved, it is already very good.
Image
Menu
Image

now I will change the timer 5 to kalkwasser fuction, if timer 5 is active, on 5 minutes of 60 minutes, I'm trying change the code. I hope the next can be realized.

Diztly Wardizt wrote:
BTW: Again you don't told me what's the problem exactly.

sorry fernando my language is probably less you understand, I use google translator.

thanks verymuch.
diztly wardizt.

Post Number:#4 Post Fri Jul 22, 2016 8:42 am
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy

Post Number:#5 Post Fri Jul 22, 2016 10:19 am
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Hi!

You are doing a great job, congratulations!

Unfortunately the Arduino isn't multitask, so this pause on graph after 6 seconds is because other functions are being checked.

Go on with your job.

Best regards.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#6 Post Fri Jul 22, 2016 4:08 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy

Post Number:#7 Post Fri Jul 22, 2016 4:29 pm
Posts: 1699
Topics: 38
Images: 301
Solve rating: 233
Joined: Mon Mar 03, 2014 5:59 pm
Topics: 38
Age: 39
Location: São Paulo
Gender: Male
National Flag:
Brazil

Yes, it is not related with speed the code on loop has an order to be executed and the controller can't make two functions at same time.

With Arduino DUE the pause can be smaller but will exist.
Post your doubts on forum because it can help another user too. Just PM me for support if it's absolutely necessary.

Post Number:#8 Post Fri Jul 22, 2016 4:34 pm
Posts: 101
Topics: 22
Solve rating: 0
Joined: Wed Sep 10, 2014 7:07 pm
Topics: 22
Age: 49
Gender: None specified
National Flag:
Italy

Post Number:#9 Post Fri Jul 29, 2016 9:48 am
Posts: 69
Topics: 18
Images: 2
Solve rating: 1
Joined: Tue Apr 14, 2015 11:54 pm
Topics: 18
Age: 42
Gender: Male
National Flag:
Indonesia
Hello

where did you get the icons to do the menu ??
thank you


you can find google images for free usage
Google Flat Icon

this my icon

Image
Last edited by Fernando Garcia on Wed Apr 11, 2018 2:56 pm, edited 3 times in total.
Reason: Others posts non-related with main subject were moved to a new topic: www.ferduino.com/forum/viewtopic.php?f=8&t=361




Return to Ferduino code





Who is online

Users viewing this topic: No registered users and 1 guest

cron