示例#1
0
void Cool_Display::DispInfo_4Digit(int Size, uint8_t Message[], uint16_t Data)
{
	setDigitBright(0x00);
	setDigitBright(0x0f);
	DigitDisplay(Size, Message);
	DigitInfo(SensorInfo[Data]);
}
示例#2
0
void Cool_Display::ButtonAction(int PushCounter)
{//OK//
//Si le bouton est actionne par une pression courte, le defilement
//	des differentes informations est active.
//Si le bouton est actionne par une pression prolongee, la camera
//	est activee et declanche la prise d'une photo ainsi que son 
//	enregistrement sur la carte micro-SD
//Si le bouton n'est pas active, l'heure est affichee (4-Digit)
//	ainsi que le niveau d'eau restant (LedBar).

	if(PushCounter == 0)
	{//Affichage de l'heure et du niveau d'eau:
		BarSecondDisplay();
		setDigitBright(0x0f);
		if((SensorInfo[0] >= 25)) DigitWriteData(FailMessage);
		else DigitInfo(100*SensorInfo[0]+SensorInfo[1]);
	}
	else if(PushCounter <= PushDispPic)
	{//Affichage du defilement des donnees:
		PushCounter = 0;
		LedBarLightSet(0);
		//Temperature Interieure:
		DispInfo_4Digit(MessageSize[0], TempInt, 5);
		BarQualityControl(4);
		//Humidite Inteurieure:
		DispInfo_4Digit(MessageSize[1], HumInt, 7);
		BarQualityControl(7);
		//Luminosite Interieure:
		DispInfo_4Digit(MessageSize[2], LumInt, 3);
		BarQualityControl(3);
		//Moisture:
		DispInfo_4Digit(MessageSize[3], Moisture, 9);
		BarQualityControl(9);
		/* DigitInfo(SensorInfo[10]);
		BarQualityControl(10);
		DigitInfo(SensorInfo[11]);
		BarQualityControl(11);
		setDigitBright(0x00); */
		//Temperature Exterieure:
		/* DispInfo_4Digit(MessageSize[4], TempExt, 6);
		BarQualityControl(6); */
		//Humidite Exterieure:
		/* DispInfo_4Digit(MessageSize[5], HumExt, 8);
		BarQualityControl(8); */
		//Luminosite Exterieure:
		/* DispInfo_4Digit(MessageSize[6], LumExt, 4);
		BarQualityControl(4); */
		//Niveau d'eau:
		/* DispInfo_4Digit(MessageSize[7], WatLev, 12);
		BarQualityControl(12); */
	}
	else if(PushCounter >= PushDispPic)
	{//Prise de Photo:
		setDigitBright(0x0f);
		DigitDisplay(MessageSize[9],Photo);
		DigitWriteData(WaitMessage);
//	->	Fonction de prise de photo.
		BarTakePhoto();
		PushCounter = 0;
	}
}
示例#3
0
bool TimeTextCtrl::Layout()
{
   unsigned int i, j;
   int x, pos;

   wxMemoryDC memDC;
   if (mBackgroundBitmap) {
      delete mBackgroundBitmap;
      mBackgroundBitmap = NULL;
   }
   // Placeholder bitmap so the memDC has something to reference
   mBackgroundBitmap = new wxBitmap(1, 1);
   memDC.SelectObject(*mBackgroundBitmap);

   mDigits.Clear();

   mBorderLeft = 1;
   mBorderTop = 1;
   mBorderRight = 1;
   mBorderBottom = 1;

   int fontSize = 4;
   wxCoord strW, strH;
   wxString exampleText = wxT("0");

   // Keep making the font bigger until it's too big, then subtract one.
   memDC.SetFont(wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL));
   memDC.GetTextExtent(exampleText, &strW, &strH);
   while(strW <= mDigitBoxW && strH <= mDigitBoxH) {
      fontSize++;
      memDC.SetFont(wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL));
      memDC.GetTextExtent(exampleText, &strW, &strH);
   }
   fontSize--;

   if (mDigitFont)
      delete mDigitFont;
   mDigitFont = new wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL);
   memDC.SetFont(*mDigitFont);
   memDC.GetTextExtent(exampleText, &strW, &strH);
   mDigitW = strW;
   mDigitH = strH;

   // The label font should be a little smaller
   fontSize--;
   if (mLabelFont)
      delete mLabelFont;
   mLabelFont = new wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL);

   // Figure out the x-position of each field and label in the box
   x = mBorderLeft;
   pos = 0;

   memDC.SetFont(*mLabelFont);
   memDC.GetTextExtent(mPrefix, &strW, &strH);
   x += strW;
   pos += mPrefix.Length();

   for(i=0; i<mFields.GetCount(); i++) {
      mFields[i].fieldX = x;
      for(j=0; j<(unsigned int)mFields[i].digits; j++) {
         mDigits.Add(DigitInfo(i, j, pos, wxRect(x, mBorderTop,
                                                 mDigitBoxW, mDigitBoxH)));
         x += mDigitBoxW;
         pos++;
      }

      mFields[i].labelX = x;
      memDC.GetTextExtent(mFields[i].label, &strW, &strH);
      pos += mFields[i].label.Length();
      x += strW;
      mFields[i].fieldW = x;
   }

   mWidth = x + mBorderRight;
   mHeight = mDigitBoxH + mBorderTop + mBorderBottom;

   // Draw the background bitmap - it contains black boxes where
   // all of the digits go and all of the other text

   wxBrush Brush;

   delete mBackgroundBitmap; // Delete placeholder
   mBackgroundBitmap = new wxBitmap(mWidth + mButtonWidth, mHeight);
   memDC.SelectObject(*mBackgroundBitmap);

   memDC.SetBrush(*wxLIGHT_GREY_BRUSH);
   memDC.SetPen(*wxTRANSPARENT_PEN);
   memDC.DrawRectangle(0, 0, mWidth + mButtonWidth, mHeight);

   int numberBottom = mBorderTop + (mDigitBoxH - mDigitH)/2 + mDigitH;

   memDC.GetTextExtent(wxT("0"), &strW, &strH);
   int labelTop = numberBottom - strH;

   memDC.SetTextForeground(*wxBLACK);
   memDC.SetTextBackground(*wxLIGHT_GREY);
   memDC.DrawText(mPrefix, mBorderLeft, labelTop);

   theTheme.SetBrushColour( Brush, clrTimeBack );
   memDC.SetBrush(Brush);
   memDC.SetBrush(*wxLIGHT_GREY_BRUSH);
   for(i=0; i<mDigits.GetCount(); i++)
      memDC.DrawRectangle(mDigits[i].digitBox);
   memDC.SetBrush( wxNullBrush );

   for(i=0; i<mFields.GetCount(); i++)
      memDC.DrawText(mFields[i].label,
                     mFields[i].labelX, labelTop);

   if (mMenuEnabled) {
      wxRect r(mWidth, 0, mButtonWidth - 1, mHeight - 1);
      AColor::Bevel(memDC, true, r);
      memDC.SetBrush(*wxBLACK_BRUSH);
      memDC.SetPen(*wxBLACK_PEN);
      AColor::Arrow(memDC,
                    mWidth + 1,
                    (mHeight / 2) - 2,
                    mButtonWidth - 2);
   }
   return true;
}