Skip to content

Commit

Permalink
State icons work
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter323i committed Nov 30, 2023
1 parent a45f07a commit f766819
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
28 changes: 25 additions & 3 deletions SolderingPen_ESP32S2/SolderingPen_ESP32S2.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
#include <Arduino.h>
#include "config.h"

//
Expand All @@ -10,6 +10,7 @@
#include "Languages.h"
#include "USB.h"
#include "UtilsEEPROM.h"
#include "images.h"

QC3Control QC(14, 13);
// QC.set12V();
Expand Down Expand Up @@ -779,6 +780,29 @@ void MainScreen() {
u8g2.print(fVin, 1);
u8g2.print(F("V"));

// draw status of heater 绘制加热器状态
if (ShowTemp > 500){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_error);
}
else if(inOffMode || inLockMode){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_off);
}
else if (inSleepMode){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_sleep);
}
else if (inBoostMode){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_boost);
}
else if (isWorky){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_work);
}
else if (Output < 180){
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_heat);
}
else{
u8g2.drawXBM(0, 26, status_icon_width, status_icon_height, status_icon_hold);
}

// draw current temperature in big figures 用大数字绘制当前温度
u8g2.setFont(u8g2_font_7Segments_26x42_mn);
u8g2.setFontPosTop();
Expand All @@ -787,8 +811,6 @@ void MainScreen() {
else
u8g2.setCursor(38, 20);
u8g2.printf("%d", ShowTemp);

//u8g2.drawBox(0, 26, 32, 32);
}
} while (u8g2.nextPage());
}
Expand Down
102 changes: 102 additions & 0 deletions SolderingPen_ESP32S2/images.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#include <Arduino.h>

#define status_icon_width 32
#define status_icon_height 32

// ERROR
const uint8_t status_icon_error[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x0E, 0x78, 0x00, 0x00, 0x0F, 0xF8, 0x00, 0x80, 0x0F,
0xF0, 0x01, 0xC0, 0x07, 0xE0, 0x03, 0xE0, 0x03, 0xC0, 0x07, 0xF0, 0x01,
0x80, 0x0F, 0xF8, 0x00, 0x00, 0x1F, 0x7C, 0x00, 0x00, 0x3E, 0x3E, 0x00,
0x00, 0x7C, 0x1F, 0x00, 0x00, 0xF8, 0x0F, 0x60, 0x80, 0xF3, 0x67, 0x78,
0xF8, 0xE7, 0xF3, 0x7F, 0x80, 0xF3, 0x67, 0x78, 0x00, 0xF8, 0x0F, 0x60,
0x00, 0x7C, 0x1F, 0x00, 0x00, 0x3E, 0x3E, 0x00, 0x00, 0x1F, 0x7C, 0x00,
0x80, 0x0F, 0xF8, 0x00, 0xC0, 0x07, 0xF0, 0x01, 0xE0, 0x03, 0xE0, 0x03,
0xF0, 0x01, 0xC0, 0x07, 0xF8, 0x00, 0x80, 0x0F, 0x78, 0x00, 0x00, 0x0F,
0x38, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

// OFF
const uint8_t status_icon_off[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF0, 0xF1, 0xF7, 0x07, 0xF8, 0xF3, 0xF7, 0x07, 0xBC, 0x77, 0x70, 0x00,
0x1C, 0x77, 0x70, 0x00, 0x1C, 0xF7, 0xF3, 0x03, 0x1C, 0xF7, 0xF3, 0x03,
0x1C, 0x77, 0x70, 0x00, 0xBC, 0x77, 0x70, 0x00, 0xF8, 0x73, 0x70, 0x00,
0xF0, 0x71, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };

// SLEEP
const uint8_t status_icon_sleep[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x78, 0x10, 0x00, 0x00, 0x40, 0x08,
0x00, 0x00, 0x20, 0x04, 0x00, 0xF0, 0x23, 0x02, 0x00, 0x00, 0x12, 0x1E,
0x00, 0x00, 0x09, 0x00, 0x00, 0x80, 0x78, 0x00, 0xF8, 0x8F, 0x00, 0x00,
0x00, 0x4C, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00,
0x00, 0xF3, 0x03, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0xF8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };

// BOOST
const uint8_t status_icon_boost[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00,
0x30, 0x70, 0x60, 0x00, 0x30, 0x78, 0x78, 0x00, 0x70, 0x7C, 0x7C, 0x00,
0xF8, 0x7C, 0x3E, 0x00, 0xF8, 0x7D, 0x1F, 0x00, 0xF8, 0x7D, 0x1F, 0x00,
0xF8, 0xFF, 0x0F, 0x00, 0xF8, 0xFF, 0x0F, 0x00, 0xF0, 0xFF, 0x0F, 0x00,
0xF0, 0xFF, 0x07, 0x00, 0xF0, 0xFF, 0x07, 0x00, 0xF0, 0xEF, 0x07, 0x00,
0xF0, 0xC7, 0x07, 0x00, 0xE0, 0xC7, 0x0F, 0x00, 0xC0, 0xC3, 0x0F, 0x00,
0xC0, 0xC3, 0x0F, 0x00, 0xC0, 0xC3, 0x0F, 0x00, 0xC0, 0xC3, 0x07, 0x00,
0xC0, 0xC3, 0x07, 0x00, 0x80, 0xC3, 0x07, 0x00, 0x80, 0xE7, 0x03, 0x00,
0x00, 0xE7, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };

// WORK
const uint8_t status_icon_work[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };

// ON
const uint8_t status_icon_heat[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x90, 0x04, 0x00, 0x00, 0x90, 0x04, 0x00, 0x00, 0x20, 0x09, 0x00, 0x00,
0x20, 0x09, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00,
0x40, 0x12, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, 0x20, 0x09, 0x00, 0x00,
0x90, 0x04, 0x00, 0x00, 0x90, 0x04, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00,
0x48, 0x02, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x90, 0x04, 0x00, 0x00,
0x90, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };

// HOLD
const uint8_t status_icon_hold[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00,
0x00, 0x08, 0x00, 0x00, 0x40, 0x2A, 0x01, 0x00, 0x60, 0x1C, 0x03, 0x00,
0x80, 0x88, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x20, 0x2A, 0x02, 0x00,
0x48, 0x5D, 0x09, 0x00, 0xFC, 0xF7, 0x1F, 0x00, 0x48, 0x5D, 0x09, 0x00,
0x20, 0x2A, 0x02, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x80, 0x88, 0x00, 0x00,
0x60, 0x1C, 0x03, 0x00, 0x40, 0x2A, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00,
0x00, 0x1C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x80, 0xFF, 0x1F, 0x78, 0xF8, 0xFF, 0xFF, 0x7F, 0x80, 0xFF, 0x1F, 0x78,
0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, };
Binary file modified images/Icons.bmp
Binary file not shown.
Binary file modified images/hold.bmp
Binary file not shown.

0 comments on commit f766819

Please sign in to comment.