Compare commits
2 Commits
d2f0444533
...
ec16a83d20
Author | SHA1 | Date |
---|---|---|
Paco Hope | ec16a83d20 | |
Paco Hope | 9652e0ac32 |
|
@ -93,8 +93,9 @@ const uint8_t DIN_1451_Engschrift_Regular12pt7bBitmaps[] PROGMEM = {
|
|||
0x18, 0x70, 0x60, 0xFF, 0xF0, 0xC6, 0x10, 0xC2, 0x18, 0xC3, 0xFF, 0xC0,
|
||||
0x3B, 0xD8, 0xC6, 0x31, 0x8C, 0x67, 0x30, 0xC6, 0x31, 0x8C, 0x63, 0x1E,
|
||||
0x70, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xE7, 0x8C, 0x63, 0x18, 0xC6, 0x30,
|
||||
0xCE, 0x63, 0x18, 0xC6, 0x31, 0xBD, 0xC0, 0x38, 0x2F, 0xCF, 0x1F, 0xA0,
|
||||
0xE0 };
|
||||
0xCE, 0x63, 0x18, 0xC6, 0x31, 0xBD, 0xC0,
|
||||
0x6F, 0xFF, 0xFF, 0x6F, 0xF0 // º symbol, normally 0xBA, stored at 0x7e
|
||||
};
|
||||
|
||||
const GFXglyph DIN_1451_Engschrift_Regular12pt7bGlyphs[] PROGMEM = {
|
||||
{ 0, 1, 1, 4, 0, 0 }, // 0x20 ' '
|
||||
|
@ -191,11 +192,25 @@ const GFXglyph DIN_1451_Engschrift_Regular12pt7bGlyphs[] PROGMEM = {
|
|||
{ 1104, 5, 20, 7, 0, -15 }, // 0x7B '{'
|
||||
{ 1117, 2, 19, 5, 1, -15 }, // 0x7C '|'
|
||||
{ 1122, 5, 20, 7, 1, -15 }, // 0x7D '}'
|
||||
{ 1135, 11, 4, 16, 2, -9 } }; // 0x7E '~'
|
||||
{ 1135, 4, 9, 6, 1, -15 } // 0x7E '~' replaced by 'º'
|
||||
};
|
||||
|
||||
// Approx. 1818 bytes
|
||||
|
||||
const GFXfont DIN_1451_Engschrift_Regular12pt7b PROGMEM = {
|
||||
(uint8_t *)DIN_1451_Engschrift_Regular12pt7bBitmaps,
|
||||
(GFXglyph *)DIN_1451_Engschrift_Regular12pt7bGlyphs,
|
||||
0x20, 0x7E, 27 };
|
||||
0x20, 0xBA, 27 };
|
||||
|
||||
// Approx. 1813 bytes
|
||||
// 'feet', 32x32px
|
||||
// Generated using https://javl.github.io/image2cpp/
|
||||
const unsigned char png_feet [] PROGMEM = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x01, 0xb7, 0x00, 0x00,
|
||||
0x06, 0x87, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0xfc, 0x00, 0x00, 0x1b, 0xfc, 0x60, 0x00,
|
||||
0x07, 0xfc, 0x70, 0x00, 0x07, 0xfc, 0x76, 0x00, 0x0f, 0xfc, 0x75, 0x80, 0x0f, 0xf8, 0x01, 0x00,
|
||||
0x0f, 0xf0, 0x00, 0xc0, 0x0f, 0xe0, 0x78, 0xc0, 0x07, 0xe0, 0xfe, 0x30, 0x07, 0xe0, 0xff, 0x30,
|
||||
0x07, 0xe0, 0xff, 0x80, 0x03, 0xe0, 0x7f, 0x80, 0x03, 0xf0, 0x3f, 0xc0, 0x03, 0xf8, 0x3f, 0xc0,
|
||||
0x03, 0xfc, 0x3f, 0x80, 0x01, 0xfc, 0x3f, 0x80, 0x01, 0xfc, 0x3f, 0x00, 0x01, 0xf8, 0x7f, 0x00,
|
||||
0x00, 0xf0, 0xfe, 0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x07, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xf0, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x01, 0xc0, 0x00
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#define TEMP_UNIT, "imperial"
|
||||
#include <Watchy.h> //include the Watchy library
|
||||
#include "DIN_1451_Engschrift_Regular64pt7b.h"
|
||||
#include "DIN_1451_Engschrift_Regular12pt7b.h"
|
||||
|
@ -29,8 +30,13 @@ class WatchFace : public Watchy { //inherit and extend Watchy class
|
|||
display.setTextColor(light ? GxEPD_BLACK : GxEPD_WHITE);
|
||||
display.setTextWrap(false);
|
||||
|
||||
//draw hours
|
||||
textstring = currentTime.Hour;
|
||||
// draw hours with leading 0
|
||||
if (currentTime.Hour < 10) {
|
||||
textstring = "0";
|
||||
} else {
|
||||
textstring = "";
|
||||
}
|
||||
textstring += currentTime.Hour;
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.setCursor(183-w, 100-5);
|
||||
display.print(textstring);
|
||||
|
@ -58,28 +64,22 @@ class WatchFace : public Watchy { //inherit and extend Watchy class
|
|||
display.setFont(&DIN_1451_Engschrift_Regular12pt7b);
|
||||
lasty = 200 - 16;
|
||||
|
||||
//draw steps
|
||||
// draw steps with footprint icon
|
||||
textstring = sensor.getCounter();
|
||||
textstring += " steps";
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.fillRoundRect(16,lasty-h-2,w + 7,h+4,2,light ? GxEPD_BLACK : GxEPD_WHITE);
|
||||
display.drawBitmap(58, lasty-h-10, png_feet, 32, 32, GxEPD_WHITE);
|
||||
display.setCursor(19, lasty-3);
|
||||
display.setTextColor(light ? GxEPD_WHITE : GxEPD_BLACK);
|
||||
display.print(textstring);
|
||||
display.setTextColor(light ? GxEPD_BLACK : GxEPD_WHITE);
|
||||
lasty += -8-h;
|
||||
lasty += -10;
|
||||
|
||||
// draw year
|
||||
textstring = currentTime.Year + 1970;
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.setCursor(16, lasty);
|
||||
display.print(textstring);
|
||||
lasty += -20;
|
||||
|
||||
// draw date
|
||||
textstring = monthShortStr(currentTime.Month);
|
||||
// draw date as DD MMM YY
|
||||
textstring = currentTime.Day;
|
||||
textstring += " ";
|
||||
textstring += currentTime.Day;
|
||||
textstring += monthShortStr(currentTime.Month);
|
||||
textstring += " ";
|
||||
textstring += currentTime.Year;
|
||||
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.setCursor(16, lasty);
|
||||
display.print(textstring);
|
||||
|
@ -129,7 +129,7 @@ class WatchFace : public Watchy { //inherit and extend Watchy class
|
|||
} else if (weatherConditionCode >= 200) {
|
||||
textstring = "Thunderstorm";
|
||||
} else {
|
||||
textstring = "";
|
||||
textstring = "Ambient";
|
||||
}
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.setCursor(16, lasty);
|
||||
|
@ -138,11 +138,12 @@ class WatchFace : public Watchy { //inherit and extend Watchy class
|
|||
|
||||
// draw temperature
|
||||
textstring = temperature;
|
||||
textstring += strcmp(TEMP_UNIT, "metric") == 0 ? "C" : "F";
|
||||
textstring += strcmp(TEMP_UNIT, "metric") == 0 ? "~ C" : "~ F"; // ~ will be rendered as º
|
||||
display.getTextBounds(textstring, 0, 0, &x1, &y1, &w, &h);
|
||||
display.setCursor(16, lasty);
|
||||
display.print(textstring);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
WatchFace m; //instantiate your watchface
|
Loading…
Reference in New Issue