|
57 | 57 | //#include <GxGDEW0213Z16/GxGDEW0213Z16.h> // 2.13" b/w/r
|
58 | 58 | //#include <GxGDEH029A1/GxGDEH029A1.h> // 2.9" b/w
|
59 | 59 | //#include <GxGDEW029T5/GxGDEW029T5.h> // 2.9" b/w IL0373
|
| 60 | +//#include <GxGDEM029T94/GxGDEM029T94.h> // 2.9" b/w |
60 | 61 | //#include <GxGDEW029Z10/GxGDEW029Z10.h> // 2.9" b/w/r
|
61 | 62 | //#include <GxGDEW026T0/GxGDEW026T0.h> // 2.6" b/w
|
62 | 63 | //#include <GxGDEW027C44/GxGDEW027C44.h> // 2.7" b/w/r
|
@@ -105,16 +106,41 @@ const char* ssid = "........";
|
105 | 106 | const char* password = "........";
|
106 | 107 | const int httpPort = 80;
|
107 | 108 | const int httpsPort = 443;
|
108 |
| -const char* fp_api_github.com = "35 85 74 EF 67 35 A7 CE 40 69 50 F3 C0 F6 80 CF 80 3B 2E 19"; |
109 |
| -const char* fp_github.com = "ca 06 f5 6b 25 8b 7a 0d 4f 2b 05 47 09 39 47 86 51 15 19 84"; |
110 |
| -#if USE_BearSSL |
111 |
| -const char fp_rawcontent[20] = {0xcc, 0xaa, 0x48, 0x48, 0x66, 0x46, 0x0e, 0x91, 0x53, 0x2c, 0x9c, 0x7c, 0x23, 0x2a, 0xb1, 0x74, 0x4d, 0x29, 0x9d, 0x33}; |
112 |
| -#else |
113 |
| -const char* fp_rawcontent = "cc aa 48 48 66 46 0e 91 53 2c 9c 7c 23 2a b1 74 4d 29 9d 33"; |
114 |
| -#endif |
| 109 | +const char* fp_api_github.com = "df b2 29 c6 a6 38 1a 59 9d c9 ad 92 2d 26 f5 3c 83 8f a5 87"; // as of 25.11.2020 |
| 110 | +const char* fp_github.com = "5f 3f 7a c2 56 9f 50 a4 66 76 47 c6 a1 8c a0 07 aa ed bb 8e"; // as of 25.11.2020 |
| 111 | +const char* fp_rawcontent = "70 94 de dd e6 c4 69 48 3a 92 70 a1 48 56 78 2d 18 64 e0 b7"; // as of 25.11.2020 |
| 112 | + |
| 113 | +// how to find the certificate was not easy. finally I found it using Mozilla Firefox. |
| 114 | +// opened one of the bitmaps, e.g. https://raw.githubusercontent.com/ZinggJM/GxEPD2/master/extras/bitmaps/logo200x200.bmp |
| 115 | +// clicked the lock symbol, Connection secure clicked >, show connection details, clicked More Information, clicked View Certificate, clicked Download PEM (chain), |
| 116 | +// selected Open with Notepad. Copied the middle certificate and editted to the following format: |
| 117 | +// the number of characters per line is of no importance, but the 3 \n are needed |
| 118 | +const char* certificate_rawcontent = |
| 119 | + "-----BEGIN CERTIFICATE-----\n" |
| 120 | + "MIIEsTCCA5mgAwIBAgIQBOHnpNxc8vNtwCtCuF0VnzANBgkqhkiG9w0BAQsFADBsMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGln" |
| 121 | + "aUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBS" |
| 122 | + "b290IENBMB4XDTEzMTAyMjEyMDAwMFoXDTI4MTAyMjEyMDAwMFowcDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IElu" |
| 123 | + "YzEZMBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTEvMC0GA1UEAxMmRGlnaUNlcnQgU0hBMiBIaWdoIEFzc3VyYW5jZSBTZXJ2ZXIg" |
| 124 | + "Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC24C/CJAbIbQRf1+8KZAayfSImZRauQkCbztyfn3YHPsMwVYcZuU+U" |
| 125 | + "DlqUH1VWtMICKq/QmO4LQNfE0DtyyBSe75CxEamu0si4QzrZCwvV1ZX1QK/IHe1NnF9Xt4ZQaJn1itrSxwUfqJfJ3KSxgoQtxq2l" |
| 126 | + "nMcZgqaFD15EWCo3j/018QsIJzJa9buLnqS9UdAn4t07QjOjBSjEuyjMmqwrIw14xnvmXnG3Sj4I+4G3FhahnSMSTeXXkgisdaSc" |
| 127 | + "us0Xsh5ENWV/UyU50RwKmmMbGZJ0aAo3wsJSSMs5WqK24V3B3aAguCGikyZvFEohQcftbZvySC/zA/WiaJJTL17jAgMBAAGjggFJ" |
| 128 | + "MIIBRTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwNAYI" |
| 129 | + "KwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wSwYDVR0fBEQwQjBAoD6gPIY6aHR0cDov" |
| 130 | + "L2NybDQuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0SGlnaEFzc3VyYW5jZUVWUm9vdENBLmNybDA9BgNVHSAENjA0MDIGBFUdIAAwKjAo" |
| 131 | + "BggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAdBgNVHQ4EFgQUUWj/kK8CB3U8zNllZGKiErhZcjswHwYD" |
| 132 | + "VR0jBBgwFoAUsT7DaQP4v0cB1JgmGggC72NkK8MwDQYJKoZIhvcNAQELBQADggEBABiKlYkD5m3fXPwdaOpKj4PWUS+Na0QWnqxj" |
| 133 | + "9dJubISZi6qBcYRb7TROsLd5kinMLYBq8I4g4Xmk/gNHE+r1hspZcX30BJZr01lYPf7TMSVcGDiEo+afgv2MW5gxTs14nhr9hctJ" |
| 134 | + "qvIni5ly/D6q1UEL2tU2ob8cbkdJf17ZSHwD2f2LSaCYJkJA69aSEaRkCldUxPUd1gJea6zuxICaEnL6VpPX/78whQYwvwt/Tv9X" |
| 135 | + "BZ0k7YXDK/umdaisLRbvfXknsuvCnQsH6qqF0wGjIChBWUMo0oHjqvbsezt3tkBigAVBRQHvFwY+3sAzm2fTYS5yh+Rp/BIAV0AecPUeybQ=\n" |
| 136 | + "-----END CERTIFICATE-----\n"; |
| 137 | + |
| 138 | + |
115 | 139 | const char* host_rawcontent = "raw.githubusercontent.com";
|
116 | 140 | const char* path_rawcontent = "/ZinggJM/GxEPD2/master/extras/bitmaps/";
|
117 | 141 | const char* path_prenticedavid = "/prenticedavid/MCUFRIEND_kbv/master/extras/bitmaps/";
|
| 142 | +const char* path_waveshare_c = "/waveshare/e-Paper/master/RaspberryPi_JetsonNano/c/pic/"; |
| 143 | +const char* path_waveshare_py = "/waveshare/e-Paper/master/RaspberryPi_JetsonNano/python/pic/"; |
118 | 144 |
|
119 | 145 | void showBitmapFrom_HTTP(const char* host, const char* path, const char* filename, int16_t x, int16_t y, bool with_color = true);
|
120 | 146 | void showBitmapFrom_HTTPS(const char* host, const char* path, const char* filename, const char* fingerprint, int16_t x, int16_t y, bool with_color = true);
|
@@ -241,11 +267,14 @@ void drawBitmaps_test()
|
241 | 267 | delay(2000);
|
242 | 268 | }
|
243 | 269 |
|
244 |
| -static const uint16_t input_buffer_pixels = 640; // may affect performance |
| 270 | +static const uint16_t input_buffer_pixels = 800; // may affect performance |
245 | 271 |
|
| 272 | +static const uint16_t max_row_width = 1448; // for up to 6" display 1448x1072 |
246 | 273 | static const uint16_t max_palette_pixels = 256; // for depth <= 8
|
247 | 274 |
|
248 | 275 | uint8_t input_buffer[3 * input_buffer_pixels]; // up to depth 24
|
| 276 | +uint8_t output_row_mono_buffer[max_row_width / 8]; // buffer for at least one row of b/w bits |
| 277 | +uint8_t output_row_color_buffer[max_row_width / 8]; // buffer for at least one row of color bits |
249 | 278 | uint8_t mono_palette_buffer[max_palette_pixels / 8]; // palette buffer for depth <= 8 b/w
|
250 | 279 | uint8_t color_palette_buffer[max_palette_pixels / 8]; // palette buffer for depth <= 8 c/w
|
251 | 280 |
|
@@ -485,28 +514,17 @@ void drawBitmapFrom_HTTPS_ToBuffer(const char* host, const char* path, const cha
|
485 | 514 | if ((x >= display.width()) || (y >= display.height())) return;
|
486 | 515 | display.fillScreen(GxEPD_WHITE);
|
487 | 516 | Serial.print("connecting to "); Serial.println(host);
|
488 |
| -#if USE_BearSSL |
489 |
| - if (fingerprint) client.setFingerprint((uint8_t*)fingerprint); |
| 517 | +#if defined (ESP8266) |
| 518 | + client.setBufferSizes(4096, 4096); // doesn't help |
| 519 | + if (fingerprint) client.setFingerprint(fingerprint); |
| 520 | +#elif defined (ESP32) |
| 521 | + if (certificate) client.setCACert(certificate); |
490 | 522 | #endif
|
491 | 523 | if (!client.connect(host, httpsPort))
|
492 | 524 | {
|
493 | 525 | Serial.println("connection failed");
|
494 | 526 | return;
|
495 | 527 | }
|
496 |
| -#if defined (ESP8266) && !USE_BearSSL |
497 |
| - if (fingerprint) |
498 |
| - { |
499 |
| - if (client.verify(fingerprint, host)) |
500 |
| - { |
501 |
| - Serial.println("certificate matches"); |
502 |
| - } |
503 |
| - else |
504 |
| - { |
505 |
| - Serial.println("certificate doesn't match"); |
506 |
| - return; |
507 |
| - } |
508 |
| - } |
509 |
| -#endif |
510 | 528 | Serial.print("requesting URL: ");
|
511 | 529 | Serial.println(String("https://") + host + path + filename);
|
512 | 530 | client.print(String("GET ") + path + filename + " HTTP/1.1\r\n" +
|
|
0 commit comments