35 int httpCode, ret = 0;
37 WiFiClientSecure *client =
new WiFiClientSecure;
38 client->setCACert(cert);
43 String get_url = url + ticker;
45 https.begin(*client, get_url.c_str());
46 https.addHeader(
"Content-Type",
"application/json", 0, 0);
48 httpCode = https.GET();
50 if (httpCode == HTTP_CODE_OK) {
52 DEBUG.printf(
"[HTTP] GET SUCCESS\r\n");
57 https.writeToStream(&parser);
59 DEBUG.printf(
"[HTTP] Failed, error: %s\r\n", https.errorToString(httpCode).c_str());
67 DEBUG.printf(
"[HTTP] COMPLETED \r\n");
74 uint16_t wt, ht, prev_height = 0, prev_width = 0;
75 const int16_t block_width = 100;
76 const int16_t block_height = 50;
79 const char dummy_price[] =
"USD 7.77777777";
84 display.setTextSize(1);
87 display.getTextBounds(F(
"Bitcoin"), 0, 0, &xt, &yt, &wt, &ht);
88 display.setCursor(x + 14, y + ht + 3);
89 display.print(ticker);
91 display.setFont(
font);
93 display.getTextBounds(dummy_price, 0, 0, &xt, &yt, &wt, &ht);
94 display.fillRoundRect(x + 5, y + 30, wt + 20, ht + 10, ht + 10,
secondary_color);
95 prev_width += x + 5 + wt + 20;
96 prev_height += y + 30;
100 display.getTextBounds(
price, 0, 0, &xt, &yt, &wt, &ht);
101 display.setCursor(5 + ((x + prev_width - wt) / 2), prev_height + ht + 4);
102 display.print(
price);
114 display.drawBitmap(prev_width, prev_height, arrow, 24, 24, color);
119 display.getTextBounds(
change, 0, 0, &xt, &yt, &wt, &ht);
120 display.setCursor(prev_width - wt, y + ht + 3);