I have a couple of issues with the latest version of the Arduino compiler. I would prefer to fix my code to work with the current compiler version. I have 2 Primary failure modes that I am not sure how to fix. I have tried several thing but am having troubles getting a float to convert string without using dtostrf, and assigning a string a name then using the name to determine program flow.
My setup is an Arduino Due, CTE Shield and a 7.0 inch MD070SD Display. I am using The UTFT Library, I have the latest version for RinkyDinks web site.
Issue 1) 'dtostrf' was not declared in this scope
if (GaugeName = "Water") {
myGLCD.setFont(SixteenSegment16x24);//16x24
myGLCD.print("ENG TEMP ", frameWidth + 10, 10);
myGLCD.drawRoundRect(frameWidth + 5, 5, frameWidth * 2, frameHeight - 30); //Upper Frame with Gauge name and numerical mesurement
myGLCD.drawRoundRect(frameWidth + 5, frameHeight - 30, frameWidth * 2, frameHeight); //Gauge Goes in this frame
myGLCD.setFont(DotMatrix_M_Slash); //16x22
char bufferWater[7] ; String sWater = dtostrf(WT, 4, 0, bufferWater) ; // Convert float to string for display on tft as string. char bufferValue[7] ; String sValue = dtostrf(Source Variable, 0, Decimal, bufferValue)
myGLCD.print(String(sWater), frameWidth + 10, 50);
Issue 2) warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
void BarGauge(String GaugeName) {
//Get Display size
int Width = myGLCD.getDisplayXSize();
int Height = myGLCD.getDisplayYSize();
//int sBarX2;
//int sBarY2;
// Show Display Size
//myGLCD.print("Width " + String(Width) , 10, 100); myGLCD.print("Height " + String(Height) , 10, 130);
extern uint8_t SixteenSegment16x24[];
extern uint8_t DotMatrix_M_Slash[];
extern uint8_t oil ; // include bitmap
myGLCD.setFont(SixteenSegment16x24);
float frameWidth = (Width / 2) - 2;
float frameHeight = (Height / 2) - 2;
myGLCD.setBackColor(VGA_NAVY);
myGLCD.setColor (VGA_LIME) ;
//--------------------------------------------------------------------------------------------------------------------------------------
//OIL Top Left
//--------------------------------------------------------------------------------------------------------------------------------------
String strOil;
if (GaugeName = "Oil") {
myGLCD.setFont(SixteenSegment16x24);
myGLCD.print("OIL PSI ", 10, 10);
myGLCD.drawRoundRect(5, 5, frameWidth, frameHeight - 30); //Upper Frame with Gauge name and numerical mesurement
myGLCD.drawRoundRect(5, frameHeight - 30, frameWidth, frameHeight); //Gauge Goes in this frame
myGLCD.setFont(DotMatrix_M_Slash); //16x22
//char bufferOil[7] ; String sOil = dtostrf(OP, 4, 0, bufferOil) ; // Convert float to string for display on tft as string. char bufferValue[7] ; String sValue = dtostrf(Source Variable, 0, Decimal, bufferValue)
myGLCD.print(String(strOil) , 10, 50);
//myGLCD.drawBitmap(5, 5, frameWidth, frameHeight - 30, oil,0,);
float sBarScale = 0.00 ;
sBarScale = frameWidth / 100; //set up scale for measurements
float sBarX2 = (OP * sBarScale) ; //determine length of bar based on measured value.
myGLCD.setColor(VGA_NAVY); myGLCD.fillRoundRect(sBarX2, frameHeight - 29, frameWidth - 1 , frameHeight - 1) ; //Draw blank part of bar,
if (OP <= 10) {
myGLCD.setColor (VGA_RED) ;
myGLCD.fillRoundRect(5, frameHeight - 29, sBarX2, frameHeight - 1) ; //Draw Bar
}
if (OP > 10) {
myGLCD.setColor (VGA_LIME) ;
myGLCD.fillRoundRect(5, frameHeight - 29, sBarX2, frameHeight - 1) ; //Draw Bar
}
myGLCD.setColor (VGA_LIME) ;
}
//--------------------------------------------------------------------------------------------------------------------------------------
// Water Top Right
//--------------------------------------------------------------------------------------------------------------------------------------
if (GaugeName = "Water") {
myGLCD.setFont(SixteenSegment16x24);//16x24
myGLCD.print("ENG TEMP ", frameWidth + 10, 10);
myGLCD.drawRoundRect(frameWidth + 5, 5, frameWidth * 2, frameHeight - 30); //Upper Frame with Gauge name and numerical mesurement
myGLCD.drawRoundRect(frameWidth + 5, frameHeight - 30, frameWidth * 2, frameHeight); //Gauge Goes in this frame
myGLCD.setFont(DotMatrix_M_Slash); //16x22
char bufferWater[7] ; String sWater = dtostrf(WT, 4, 0, bufferWater) ; // Convert float to string for display on tft as string. char bufferValue[7] ; String sValue = dtostrf(Source Variable, 0, Decimal, bufferValue)
myGLCD.print(String(sWater), frameWidth + 10, 50);
float sBarScale = 0 ;
sBarScale = frameWidth / 250; //set up scale for measurements
float sBarX2 = (WT * sBarScale) ; //determine length of bar based on measured value.
myGLCD.setColor(VGA_NAVY); myGLCD.fillRoundRect(sBarX2 + frameWidth, frameHeight - 29, frameWidth * 2 - 1 , frameHeight - 1) ; //Draw blank part of bar,
if (WT >= 230) {
myGLCD.setColor (VGA_RED) ;
myGLCD.fillRoundRect(frameWidth + 5, frameHeight - 29, frameWidth + sBarX2, frameHeight - 1) ; //Draw Bar
}
if (WT < 230) {
myGLCD.setColor (VGA_LIME) ;
myGLCD.fillRoundRect(frameWidth + 5, frameHeight - 29, frameWidth + sBarX2, frameHeight - 1) ; //Draw Bar
}
myGLCD.setColor (VGA_LIME) ;
}
//--------------------------------------------------------------------------------------------------------------------------------------
// Fuel Bottom Left