Terminal Widget string length limitations

Hello, Blynkers!
I’d like to send a text string to a dot matrix display via Terminal Widget, but i can only send 31 cyrillic or 54 english characters (including spaces).
i spent a lot of time on THIS PROJECT, and now half of my idea is about to die, if there are limitations on string length… I’m trying to use this project to ‘page’ my hearing impaired mom using scroll bar, and 31 characters is just… well, nothing…
Is there a way to send more? Let’s say 256?
if my string exceeds the amounts i mentioned, the display remains blank…

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h> 
#include <BlynkSimpleEsp8266.h> 
char auth[] = "xxx"; 

int pinCS = 16;
int numberOfHorizontalDisplays = 1;
int numberOfVerticalDisplays = 4;

Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);

String tape = "";
int wait = 50; // In milliseconds

int spacer = 1; // 
int width = 5 + spacer; // The font width is 5 pixels 

/* Recode russian fonts from UTF-8 to Windows-1251 */

String utf8rus(String source)
{
  int i,k;
  String target;
  unsigned char n;
  char m[2] = { '0', '\0' };

  k = source.length(); i = 0;
  while (i < k) {
    n = source[i]; i++;
    if (n >= 0xC0) {
      switch (n) {
        case 0xD0: {
          n = source[i]; i++;
          if (n == 0x81) { n = 0xA8; break; }
          if (n >= 0x90 && n <= 0xBF) n = n + 0x2F;
          break;
        }
        case 0xD1: {
          n = source[i]; i++;
          if (n == 0x91) { n = 0xB7; break; }
          if (n >= 0x80 && n <= 0x8F) n = n + 0x6F;
          break;
        }
      }
    }
    m[0] = n; target = target + String(m);
  }
return target;
}

String Serial_Read() {
  unsigned char c; //
  String Serial_string = ""; //
  while (Serial.available() > 0) { //
    c = Serial.read(); //
    //Serial.print(c,HEX); Serial.print(" "); Serial.print(c);
    if (c == '\n') {  //
          return Serial_string; //
    }
    if (c == 0xB8) c = c - 0x01;  //
    if (c >= 0xBF && c <= 0xFF) c = c - 0x01;
    Serial_string = Serial_string + String(char(c)); //
  }
  return Serial_string; 
}


void setup() {
  Serial.begin(9600);
  matrix.setIntensity(3); // Use a value between 0 and 15 for brightness
  matrix.setRotation(matrix.getRotation()+1); //1 - 90  2 - 180   3 - 270
  matrix.fillScreen(LOW);
  matrix.write(); // Send bitmap to display
    WiFi.persistent(false);
    Blynk.begin(auth, "xxx", "xxx"); 
  while (Blynk.connect() == false) {
  }
}

BLYNK_WRITE(V12){
  if(param.asInt()==1){
  tape=utf8rus("Левая конфорка отключена");
  }if(param.asInt()==2){
  tape=utf8rus("Правая конфорка отключена");
  }
}



BLYNK_WRITE(V28){
  tape=utf8rus(param.asStr());
}

BLYNK_WRITE(V29){
  if(param.asInt()==1){
    tape=utf8rus(" ");
    //matrix.clear();
    
  }
}
void loop() {

  if (Serial.available()){
    tape=Serial_Read();
  } 
  for ( int i = 0 ; i < width * tape.length() + matrix.width() - 1 - spacer; i++ ) 
       {
    matrix.fillScreen(LOW);

    int letter = i / width; //
    int x = (matrix.width() - 1) - i % width;  
    int y = (matrix.height() - 8) / 2; // center the text vertically

    while ( x + width - spacer >= 0 && letter >= 0 ) {
      if ( letter < tape.length() ) {
        matrix.drawChar(x, y, tape[letter], HIGH, LOW,1);
      }
      letter--;
      x -= width;
    }
    matrix.write(); // Send bitmap to display
    delay(wait);
  }
  Blynk.run();
}

You can send emails of at least 1200 characters. Maybe you could use this as a work around.

2 Likes

Hello. Please try this http://docs.blynk.cc/#widgets-notifications-increasing-message-length-limit

Let me know if that helps.

1 Like

Does this work for Terminal as well as Email?

@Costas I think it may help. However I’m not sure. @vshymanskyy should know.

Yes it should work for Terminal too!

Including the line

#define BLYNK_MAX_SENDBYTES 256 // Default is 128

and even 512 didn’t help.
The problem is not Terminal. It looks like Bridge truncates the string: I tried to send a long string of text via Terminal Widget directly, without using Bridge, and it runs at full length… But the idea was to use Bridge to avoid switching control panels between two projects… A couple of months ago you guys asked why nobody uses Bridge… So here i am trying :rolling_eyes:

Can it be fixed?

Confirmed. Will be fixed soon…

1 Like

i almost gave up on this!
YOU ARE THE BEST!

is it gonna be fixed on the app side (with a new release, i suppose),
or somewhere on your servers?

@iGonch I think you can just take latest library from github.

Here is a fix - https://github.com/blynkkk/blynk-library/commit/afff811a09dd7cd469972d02ea931dda96400450

1 Like

Hi. I’ve changed the contents of Widget Bridge.h to the contents of the fix you provided. Restarted Arduino, uploaded my sketch with the code line you suggested
I assume it’s in the right place.

include <binary.h>
#include <Sprite.h>
#include <Thread.h>
#include <Matrix.h>
#define BLYNK_MAX_SENDBYTES 512 // Default is 128
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h> 
#include <BlynkSimpleEsp8266.h> 

But the result remains the same. Here’s the contents of Serial Monitor.
Please click on the links: there are 4 videos with comments on each string that i sent.
Strings without links appear ok because they have less than 31 cyrillic or 54 english characters.

Ȥl���l$��$:x��[258] Connecting to MaxNet
[4261] Connected to WiFi
[4261] IP: 192.168.0.22
[4261] Blynk v0.3.8 on Arduino
[5001] Connecting to blynk-cloud.com:8442
[5126] Ready (ping: 1ms).

йцукенгшщ фывапр��лд ячсмитьбю
йцукенгшщ фывапр��дж ячсмитьбю й
йцукенгшщ ячсмит��бю йцукенгшщ я
йцукенгшщ фывапр
йцукенгшщ фывапр олджэ
съешь еще этих мя��ких французских ��улок
qwertyuio asdfghjkl zxcvbnmzx
qwertyuio asdfghjkl zxcvbnmzx qwertyuio asdfghjkl zxcv
qwertyuio asdfghjkl zxcvbnmzx qwertyuio asdfghjkl zxcvb

If i send the text directly from the terminal of second (bridged) device, text appear fine, no matter how long it is, and no matter what language it is.
I have a feeling that these 16 character intervals have to do smth with the problem
What am i doing wrong?
Thanks!