diff --git a/WebGUI.html b/WebGUI.html
index 6ae3d59..1dbc592 100644
--- a/WebGUI.html
+++ b/WebGUI.html
@@ -123,7 +123,25 @@
header[5] = 0;
socket.send(header);
- socket.send(pixelBuffer);
+
+ buf = new Uint8Array((xMax * yMax) / 8);
+
+ group = 0;
+ n = 0;
+ shift = 7;
+ for (pixel of pixelBuffer) {
+ group |= (pixel << shift);
+ shift--;
+
+ if (shift < 0) {
+ buf[n] = group;
+ group = 0;
+ shift = 7;
+ n++;
+ }
+ }
+
+ socket.send(buf);
}
function creatGUI()
diff --git a/src/ProtocolDL.cpp b/src/ProtocolDL.cpp
index 30a03b7..1a66911 100644
--- a/src/ProtocolDL.cpp
+++ b/src/ProtocolDL.cpp
@@ -45,22 +45,25 @@ void ProtocolDL::newByte(uint8_t data)
break;
default:
- image->set_pixel(source.x, source.y, data);
+ for (int shift = 7; shift >= 0; shift--) {
+ byte pixel = (data >> shift) & 1;
+ image->set_pixel(source.x, source.y, pixel);
- if(source.x == (source.width - 1) && source.y == (source.height - 1))
- {
- //this was the last pixel
- complete = true;
- cnt = 0;
- }
- else
- {
- source.x++;
- if (source.x >= source.width) {
- source.x = 0;
- source.y++;
- if (source.y >= source.height) {
- source.y = 0;
+ if(source.x == (source.width - 1) && source.y == (source.height - 1))
+ {
+ //this was the last pixel
+ complete = true;
+ cnt = 0;
+ }
+ else
+ {
+ source.x++;
+ if (source.x >= source.width) {
+ source.x = 0;
+ source.y++;
+ if (source.y >= source.height) {
+ source.y = 0;
+ }
}
}
}