mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update power indicator
Fixes and closes #211 Final 2.04 release coming up :)
This commit is contained in:
@@ -86,8 +86,8 @@ void OLED::refresh() {
|
||||
screenBuffer[12] = 0x80;
|
||||
screenBuffer[13] = 0x01;
|
||||
screenBuffer[14] = 0x40; //start of data marker
|
||||
|
||||
i2c->Transmit( DEVICEADDR_OLED, screenBuffer, 12 + 96 * 2 + 1);
|
||||
|
||||
i2c->Transmit( DEVICEADDR_OLED, screenBuffer, 14 + 96 * 2 + 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ void OLED::drawBattery(uint8_t state) {
|
||||
drawSymbol(3 + state);
|
||||
}
|
||||
void OLED::drawCheckbox(bool state) {
|
||||
drawSymbol((state) ? 17 : 18);
|
||||
drawSymbol((state) ? 16 : 17);
|
||||
}
|
||||
void OLED::drawSymbol(uint8_t symbolID) {
|
||||
//draw a symbol to the current cursor location
|
||||
@@ -340,3 +340,49 @@ void OLED::fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OLED::drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
|
||||
bool clear) {
|
||||
//Draw this in 3 sections
|
||||
//This is basically a N wide version of vertical line
|
||||
|
||||
//Step 1 : Draw in the top few pixels that are not /8 aligned
|
||||
//LSB is at the top of the screen
|
||||
uint8_t mask = 0xFF;
|
||||
if (y0) {
|
||||
mask = mask << (y0 % 8);
|
||||
for (uint8_t col = x0; col < x1; col++)
|
||||
if (clear)
|
||||
firstStripPtr[(y0 / 8) * 96 + col] &= ~mask;
|
||||
else
|
||||
firstStripPtr[(y0 / 8) * 96 + col] |= mask;
|
||||
}
|
||||
//Next loop down the line the total number of solids
|
||||
if (y0 / 8 != y1 / 8)
|
||||
for (uint8_t col = x0; col < x1; col++)
|
||||
for (uint8_t r = (y0 / 8); r < (y1 / 8); r++) {
|
||||
//This gives us the row index r
|
||||
if (clear)
|
||||
firstStripPtr[(r * 96) + col] = 0;
|
||||
else
|
||||
firstStripPtr[(r * 96) + col] = 0xFF;
|
||||
}
|
||||
|
||||
//Finally draw the tail
|
||||
mask = ~(mask << (y1 % 8));
|
||||
for (uint8_t col = x0; col < x1; col++)
|
||||
if (clear)
|
||||
firstStripPtr[(y1 / 8) * 96 + col] &= ~mask;
|
||||
else
|
||||
firstStripPtr[(y1 / 8) * 96 + col] |= mask;
|
||||
}
|
||||
|
||||
void OLED::drawHeatSymbol(uint8_t state) {
|
||||
//Draw symbol 14
|
||||
//Then draw over it botom 5 pixels always stay. 8 pixels above that are the levels
|
||||
state /= 12; // 0-> 8 range
|
||||
//Then we want to draw down (16-(5+state)
|
||||
uint8_t cursor_x_temp = cursor_x;
|
||||
drawSymbol(14);
|
||||
drawFilledRect(cursor_x_temp, 0, cursor_x_temp + 12, 2 + (8 - state), true);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ static void gui_drawBatteryIcon() {
|
||||
cellV = 9;
|
||||
lcd.drawBattery(cellV + 1);
|
||||
} else
|
||||
lcd.drawSymbol(16); // Draw the DC Logo
|
||||
lcd.drawSymbol(15); // Draw the DC Logo
|
||||
}
|
||||
static void gui_solderingTempAdjust() {
|
||||
uint32_t lastChange = xTaskGetTickCount();
|
||||
@@ -571,18 +571,10 @@ static void gui_solderingMode() {
|
||||
lcd.drawChar(' ');
|
||||
|
||||
// Draw heating/cooling symbols
|
||||
// If tip PWM > 30% then we are 'heating'
|
||||
if (getTipPWM() > 30)
|
||||
lcd.drawSymbol(14);
|
||||
else
|
||||
lcd.drawSymbol(15);
|
||||
lcd.drawHeatSymbol(getTipPWM());
|
||||
} else {
|
||||
// Draw heating/cooling symbols
|
||||
// If tip PWM > 10% then we are 'heating'
|
||||
if (getTipPWM() > 10)
|
||||
lcd.drawSymbol(14);
|
||||
else
|
||||
lcd.drawSymbol(15);
|
||||
lcd.drawHeatSymbol(getTipPWM());
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat indicator
|
||||
if (boostModeOn)
|
||||
lcd.drawSymbol(2);
|
||||
|
||||
Reference in New Issue
Block a user