Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the size of icyname and streamtitle when using an OLED display #66

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,9 @@ void showstreamtitle ( const char *ml, bool full )
}
strcpy ( p1, p2 ) ; // Shift 2nd part of title 2 or 3 places
}
#if defined(OLED1306) || defined(OLED1306) || defined(OLED1106)
if (sizeof ( streamtitle ) > 64) streamtitle[64] = '\0' ;
#endif
tftset ( 1, streamtitle ) ; // Set screen segment text middle part
}

Expand Down Expand Up @@ -3592,6 +3595,7 @@ void handlebyte_ch ( uint8_t b )
static int LFcount ; // Detection of end of header
static bool ctseen = false ; // First line of header seen or not
static bool redirection = false ; // Redirection or not
uint8_t icyname_len = 0 ;

if ( chunked &&
( datamode & ( DATA | // Test op DATA handling
Expand Down Expand Up @@ -3711,6 +3715,10 @@ void handlebyte_ch ( uint8_t b )
icyname = metaline.substring(9) ; // Get station name
icyname = decode_spec_chars ( icyname ) ; // Decode special characters in name
icyname.trim() ; // Remove leading and trailing spaces
#if defined(OLED1306) || defined(OLED1306) || defined(OLED1106)
icyname_len = icyname.length();
if (icyname_len > 42) icyname = icyname.substring(0, 41);
#endif
tftset ( 2, icyname ) ; // Set screen segment bottom part
mqttpub.trigger ( MQTT_ICYNAME ) ; // Request publishing to MQTT
}
Expand Down