how do I limit the display to only display the first four characters of the parameter to level enough space for the value?

Hi, I am not entirely new to arduino or OSC, but I am very much at the modifying scripts stage and slowing working things out. So any help is great appreciated

I am using a 128x128 tft screen.

Looking at the script the parameter OSC field is used for OSC and for the display.

This is great when it comes to Pan,Tilt, Zoom etc but becomes a mess once I get beyond 4 characters.

is there a way to limit the number of characters displayed, so Diff of Diffusion.

Alternatively could the labelling be done so that the display is separate to the parameter? so Gobo_Wheel_1 is Go 1 and GoR 1 for example?

Parents
  • If you are storing the incoming attribute name in a character array then you can truncate the array after the 4th caracter and display that.

  • HI Druuka, is there an example of that in your sketches?

  • I don't think I ave any exact examples... I set up my pages for specific attributes and built the labels in rather than reading the label coming from the console for the attribute.

    I am pasting some code that takes the incoming channel info and parses the channel number and the intensity out of it.

    int num; // general purpose integer
    int length = msg.getDataLength(0);
    msg.getString(0, currentChannel, length);
    strcpy (currentLevel, currentChannel);
    //Serial.println(currentChannel);
    //Serial.println(currentLevel);
    char * p = strchr (currentChannel, ' '); // search for space
    if (p) // if found truncate at space

    *p = 0;
    num = strlen(currentChannel);
    //Serial.println(num);
    memcpy(currentLevel,currentLevel+num, length);
    //Serial.println(currentChannel);
    //Serial.println(currentLevel);

    char * c;
    c = strchr (currentLevel, '[');
    str_replace(c, "[", "");

    char * d = strchr (currentLevel, ']'); // search for space
    if (d) // if found truncate at space
    *d = 0;

    char * b;
    b = strchr (currentLevel, ' ');
    str_replace(b, " ", "");

    There is a bit of code that goes with the str_replace bit as well but you probably won't need that for truncating

Reply
  • I don't think I ave any exact examples... I set up my pages for specific attributes and built the labels in rather than reading the label coming from the console for the attribute.

    I am pasting some code that takes the incoming channel info and parses the channel number and the intensity out of it.

    int num; // general purpose integer
    int length = msg.getDataLength(0);
    msg.getString(0, currentChannel, length);
    strcpy (currentLevel, currentChannel);
    //Serial.println(currentChannel);
    //Serial.println(currentLevel);
    char * p = strchr (currentChannel, ' '); // search for space
    if (p) // if found truncate at space

    *p = 0;
    num = strlen(currentChannel);
    //Serial.println(num);
    memcpy(currentLevel,currentLevel+num, length);
    //Serial.println(currentChannel);
    //Serial.println(currentLevel);

    char * c;
    c = strchr (currentLevel, '[');
    str_replace(c, "[", "");

    char * d = strchr (currentLevel, ']'); // search for space
    if (d) // if found truncate at space
    *d = 0;

    char * b;
    b = strchr (currentLevel, ' ');
    str_replace(b, " ", "");

    There is a bit of code that goes with the str_replace bit as well but you probably won't need that for truncating

Children
No Data