Przeglądaj źródła

Update inversion in firmware.

Cody Tolene 2 lat temu
rodzic
commit
80cb79395a

+ 4 - 4
src-firmware/esp32_cam_uart_stream/esp32_cam_uart_stream.ino

@@ -204,13 +204,13 @@ void processImage(camera_fb_t* frameBuffer) {
         for(uint8_t bit = 0; bit < 8; ++bit) {
              // Check the invert flag and pack the pixels accordingly.
             if(invert) {
-                // If invert is true, consider pixel as 1 if it's less than 127.
-                if(frameBuffer->buf[true_y + x + bit] < 127) {
+                // If invert is true, consider pixel as 1 if it's more than 127.
+                if(frameBuffer->buf[true_y + x + bit] > 127) {
                     packed_pixels |= (1 << (7 - bit));
                 }
             } else {
-                // If invert is false, consider pixel as 1 if it's more than 127.
-                if(frameBuffer->buf[true_y + x + bit] > 127) {
+                // If invert is false, consider pixel as 1 if it's less than 127.
+                if(frameBuffer->buf[true_y + x + bit] < 127) {
                     packed_pixels |= (1 << (7 - bit));
                 }
             }