Esempio n. 1
0
// show frequency
void show_frequency(long int freq) { 
    tft.setTextSize(2);
    tft.setTextColor(WHITE);
    uint8_t zaehler;
    uint8_t digits[10];
    zaehler = 8;

          while (zaehler--) {
              digits[zaehler] = ExtractDigit (freq, zaehler);
//              Serial.print(digits[zaehler]);
//              Serial.print(".");
// 7: 10Mhz, 6: 1Mhz, 5: 100khz, 4: 10khz, 3: 1khz, 2: 100Hz, 1: 10Hz, 0: 1Hz
        }
            //  Serial.print("xxxxxxxxxxxxx");

    zaehler = 8;
        while (zaehler--) { // counts from 7 to 0
              if (zaehler < 6) sch = 7; // (khz)
              if (zaehler < 3) sch = 14; // (Hz)
          if (digits[zaehler] != digits_old[zaehler] || !freq_flag) { // digit has changed (or frequency is displayed for the first time after power on)
              if (zaehler == 7) {
                     sch = 0;
                     tft.setCursor(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency); // set print position
                     tft.fillRect(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency, font_width,16,BLACK); // delete old digit
                     if (digits[7] != 0) tft.print(digits[zaehler]); // write new digit in white
              }
              if (zaehler == 6) {
                            sch = 0;
                            tft.setCursor(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency); // set print position
                            tft.fillRect(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency, font_width,16,BLACK); // delete old digit
                            if (digits[6]!=0 || digits[7] != 0) tft.print(digits[zaehler]); // write new digit in white
              }
               if (zaehler == 5) {
                            sch = 7;
                            tft.setCursor(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency); // set print position
                            tft.fillRect(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency, font_width,16,BLACK); // delete old digit
                            if (digits[5] != 0 || digits[6]!=0 || digits[7] != 0) tft.print(digits[zaehler]); // write new digit in white
              }
              
              if (zaehler < 5) { 
              // print the digit
              tft.setCursor(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency); // set print position
              tft.fillRect(pos_x_frequency + font_width * (8-zaehler) + sch,pos_y_frequency, font_width,16,BLACK); // delete old digit
              tft.print(digits[zaehler]); // write new digit in white
              }
              digits_old[zaehler] = digits[zaehler]; 
        }
        }
  
      tft.setTextSize(1);
      if (digits[7] == 0 && digits[6] == 0)
              tft.fillRect(pos_x_frequency + font_width * 3,pos_y_frequency + 11, 3, 3, BLACK);
      else    tft.fillRect(pos_x_frequency + font_width * 3,pos_y_frequency + 11, 3, 3, YELLOW);
      tft.fillRect(pos_x_frequency + font_width * 7 -4, pos_y_frequency + 11, 3, 3, YELLOW);
      if (!freq_flag) {
            tft.setCursor(pos_x_frequency + font_width * 9 + 16,pos_y_frequency + 7); // set print position
            tft.setTextColor(GREEN);
            tft.print("Hz");
      }
      freq_flag = 1;
      tft.setTextColor(WHITE);

} // END VOID SHOW-FREQUENCY
Esempio n. 2
0
void  cAppliMergeCloud::CreateGrapheConx()
{
   mRecouvrTot  =  mVSoms.size();  // Recouvrement total
            // Couple d'homologues
   std::string aKSH = "NKS-Set-Homol@@"+ mParam.ExtHom().Val();
   std::string aKAH = "NKS-Assoc-CplIm2Hom@@"+ mParam.ExtHom().Val();

   std::vector<tMCArc *> aVAddCur;
   const cInterfChantierNameManipulateur::tSet * aSetHom = ICNM()->Get(aKSH);




   for (int aKH=0 ; aKH<int(aSetHom->size()) ; aKH++)
   {
       const std::string & aNameFile = (*aSetHom)[aKH];
       std::string aFullNF = Dir() + aNameFile;
       if (sizeofile(aFullNF.c_str()) > mParam.MinSzFilHom().Val())
       {
           std::pair<std::string,std::string> aPair = ICNM()->Assoc2To1(aKAH,aNameFile,false);
           tMCSom * aS1 = SomOfName(aPair.first);
           tMCSom * aS2 = SomOfName(aPair.second);
           // if ((aS1!=0) && (aS2!=0) && (sizeofile(aNameFile.c_str())>mParam.MinSzFilHom().Val()))
           // MPD : redondant + erreur car pas aFullNF 
           if ((aS1!=0) && (aS2!=0) )
           {
              tMCArc *  anArc = TestAddNewarc(aS1,aS2);
              if (anArc)
                 aVAddCur.push_back(anArc);
           }
       }
   }
            // Ajout recursif des voisin
   while (! aVAddCur.empty())
   {
       std::cout << "ADD " << aVAddCur.size() << "\n";
       std::vector<tMCArc *> aVAddNew;
       for (int aK=0 ; aK<int(aVAddCur.size()) ; aK++)
       {
           tMCArc & anArc = *(aVAddCur[aK]);
           AddVoisVois(aVAddNew,anArc.s1(),anArc.s2());
           AddVoisVois(aVAddNew,anArc.s2(),anArc.s1());
       }
       aVAddCur = aVAddNew;
   }

   // Calcul des voisins proches (contenu dans Apero ChImSec)
   for (int aK=0 ; aK<int(mVSoms.size()) ; aK++)
   {
       tMCSom * aS1 =  mVSoms[aK];

       const cOneSolImageSec *   aSol = aS1->attr()->SolOfCostPerIm(mParam.CostPerImISOM().Val());

       if (aSol)
       {
           for 
           (
               std::list<std::string>::const_iterator itS=aSol->Images().begin();
               itS !=aSol->Images().end();
               itS++
           )
           {
                tMCSom *  aS2 = SomOfName(*itS);
                if (aS2)
                {
                    tMCArc * anArc = mGr.arc_s1s2(*aS1,*aS2);
                    if (anArc)
                    {
                       // anArc->sym_flag_set_kth_true(mFlagCloseN);
                       anArc->flag_set_kth_true(mFlagCloseN);
                       aS1->attr()->AddCloseVois(aS2->attr());
                    }
                    // std::cout << "AAAaA  :" << anArc << "\n";
                }
           }
       }
   }

   // Na pas effacer, permet de voir le graphe des close image en cas de doute
   if (1)
   {
       for (int aK=0 ; aK<int(mVSoms.size()) ; aK++)
       {
           tMCSom * aS1 =  mVSoms[aK];
           std::cout << aS1->attr()->IMM()->mNameIm 
                     << " All: " << aS1->nb_succ(mSubGrAll) 
                     << " Closed: " << aS1->nb_succ(mSubGrCloseN) ;

            std::cout << " ";
            for (tArcIter itA = aS1->begin(mSubGrCloseN) ; itA.go_on() ; itA++)
            {
                const std::string & aN2 = (*itA).s2().attr()->IMM()->mNameIm;
                std::cout << ExtractDigit(StdPrefixGen(aN2),"0000") << " ";

            }
            std::cout << "\n";
       }
   }

   mRecMoy = mRecouvrTot /  mVSoms.size();
   mNbImMoy = mVSoms.size() / mRecMoy;  // En Fait NbIm^2 /mRecouvrTot
   std::cout  << "REC TOT " << mRecouvrTot << " RMoy " << mRecMoy << " NbIm " << mNbImMoy << "\n";
}