BIN
BatteryIcon.bmp
Normal file
BIN
BatteryIcon.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 630 B |
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
#ifndef FONT_H_
|
#ifndef FONT_H_
|
||||||
#define FONT_H_
|
#define FONT_H_
|
||||||
|
/*
|
||||||
|
* Remember screen is LSB at the top, MSB at the bottom of the strip!
|
||||||
|
*/
|
||||||
#define FONT_WIDTH 12 /*How many pixels wide the font is*/
|
#define FONT_WIDTH 12 /*How many pixels wide the font is*/
|
||||||
const uint8_t FONT[]={
|
const uint8_t FONT[]={
|
||||||
0x00,0xF0,0xFC,0x0E,0x82,0xC2,0x62,0x1E,0xFC,0xF0,0x00,0x00,
|
0x00,0xF0,0xFC,0x0E,0x82,0xC2,0x62,0x1E,0xFC,0xF0,0x00,0x00,
|
||||||
@@ -95,8 +97,42 @@ const uint8_t FONT[]={
|
|||||||
|
|
||||||
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,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,/*.*/
|
0x00,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x00,0x00,0x00,/*.*/
|
||||||
};
|
|
||||||
|
|
||||||
|
};
|
||||||
|
const uint8_t extendedFont[] = {
|
||||||
|
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,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,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*/
|
||||||
|
};
|
||||||
const uint8_t Iron_Base[] ={
|
const uint8_t Iron_Base[] ={
|
||||||
0x00,0x20,0x60,0x60,0x60,0x60,0x60,0x60,0x90,0x90,0x90,0x90,
|
0x00,0x20,0x60,0x60,0x60,0x60,0x60,0x60,0x90,0x90,0x90,0x90,
|
||||||
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
|
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
|
||||||
|
|||||||
@@ -14,16 +14,17 @@
|
|||||||
void Oled_DisplayOn(void);
|
void Oled_DisplayOn(void);
|
||||||
void Oled_DisplayOff(void);
|
void Oled_DisplayOff(void);
|
||||||
|
|
||||||
u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high, u8* ptr);
|
const u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high,const u8* ptr);
|
||||||
void Set_ShowPos(u8 x, u8 y);
|
void Set_ShowPos(u8 x, u8 y);
|
||||||
void Oled_DisplayFlip();
|
void Oled_DisplayFlip();
|
||||||
void GPIO_Init_OLED(void);
|
void GPIO_Init_OLED(void);
|
||||||
void Init_Oled(uint8_t leftHanded);
|
void Init_Oled(uint8_t leftHanded);
|
||||||
u8* Data_Command(u8 len, u8* ptr);
|
const u8* Data_Command(u8 len,const u8* ptr);
|
||||||
void Clear_Screen(void);//Clear the screen
|
void Clear_Screen(void);//Clear the screen
|
||||||
/*Functions for writing to the screen*/
|
/*Functions for writing to the screen*/
|
||||||
void OLED_DrawString(const char* string, const uint8_t length);
|
void OLED_DrawString(const char* string, const uint8_t length);
|
||||||
void OLED_DrawChar(char c, uint8_t x);
|
void OLED_DrawChar(char c, uint8_t x);
|
||||||
|
void OLED_DrawExtendedChar(uint8_t id, uint8_t x);
|
||||||
void OLED_DrawTwoNumber(uint8_t in, uint8_t x);
|
void OLED_DrawTwoNumber(uint8_t in, uint8_t x);
|
||||||
void OLED_BlankSlot(uint8_t xStart,uint8_t width);
|
void OLED_BlankSlot(uint8_t xStart,uint8_t width);
|
||||||
void OLED_DrawThreeNumber(uint16_t in, uint8_t x);
|
void OLED_DrawThreeNumber(uint16_t in, uint8_t x);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "Modes.h"
|
#include "Modes.h"
|
||||||
const char *SettingsLongNames[] = {
|
const char *SettingsLongNames[] = {
|
||||||
" Power source. Sets cutoff voltage. <DC 10V> <S 3.5V per cell>",
|
" Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
|
||||||
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
||||||
" Shutdown Timeout <Minutes>",
|
" Shutdown Timeout <Minutes>",
|
||||||
" Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
|
" Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
|
||||||
@@ -157,7 +157,7 @@ void ProcessUI() {
|
|||||||
case SLEEP_TIME:
|
case SLEEP_TIME:
|
||||||
++systemSettings.SleepTime; //Go up 1 minute at a time
|
++systemSettings.SleepTime; //Go up 1 minute at a time
|
||||||
if (systemSettings.SleepTime > 30)
|
if (systemSettings.SleepTime > 30)
|
||||||
systemSettings.SleepTime = 1;//cant set time over 30 mins
|
systemSettings.SleepTime = 1;//can't set time over 30 mins
|
||||||
//Remember that ^ is the time of no movement
|
//Remember that ^ is the time of no movement
|
||||||
break;
|
break;
|
||||||
case SHUTDOWN_TIME:
|
case SHUTDOWN_TIME:
|
||||||
@@ -411,12 +411,27 @@ void DrawUI() {
|
|||||||
lastOLEDDrawTime = millis();
|
lastOLEDDrawTime = millis();
|
||||||
//Now draw symbols
|
//Now draw symbols
|
||||||
if (StatusFlags == 8)
|
if (StatusFlags == 8)
|
||||||
OLED_DrawChar('B', 3);
|
OLED_DrawChar('B', 4);
|
||||||
else
|
else {
|
||||||
OLED_DrawChar(' ', 3);
|
OLED_DrawChar(' ', 4);
|
||||||
|
}
|
||||||
|
//Draw in battery symbol if desired
|
||||||
|
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 = readDCVoltage(systemSettings.voltageDiv)
|
||||||
|
/ 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
|
||||||
|
OLED_DrawExtendedChar(cellV + 1, 5);
|
||||||
|
} else {
|
||||||
|
OLED_DrawChar(' ', 5);
|
||||||
|
}
|
||||||
OLED_BlankSlot(6 * 12 + 16, 24 - 16);//blank out the tail after the arrows
|
OLED_BlankSlot(6 * 12 + 16, 24 - 16);//blank out the tail after the arrows
|
||||||
OLED_BlankSlot(4 * 12 + 16, 24 - 16);//blank out the tail after the temp
|
|
||||||
if (getIronTimer() == 0
|
if (getIronTimer() == 0
|
||||||
&& (temp / 10) > (systemSettings.SolderingTemp / 10)) {
|
&& (temp / 10) > (systemSettings.SolderingTemp / 10)) {
|
||||||
//Cooling
|
//Cooling
|
||||||
@@ -430,9 +445,9 @@ void DrawUI() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (systemSettings.displayTempInF) {
|
if (systemSettings.displayTempInF) {
|
||||||
OLED_DrawSymbol(4, 1);
|
OLED_DrawChar('F', 3);
|
||||||
} else {
|
} else {
|
||||||
OLED_DrawSymbol(4, 0);
|
OLED_DrawChar('C', 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void Oled_DisplayFlip() {
|
|||||||
Input: number of bytes to write, array to write
|
Input: number of bytes to write, array to write
|
||||||
Output:
|
Output:
|
||||||
*/
|
*/
|
||||||
u8* Data_Command(u8 length, u8* data) {
|
const u8* Data_Command(u8 length,const u8* data) {
|
||||||
int i;
|
int i;
|
||||||
u8 tx_data[129];
|
u8 tx_data[129];
|
||||||
//here are are inserting the data write command at the beginning
|
//here are are inserting the data write command at the beginning
|
||||||
@@ -107,7 +107,7 @@ void Set_ShowPos(u8 x, u8 y) {
|
|||||||
Inputs:(x,y) start point, (width,height) of enclosing rect, pointer to data
|
Inputs:(x,y) start point, (width,height) of enclosing rect, pointer to data
|
||||||
Output: pointer to the last byte written out
|
Output: pointer to the last byte written out
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high, u8* ptr) {
|
const u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high,const u8* ptr) {
|
||||||
u8 m, n, y;
|
u8 m, n, y;
|
||||||
|
|
||||||
n = y0 + high;
|
n = y0 + high;
|
||||||
@@ -174,7 +174,7 @@ void Clear_Screen(void) {
|
|||||||
/*
|
/*
|
||||||
* Draws a string onto the screen starting at the left
|
* Draws a string onto the screen starting at the left
|
||||||
*/
|
*/
|
||||||
void OLED_DrawString(const char* string,const uint8_t length) {
|
void OLED_DrawString(const char* string, const uint8_t length) {
|
||||||
for (uint8_t i = 0; i < length; i++) {
|
for (uint8_t i = 0; i < length; i++) {
|
||||||
OLED_DrawChar(string[i], i);
|
OLED_DrawChar(string[i], i);
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,13 @@ void OLED_DrawChar(char c, uint8_t x) {
|
|||||||
|
|
||||||
Oled_DrawArea(x, 0, FONT_WIDTH, 16, (u8*) ptr);
|
Oled_DrawArea(x, 0, FONT_WIDTH, 16, (u8*) ptr);
|
||||||
}
|
}
|
||||||
|
void OLED_DrawExtendedChar(uint8_t id, uint8_t x) {
|
||||||
|
u8* ptr = (u8*) extendedFont;
|
||||||
|
ptr += (id) * (FONT_WIDTH * 2);
|
||||||
|
x *= FONT_WIDTH; //convert to a x coordinate
|
||||||
|
|
||||||
|
Oled_DrawArea(x, 0, FONT_WIDTH, 16, (u8*) ptr);
|
||||||
|
}
|
||||||
void OLED_BlankSlot(uint8_t xStart, uint8_t width) {
|
void OLED_BlankSlot(uint8_t xStart, uint8_t width) {
|
||||||
u8* ptr = (u8*) FONT;
|
u8* ptr = (u8*) FONT;
|
||||||
ptr += (36) * (FONT_WIDTH * 2);
|
ptr += (36) * (FONT_WIDTH * 2);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ uint8_t lookupVoltageLevel(uint8_t level) {
|
|||||||
if (level == 0)
|
if (level == 0)
|
||||||
return 100; //10V since iron does not function below this
|
return 100; //10V since iron does not function below this
|
||||||
else
|
else
|
||||||
return (level * 35) + (35 * 2);
|
return (level * 33) + (33 * 2);
|
||||||
}
|
}
|
||||||
void resetSettings() {
|
void resetSettings() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user