1
0
forked from me/IronOS

Add new font glyphs, fix sceen rotation on soldering mode.

This commit is contained in:
Ben V. Brown
2017-09-27 11:29:16 +10:00
parent 830433d854
commit 82a5ed042d
4 changed files with 92 additions and 43 deletions

View File

@@ -42,6 +42,7 @@ uint16_t getHandleTemperature();
uint16_t getTipRawTemp(uint8_t instant); uint16_t getTipRawTemp(uint8_t instant);
uint16_t getInputVoltageX10(); uint16_t getInputVoltageX10();
uint16_t getTipInstantTemperature(); uint16_t getTipInstantTemperature();
uint8_t getTipPWM();
void setTipPWM(uint8_t pulse); void setTipPWM(uint8_t pulse);
uint16_t ctoTipMeasurement(uint16_t temp); uint16_t ctoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToC(uint16_t raw); uint16_t tipMeasurementToC(uint16_t raw);

View File

@@ -83,6 +83,10 @@ uint16_t getInputVoltageX10() {
//Ideal term is 57.69.... 58 is quite close //Ideal term is 57.69.... 58 is quite close
return getADC(1) / 58; return getADC(1) / 58;
} }
uint8_t getTipPWM()
{
return htim2.Instance->CCR4;
}
void setTipPWM(uint8_t pulse) { void setTipPWM(uint8_t pulse) {
PWMSafetyTimer = 100; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough. PWMSafetyTimer = 100; //This is decremented in the handler for PWM so that the tip pwm is disabled if the PID task is not scheduled often enough.
if (pulse > 100) if (pulse > 100)

View File

@@ -447,31 +447,78 @@ static void gui_solderingMode() {
waitForButtonPress(); waitForButtonPress();
return; return;
} else { } else {
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //We switch the layout direction depending on the orientation of the lcd.
lcd.drawSymbol(1); if (lcd.getRotation()) {
if (boostModeOn) // battery
lcd.drawSymbol(2); if (systemSettings.cutoutSetting) {
//6 gap //User is on a lithium battery
lcd.drawChar(' '); //we need to calculate which of the 10 levels they are on
//7 battery uint8_t cellCount = systemSettings.cutoutSetting + 2;
if (systemSettings.cutoutSetting) { uint16_t cellV = getInputVoltageX10() / cellCount;
//User is on a lithium battery //Should give us approx cell voltage X10
//we need to calculate which of the 10 levels they are on //Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
uint8_t cellCount = systemSettings.cutoutSetting + 2; if (cellV < 33)
uint16_t cellV = getInputVoltageX10() / cellCount; cellV = 33;
//Should give us approx cell voltage X10 cellV -= 33; //Should leave us a number of 0-9
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10 if (cellV > 9)
if (cellV < 33) cellV = 9;
cellV = 33; lcd.drawBattery(cellV + 1);
cellV -= 33; //Should leave us a number of 0-9 } else
if (cellV > 9) lcd.drawChar(' '); //print a blank spot if there is no battery symbol
cellV = 9;
lcd.drawBattery(cellV + 1);
}
//8 ^V indicators
lcd.drawChar(' '); // Space out gap between battery <-> temp
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
//We draw boost arrow if boosting, or else gap temp <-> heat indicator
if (boostModeOn)
lcd.drawSymbol(2);
else
lcd.drawChar(' ');
// Draw heating/cooling symbols
//If tip PWM > 25% then we are 'heating'
if (getTipPWM() > 25)
lcd.drawSymbol(14);
else
lcd.drawSymbol(15);
} else {
// Draw heating/cooling symbols
//If tip PWM > 25% then we are 'heating'
if (getTipPWM() > 25)
lcd.drawSymbol(14);
else
lcd.drawSymbol(15);
//We draw boost arrow if boosting, or else gap temp <-> heat indicator
if (boostModeOn)
lcd.drawSymbol(2);
else
lcd.drawChar(' ');
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
lcd.drawChar(' '); // Space out gap between battery <-> temp
if (systemSettings.cutoutSetting) {
//User is on a lithium battery
//we need to calculate which of the 10 levels they are on
uint8_t cellCount = systemSettings.cutoutSetting + 2;
uint16_t cellV = getInputVoltageX10() / cellCount;
//Should give us approx cell voltage X10
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
if (cellV < 33)
cellV = 33;
cellV -= 33; //Should leave us a number of 0-9
if (cellV > 9)
cellV = 9;
lcd.drawBattery(cellV + 1);
} else
lcd.drawChar(' '); //print a blank spot if there is no battery symbol
}
} }
// Draw heating/cooling symbols
//Update the setpoints for the temperature //Update the setpoints for the temperature
if (boostModeOn) if (boostModeOn)
@@ -548,7 +595,7 @@ void startGUITask(void const * argument) {
//Do nothing //Do nothing
break; break;
case BUTTON_BOTH: case BUTTON_BOTH:
//pressing both is ignored for now //Not used yet
break; break;
//Long presses are ignored for now //Long presses are ignored for now
case BUTTON_B_LONG: case BUTTON_B_LONG:

View File

@@ -217,30 +217,27 @@ const uint8_t FONT_12[]={
}; };
const uint8_t ExtraFontChars[] = { const uint8_t ExtraFontChars[] = {
0x00,0x0C,0x12,0x12,0x0C,0x00,0xF8,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x01,0x01,0x01,0x00,0x00,//Degrees F 0x00,0x18,0x24,0x24,0x18,0xC0,0x40,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x02,0x02,0x02,0x00,0x00,0x00,// Degrees F
0x00,0x0C,0x12,0x12,0x0C,0xE0,0x10,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x08,0x00,// Degrees C 0x00,0x18,0x24,0x24,0x18,0x80,0x40,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x00,0x00,// Degrees C
0x00,0x00,0x00,0x10,0x18,0x1C,0xFE,0x1C,0x18,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,//UP arrow 0x00,0x00,0x20,0x30,0x38,0xFC,0xFE,0xFC,0x38,0x30,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,// UP arrow
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00,/*Battery Empty*/
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x60,0x60,0x60,0x60,0x60,0x60,0x7F,0x00,0x00,/*Battery 1*/ 0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x3F,0x00,/*Battery Empty*/
0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x50,0x50,0x50,0x50,0x50,0x50,0x40,0x3F,0x00,/*Battery 1*/
0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x58,0x58,0x58,0x58,0x58,0x58,0x40,0x3F,0x00,/*Battery 2*/
0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5C,0x5C,0x5C,0x5C,0x5C,0x5C,0x40,0x3F,0x00,/*Battery 3*/
0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5E,0x5E,0x5E,0x5E,0x5E,0x5E,0x40,0x3F,0x00,/*Battery 4*/
0x00,0xF0,0x08,0x0E,0x02,0x02,0x02,0x02,0x0E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 5*/
0x00,0xF0,0x08,0x8E,0x82,0x82,0x82,0x82,0x8E,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 6*/
0x00,0xF0,0x08,0xCE,0xC2,0xC2,0xC2,0xC2,0xCE,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 7*/
0x00,0xF0,0x08,0xEE,0xE2,0xE2,0xE2,0xE2,0xEE,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 8*/
0x00,0xF0,0x08,0xEE,0xE2,0xF2,0xF2,0xE2,0xEE,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 9*/
0x00,0xF0,0x08,0xEE,0xE2,0xFA,0xFA,0xE2,0xEE,0x08,0xF0,0x00,0x00,0x3F,0x40,0x5F,0x5F,0x5F,0x5F,0x5F,0x5F,0x40,0x3F,0x00,/*Battery 10*/
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x70,0x70,0x70,0x70,0x70,0x70,0x7F,0x00,0x00,/*Battery 2*/ 0x00,0x00,0x38,0xC4,0x00,0x38,0xC4,0x00,0x38,0xC4,0x00,0x00,0x00,0x38,0x3A,0x39,0x38,0x3A,0x39,0x38,0x3A,0x39,0x10,0x10, // heating
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x38,0x10,0x10, // cooling
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x78,0x78,0x78,0x78,0x78,0x78,0x7F,0x00,0x00,/*Battery 3*/
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7F,0x00,0x00,/*Battery 4*/
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7E,0x7E,0x7E,0x7E,0x7E,0x7E,0x7F,0x00,0x00,/*Battery 5*/
0x00,0x00,0xF8,0x08,0x0E,0x02,0x02,0x0E,0x08,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,/*Battery 6*/
0x00,0x00,0xF8,0x88,0x8E,0x82,0x82,0x8E,0x88,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,/*Battery 7*/
0x00,0x00,0xF8,0xC8,0xCE,0xC2,0xC2,0xCE,0xC8,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,/*Battery 8*/
0x00,0x00,0xF8,0xE8,0xEE,0xE2,0xE2,0xEE,0xE8,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,/*Battery 9*/
0x00,0x00,0xF8,0xF8,0xFE,0xF2,0xF2,0xFE,0xF8,0xF8,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00,/*Battery 10*/
/* /*
0x00,0x00,0x00,0x80,0x80,0xFE,0xFF,0x83,0x87,0x06,0x00,0x00,0x00,0x00,0x30,0x70,0x60,0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,//Function? 0x00,0x00,0x00,0x80,0x80,0xFE,0xFF,0x83,0x87,0x06,0x00,0x00,0x00,0x00,0x30,0x70,0x60,0x7F,0x3F,0x00,0x00,0x00,0x00,0x00,//Function?
0x00,0x70,0xFA,0xDB,0xDB,0xDB,0xDB,0xDB,0xDB,0xFF,0xFE,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x00,//a_ 0x00,0x70,0xFA,0xDB,0xDB,0xDB,0xDB,0xDB,0xDB,0xFF,0xFE,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x00,0x00,//a_