Skip to content

Commit

Permalink
Update power indicator
Browse files Browse the repository at this point in the history
Fixes and closes #211
Final 2.04 release coming up :)
  • Loading branch information
Ralim committed Apr 27, 2018
1 parent b6351f9 commit 42db57d
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 16 deletions.
2 changes: 1 addition & 1 deletion workspace/TS100/.settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1349131645423570210" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-283880394950776525" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
1 change: 0 additions & 1 deletion workspace/TS100/inc/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ const uint8_t ExtraFontChars[] = {
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,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,0x60,0xE0,0xFE,0xE0,0xE0,0xE0,0xE0,0xFE,0xE0,0x60,0x00,0x00,0x00,0x00,0x01,0x03,0xFF,0xFF,0x03,0x01,0x00,0x00,0x00, // AC

0xFC,0x02,0x02,0x02,0x02,0x02,0x02,0x82,0x62,0x1A,0x02,0xFC,0x3F,0x40,0x42,0x46,0x4C,0x58,0x46,0x41,0x40,0x40,0x40,0x3F, // ☑ (check box on, menu true)
Expand Down
2 changes: 2 additions & 0 deletions workspace/TS100/inc/OLED.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class OLED {
const uint8_t* ptr);
void fillArea(int16_t x, int8_t y, uint8_t wide, uint8_t height,
const uint8_t value);
void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,bool clear);
void drawHeatSymbol(uint8_t state);
private:

//Draw a buffer to the screen buffer
Expand Down
52 changes: 49 additions & 3 deletions workspace/TS100/src/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
14 changes: 3 additions & 11 deletions workspace/TS100/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 42db57d

Please sign in to comment.