@@ -233,19 +233,18 @@ bool arduinoVNC::read_from_rfb_server(int sock, char *out, size_t n) {
233
233
*/
234
234
while (n > 0 ) {
235
235
if (!TCPclient.connected ()) {
236
- DEBUG_VNC (" [read_from_rfb_server] Receive not connected - 1 !\n " );
236
+ DEBUG_VNC (" [read_from_rfb_server] not connected!\n " );
237
237
return false ;
238
238
}
239
- while (!TCPclient.available ()) {
240
- if (!TCPclient.connected ()) {
241
- DEBUG_VNC (" [read_from_rfb_server] Receive not connected - 2!\n " );
242
- return false ;
243
- }
244
- if ((millis () - t) > VNC_TCP_TIMEOUT) {
245
- DEBUG_VNC (" [read_from_rfb_server] Receive TIMEOUT!\n " );
246
- return false ;
247
- }
239
+
240
+ if ((millis () - t) > VNC_TCP_TIMEOUT) {
241
+ DEBUG_VNC (" [read_from_rfb_server] receive TIMEOUT!\n " );
242
+ return false ;
243
+ }
244
+
245
+ if (!TCPclient.available ()) {
248
246
delay (0 );
247
+ continue ;
249
248
}
250
249
251
250
len = TCPclient.read ((uint8_t *) out, n);
@@ -1215,7 +1214,7 @@ bool arduinoVNC::_handle_hextile_encoded_message(rfbFramebufferUpdateRectHeader
1215
1214
}
1216
1215
}
1217
1216
1218
- // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] subrect: x: %d y: %d w: %d h: %d\n", rect_xW, rect_yW, tile_w, tile_h);
1217
+ // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] subrect: x: %d y: %d w: %d h: %d\n", rect_xW, rect_yW, tile_w, tile_h);
1219
1218
1220
1219
#ifdef VNC_FRAMEBUFFER
1221
1220
if (!fb.begin (tile_w, tile_h)) {
@@ -1247,7 +1246,7 @@ bool arduinoVNC::_handle_hextile_encoded_message(rfbFramebufferUpdateRectHeader
1247
1246
1248
1247
HextileSubrectsColoured_t * bufPC = (HextileSubrectsColoured_t *) buf;
1249
1248
for (uint8_t n = 0 ; n < nr_subr; n++) {
1250
- // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] Coloured nr_subr: %d bufPC: 0x%08X\n", n, bufPC);
1249
+ // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] Coloured nr_subr: %d bufPC: 0x%08X\n", n, bufPC);
1251
1250
#ifdef VNC_FRAMEBUFFER
1252
1251
fb.draw_rect (bufPC->x , bufPC->y , bufPC->w + 1 , bufPC->h + 1 , bufPC->color );
1253
1252
#else
@@ -1265,7 +1264,7 @@ bool arduinoVNC::_handle_hextile_encoded_message(rfbFramebufferUpdateRectHeader
1265
1264
HextileSubrects_t * bufP = (HextileSubrects_t *) buf;
1266
1265
for (uint8_t n = 0 ; n < nr_subr; n++) {
1267
1266
1268
- // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] nr_subr: %d bufP: 0x%08X\n", n, bufP);
1267
+ // DEBUG_VNC_HEXTILE("[_handle_hextile_encoded_message] nr_subr: %d bufP: 0x%08X\n", n, bufP);
1269
1268
#ifdef VNC_FRAMEBUFFER
1270
1269
fb.draw_rect (bufP->x , bufP->y , bufP->w + 1 , bufP->h + 1 , fgColor);
1271
1270
#else
0 commit comments