Allow OLED display options to be configured live

This commit is contained in:
Josh Stewart 2015-03-02 11:11:47 +11:00
parent 092ade0c8a
commit cbbb280f3c
3 changed files with 146 additions and 18 deletions

View File

@ -152,9 +152,9 @@ void sendValues(int length)
response[25] = lowByte(currentStatus.loopsPerSecond); response[25] = lowByte(currentStatus.loopsPerSecond);
//The following can be used to show the amount of free memory //The following can be used to show the amount of free memory
int mem = freeRam(); currentStatus.freeRAM = freeRam();
response[26] = highByte(mem); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF); response[26] = highByte(currentStatus.freeRAM); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF);
response[27] = lowByte(mem); response[27] = lowByte(currentStatus.freeRAM);
//response[26] = highByte(cltCalibrationTable.axisX16[0]); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF); //response[26] = highByte(cltCalibrationTable.axisX16[0]); //(byte)((currentStatus.loopsPerSecond >> 8) & 0xFF);
//response[27] = lowByte(cltCalibrationTable.axisX16[0]); //response[27] = lowByte(cltCalibrationTable.axisX16[0]);

View File

@ -36,19 +36,145 @@ void initialiseDisplay()
void updateDisplay() void updateDisplay()
{ {
display.clearDisplay(); display.clearDisplay();
//display.setCursor(0,0); display.setCursor(0,0);
//display.print("RPM: "); switch(configPage1.display1)
display.setCursor(64,0); {
display.print("PW: "); case 0:
display.setCursor(0,11); display.print("RPM: ");
display.print("CPU: ");
/*
display.setCursor(28,0); display.setCursor(28,0);
display.print(currentStatus.RPM); display.print(currentStatus.RPM);
display.setCursor(92,0); break;
display.print((currentStatus.PW));*/ case 1:
display.print("PW: ");
display.setCursor(28,0);
display.print(currentStatus.PW);
break;
case 2:
display.print("Adv: ");
display.setCursor(28,0);
display.print(currentStatus.advance);
break;
case 3:
display.print("VE: ");
display.setCursor(28,0);
display.print(currentStatus.VE);
break;
case 4:
display.print("GamE: ");
display.setCursor(28,0);
display.print(currentStatus.corrections);
break;
case 5:
display.print("TPS: ");
display.setCursor(28,0);
display.print(currentStatus.TPS);
break;
case 6:
display.print("IAT: ");
display.setCursor(28,0);
display.print(currentStatus.IAT);
break;
case 7:
display.print("CLT: ");
display.setCursor(28,0);
display.print(currentStatus.coolant);
break;
}
display.setCursor(0,11);
switch(configPage1.display3)
{
case 0:
display.print("RPM: ");
display.setCursor(28,11); display.setCursor(28,11);
display.print(currentStatus.RPM);
break;
case 1:
display.print("PW: ");
display.setCursor(28,11);
display.print(currentStatus.PW);
break;
case 2:
display.print("Adv: ");
display.setCursor(28,11);
display.print(currentStatus.advance);
break;
case 3:
display.print("VE: ");
display.setCursor(28,11);
display.print(currentStatus.VE);
break;
case 4:
display.print("GamE: ");
display.setCursor(28,11);
display.print(currentStatus.corrections);
break;
case 5:
display.print("TPS: ");
display.setCursor(28,11);
display.print(currentStatus.TPS);
break;
case 6:
display.print("IAT: ");
display.setCursor(28,11);
display.print(currentStatus.IAT);
break;
case 7:
display.print("CLT: ");
display.setCursor(28,11);
display.print(currentStatus.coolant);
break;
}
display.setCursor(64,0);
switch(configPage1.display2)
{
case 0:
display.print("O2: ");
display.setCursor(92,0);
display.print(currentStatus.O2);
break;
case 1:
display.print("Vdc: ");
display.setCursor(92,0);
display.print(currentStatus.battery10);
break;
case 2:
display.print("CPU: ");
display.setCursor(92,0);
display.print(currentStatus.loopsPerSecond); display.print(currentStatus.loopsPerSecond);
break;
case 3:
display.print("Mem: ");
display.setCursor(92,0);
display.print(currentStatus.freeRAM);
break;
}
display.setCursor(64,11);
switch(configPage1.display4)
{
case 0:
display.print("O2: ");
display.setCursor(92,11);
display.print(currentStatus.O2);
break;
case 1:
display.print("Vdc: ");
display.setCursor(92,11);
display.print(currentStatus.battery10);
break;
case 2:
display.print("CPU: ");
display.setCursor(92,11);
display.print(currentStatus.loopsPerSecond);
break;
case 3:
display.print("Mem: ");
display.setCursor(92,11);
display.print(currentStatus.freeRAM);
break;
}
int barWidth = ldiv(((unsigned long)currentStatus.RPM * 128), 9000).quot; int barWidth = ldiv(((unsigned long)currentStatus.RPM * 128), 9000).quot;
//int barWidth = map(currentStatus.RPM, 0, 9000, 0, 128); //int barWidth = map(currentStatus.RPM, 0, 9000, 0, 128);

View File

@ -519,12 +519,14 @@ page = 3
dialog = OLED, "OLED Display", 1 dialog = OLED, "OLED Display", 1
field = "Display Type", display field = "Display Type", display
field = "#Note"
field = "ECU must be rebooted after changing above value"
field = "Field 1", display1, { display } field = "Field 1", display1, { display }
field = "Field 2", display2, { display } field = "Field 2", display2, { display }
field = "Field 3", display3, { display } field = "Field 3", display3, { display }
field = "Field 4", display4, { display } field = "Field 4", display4, { display }
field = "Bar 1", displayB1, { display } ;field = "Bar 1", displayB1, { display }
field = "Bar 2", displayB2, { display > 2 } ;field = "Bar 2", displayB2, { display > 2 }