Compare commits
No commits in common. "44a3a0d1e972c8ff725348244a9dca91f14633e7" and "557df68c75f91814aa193ceb2370031965799410" have entirely different histories.
44a3a0d1e9
...
557df68c75
|
|
@ -7,12 +7,5 @@
|
||||||
"path": "firmware"
|
"path": "firmware"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {}
|
||||||
"files.associations": {
|
|
||||||
"*.ejs": "html",
|
|
||||||
".env": "env",
|
|
||||||
".env.*": "env",
|
|
||||||
"cmath": "cpp"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -26,8 +26,6 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
dow_apply_font(display, item->font);
|
dow_apply_font(display, item->font);
|
||||||
display.getTextBounds(item->contents, 0, 0, &tbx, &tby, &tbw, &tbh);
|
display.getTextBounds(item->contents, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||||||
|
|
||||||
// bool debug = item->contents.equals("Srazky");
|
|
||||||
|
|
||||||
int x = item->x;
|
int x = item->x;
|
||||||
int y = item->y;
|
int y = item->y;
|
||||||
int w = tbw;
|
int w = tbw;
|
||||||
|
|
@ -52,14 +50,14 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
{
|
{
|
||||||
case ITEM_ALIGN_CENTER:
|
case ITEM_ALIGN_CENTER:
|
||||||
{
|
{
|
||||||
y -= (h + tby);
|
y += tby;
|
||||||
y += round((double)h / 2);
|
y += round((double)h / 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ITEM_ALIGN_START:
|
case ITEM_ALIGN_START:
|
||||||
{
|
{
|
||||||
y -= (h + tby);
|
y += tby;
|
||||||
y += h;
|
y += h;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -81,27 +79,6 @@ void dow_get_text_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ058
|
||||||
*ry = y;
|
*ry = y;
|
||||||
*rw = w;
|
*rw = w;
|
||||||
*rh = h;
|
*rh = h;
|
||||||
|
|
||||||
/*
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Serial.print(x);
|
|
||||||
Serial.print(", ");
|
|
||||||
Serial.print(y);
|
|
||||||
Serial.print(", ");
|
|
||||||
Serial.print(w);
|
|
||||||
Serial.print(", ");
|
|
||||||
Serial.print(h);
|
|
||||||
Serial.print(", tbx:");
|
|
||||||
Serial.print(tbx);
|
|
||||||
Serial.print(", tby:");
|
|
||||||
Serial.print(tby);
|
|
||||||
Serial.print(", tbw:");
|
|
||||||
Serial.print(tbw);
|
|
||||||
Serial.print(", tbh:");
|
|
||||||
Serial.println(tbh);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dow_get_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ0583T31::HEIGHT> &display, dow_item_t *item, int *rx, int *ry, int *rw, int *rh)
|
void dow_get_item_rect(GxEPD2_BW<GxEPD2_583_GDEQ0583T31, GxEPD2_583_GDEQ0583T31::HEIGHT> &display, dow_item_t *item, int *rx, int *ry, int *rw, int *rh)
|
||||||
|
|
|
||||||
|
|
@ -168,35 +168,31 @@ export const dowRoutes = router((router, ctx) => {
|
||||||
|
|
||||||
const next12Hours = Object.entries(weather.hours).slice(1, 22)
|
const next12Hours = Object.entries(weather.hours).slice(1, 22)
|
||||||
|
|
||||||
const tempY = 210
|
const tempY = 230
|
||||||
const tempX = 30
|
const tempX = 30
|
||||||
const tempW = 280
|
const tempW = 280
|
||||||
const tempH = 120
|
const tempH = 120
|
||||||
|
|
||||||
const tempGraphP = 5
|
const tempGraphP = 5
|
||||||
const tempGraphX = tempX + tempGraphP * 2
|
|
||||||
const tempGraphY = tempY + 24 + tempGraphP
|
|
||||||
const tempGraphW = tempW - tempGraphP * 4
|
const tempGraphW = tempW - tempGraphP * 4
|
||||||
const tempGraphH = tempH - 24 - tempGraphP * 2
|
|
||||||
|
|
||||||
widgets.push(
|
widgets.push(
|
||||||
...rectangleWithTitle({
|
...rectangleWithTitle({
|
||||||
x: tempX,
|
x: tempX,
|
||||||
y: tempY,
|
y: tempY - 20,
|
||||||
width: tempW,
|
width: tempW,
|
||||||
height: tempH,
|
height: tempH,
|
||||||
title: 'Teplota',
|
title: 'Teplota',
|
||||||
titleHeight: 24,
|
titleHeight: 20,
|
||||||
titleFont: 3,
|
titleFont: 3,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
widgets.push(
|
widgets.push(
|
||||||
...barGraph({
|
...barGraph({
|
||||||
x: tempGraphX,
|
x: tempX + tempGraphP * 2,
|
||||||
y: tempGraphY,
|
y: tempY + tempGraphP,
|
||||||
width: tempGraphW,
|
width: tempGraphW,
|
||||||
height: tempGraphH,
|
height: tempH - 20 - tempGraphP * 2,
|
||||||
data: next12Hours.map(([offset, h]) => ({
|
data: next12Hours.map(([offset, h]) => ({
|
||||||
x: now.plus({ hours: +offset }).hour.toString().padStart(2, '0'),
|
x: now.plus({ hours: +offset }).hour.toString().padStart(2, '0'),
|
||||||
yFormatted: Math.floor(h.temperature as number).toString(),
|
yFormatted: Math.floor(h.temperature as number).toString(),
|
||||||
|
|
@ -210,35 +206,59 @@ export const dowRoutes = router((router, ctx) => {
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const preY = 230 + 124
|
/*
|
||||||
|
const minPre = Math.min(
|
||||||
|
...next12Hours.map(([, h]) => h.precipitationAmount as number),
|
||||||
|
)
|
||||||
|
|
||||||
|
const maxPre = Math.max(
|
||||||
|
...next12Hours.map(([, h]) => h.precipitationAmount as number),
|
||||||
|
)
|
||||||
|
|
||||||
|
const maxPreIndex = Object.entries(weather.hours).reduce(
|
||||||
|
(acc, [i, h]) => {
|
||||||
|
if (typeof h.precipitationAmount !== 'number') {
|
||||||
|
return acc
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!acc || h.precipitationAmount > acc.pre) {
|
||||||
|
return { pre: h.precipitationAmount, index: i }
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc
|
||||||
|
},
|
||||||
|
{} as { pre: number; index: string } | undefined,
|
||||||
|
)?.index
|
||||||
|
|
||||||
|
const displayedMaxPre = Math.max(maxPre, 1)
|
||||||
|
const preRange = displayedMaxPre - minPre
|
||||||
|
*/
|
||||||
|
|
||||||
|
const preY = 250 + 120
|
||||||
const preX = 30
|
const preX = 30
|
||||||
const preW = 280
|
const preW = 280
|
||||||
const preH = 116
|
const preH = 120
|
||||||
|
|
||||||
const preGraphP = 5
|
const preGraphP = 5
|
||||||
const preGraphX = preX + preGraphP * 2
|
|
||||||
const preGraphY = preY + 24 + preGraphP
|
|
||||||
const preGraphW = preW - preGraphP * 4
|
const preGraphW = preW - preGraphP * 4
|
||||||
const preGraphH = preH - 24 - preGraphP * 2
|
|
||||||
|
|
||||||
widgets.push(
|
widgets.push(
|
||||||
...rectangleWithTitle({
|
...rectangleWithTitle({
|
||||||
x: preX,
|
x: preX,
|
||||||
y: preY,
|
y: preY - 20,
|
||||||
width: preW,
|
width: preW,
|
||||||
height: preH,
|
height: preH,
|
||||||
title: 'Srazky',
|
title: 'Srazky',
|
||||||
titleHeight: 24,
|
titleHeight: 20,
|
||||||
titleFont: 3,
|
titleFont: 3,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
widgets.push(
|
widgets.push(
|
||||||
...barGraph({
|
...barGraph({
|
||||||
x: preGraphX,
|
x: preX + preGraphP * 2,
|
||||||
y: preGraphY,
|
y: preY + preGraphP,
|
||||||
width: preGraphW,
|
width: preGraphW,
|
||||||
height: preGraphH,
|
height: preH - 20 - preGraphP * 2,
|
||||||
data: next12Hours.map(([offset, h]) => ({
|
data: next12Hours.map(([offset, h]) => ({
|
||||||
x: now.plus({ hours: +offset }).hour.toString().padStart(2, '0'),
|
x: now.plus({ hours: +offset }).hour.toString().padStart(2, '0'),
|
||||||
yFormatted: (h.precipitationAmount as number).toFixed(1) + 'mm',
|
yFormatted: (h.precipitationAmount as number).toFixed(1) + 'mm',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue