feat: Remove refresh icon and adjust timestamp display
This commit is contained in:
1 parent
e0c434840b
commit
4a32c31a7b
1 file changed
+3
-37
+3
-37
@@ -111,39 +111,6 @@ bool fetchStockAV(const char* sym, StockData& out) {
|
|||||||
// Drawing helpers
|
// Drawing helpers
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
|
|
||||||
// Circular refresh icon drawn with primitives (two arcs + two arrowheads)
|
|
||||||
void drawRefreshIcon(int x, int y, int sz) {
|
|
||||||
const float DEG2RAD = 3.14159265f / 180.0f;
|
|
||||||
int cx = x + sz / 2;
|
|
||||||
int cy = y + sz / 2;
|
|
||||||
int ro = sz * 9 / 20; // outer radius
|
|
||||||
int ri = sz * 5 / 20; // inner radius
|
|
||||||
float rm = (ro + ri) / 2.0f; // midline
|
|
||||||
float as = sz / 5.0f; // arrowhead size
|
|
||||||
|
|
||||||
// Two ~160° arcs with a small gap at top-right and bottom-left for arrowheads
|
|
||||||
M5.Display.fillArc(cx, cy, ro, ri, 200, 358, TFT_BLACK); // upper/left arc
|
|
||||||
M5.Display.fillArc(cx, cy, ro, ri, 22, 180, TFT_BLACK); // lower/right arc
|
|
||||||
|
|
||||||
// Arrowheads at 0° (top, pointing right) and 180° (bottom, pointing left)
|
|
||||||
for (int pass = 0; pass < 2; pass++) {
|
|
||||||
float a = (pass == 0 ? 0.0f : 180.0f) * DEG2RAD;
|
|
||||||
float sa = sinf(a), ca = cosf(a);
|
|
||||||
float px = cx + rm * sa, py = cy - rm * ca;
|
|
||||||
float tx = ca, ty = sa; // clockwise tangent
|
|
||||||
float rx = sa, ry = -ca; // outward radial
|
|
||||||
M5.Display.fillTriangle(
|
|
||||||
(int)(px + tx*as*0.7f),
|
|
||||||
(int)(py + ty*as*0.7f),
|
|
||||||
(int)(px - tx*as*0.5f + rx*as*0.6f),
|
|
||||||
(int)(py - ty*as*0.5f + ry*as*0.6f),
|
|
||||||
(int)(px - tx*as*0.5f - rx*as*0.6f),
|
|
||||||
(int)(py - ty*as*0.5f - ry*as*0.6f),
|
|
||||||
TFT_BLACK
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawUpArrow(int x, int y, int sz) {
|
void drawUpArrow(int x, int y, int sz) {
|
||||||
M5.Display.fillTriangle(x + sz / 2, y, x, y + sz, x + sz, y + sz, TFT_BLACK);
|
M5.Display.fillTriangle(x + sz / 2, y, x, y + sz, x + sz, y + sz, TFT_BLACK);
|
||||||
}
|
}
|
||||||
@@ -227,12 +194,11 @@ void setup() {
|
|||||||
M5.Display.setTextColor(TFT_BLACK, TFT_WHITE);
|
M5.Display.setTextColor(TFT_BLACK, TFT_WHITE);
|
||||||
M5.Display.setTextSize(2);
|
M5.Display.setTextSize(2);
|
||||||
|
|
||||||
// -- Row 1: refresh icon + timestamp (left) | "zZz [battery] xx%" (right) --
|
// -- Row 1: timestamp (left) | "zZz [battery] xx%" (right) --
|
||||||
drawRefreshIcon(20, 8, 46);
|
|
||||||
char timeStr[32];
|
char timeStr[32];
|
||||||
strftime(timeStr, sizeof(timeStr), "%d/%m %I:%M %p", &now);
|
strftime(timeStr, sizeof(timeStr), "%d/%m %I:%M %p", &now);
|
||||||
M5.Display.setCursor(74, 22);
|
M5.Display.setCursor(20, 22);
|
||||||
M5.Display.print(timeStr);
|
M5.Display.print("U: ");
|
||||||
M5.Display.print(timeStr);
|
M5.Display.print(timeStr);
|
||||||
|
|
||||||
M5.Display.setCursor(740, 15);
|
M5.Display.setCursor(740, 15);
|
||||||
|
|||||||
Reference in new issue
Block a user