Hallo Leute,
ich schreibe mir gerade einen Arduino Lib für ein TFT Display wo ich mir
diverse Objete wie Textfelder, Bargraphen usw bauen werde.
Nun habe ich bei einem Textfeld Objekt ein Problem. Hier will ich mit
writeValue(float f, int iColor,int iNachkommastellen) einen float Wert
auf das Objekt Textfeld schreiben. Dabei sind die Paramter Color und
Nachkommastellen default Parameter. Dh diesen müssen nicht unbedingt
angeführt werden.
Mach ich genau das im Arduino Sketch so bekomme ich beim kompilieren
diese Fehler Meldung:
TextField:42: error: no matching function for call to
'TXTField::writeValue(float&)'
/txtField.h:27: note: candidates are: void TXTField::writeValue(float,
int, int)
Hier mal ein Ausschnitt aus dem cpp File
1 | void TXTField::writeValue(float fValue,int iTxtColor = NULL,int iDecPlaces = 0)
|
2 | {
|
3 | int iXTextPos,iYTextPos;
|
4 |
|
5 | if(iTxtColor != NULL)
|
6 | tft.setTextColor(iTxtColor);
|
7 | else
|
8 | tft.setTextColor(TXTField::iTextColor);
|
9 |
|
10 | iXTextPos = TXTField::iXpos;
|
11 | iYTextPos = TXTField::iYpos;
|
12 |
|
13 | tft.setCursor(iXTextPos,iYTextPos);
|
14 | tft.print(fValue);
|
15 | }
|
Hier der Ausschnitt aus dem Header File
1 | class TXTField
|
2 | {
|
3 | public:
|
4 | int iXpos,iYpos,iRadius,iWidth,iHeight,iColorFront,iColorBack,iTextColor;
|
5 | char strTxtValue[strBuff];
|
6 | TXTField();
|
7 | ~TXTField();
|
8 | void initTFT(bool bInit,int iRotation,int iTextsize);
|
9 | void setValueToDraw(int iX,int iY,int iW,int iH,int iR,int iCf, int iCb,int iTC);
|
10 | void draw(void);
|
11 | void edit(bool bIsEdit);
|
12 | void text(char sText[strBuff],int iTxtColor);
|
13 | void writeChar(char sChar,int iTxtColor);
|
14 | void writeValue(float fValue,int iTxtColor,int iDezPlaces);
|
15 | char *getValue(void);
|
16 | };
|
Ich muss im Arduino Sketch wirklich alle Parameter an das Objekt
übergeben damit ich keien Fehlermeldung bekomme. Ich denke ich habe da
irgendwo einen Knoten bei der Handhabung von Klassendefaultparametern
drinnen.
Könnt ihr mir da bitte weiterhelfen.
danke
lg
dieter