@@ -558,9 +558,6 @@ void Display::station() {
558558 nextion.newNameset (config.station .name );
559559 nextion.bitrate (config.station .bitrate );
560560 nextion.bitratePic (ICON_NA);
561- #endif
562- #ifdef DEBUG_TITLES
563- meta.setText (dsp.utf8Rus (" Utenim adminim veniam FM" , true ));
564561#endif
565562 // dsp.loop(true);
566563 // netserver.requestOnChange(STATION, 0);
@@ -570,44 +567,36 @@ void Display::returnTile() {
570567 meta.setText (dsp.utf8Rus (config.station .name , true ));
571568#ifdef USE_NEXTION
572569 nextion.newNameset (config.station .name );
573- #endif
574- #ifdef DEBUG_TITLES
575- meta.setText (dsp.utf8Rus (" Utenim adminim veniam FM" , true ));
576570#endif
577571 meta.reset ();
578572 // dsp.loop(true);
579573}
580574
575+ char *split (char *str, const char *delim) {
576+ char *dmp = strstr (str, delim);
577+ if (dmp == NULL ) return NULL ;
578+ *dmp = ' \0 ' ;
579+ return dmp + strlen (delim);
580+ }
581+
581582void Display::title () {
582- /*
583- memset(config.station.title, 0, BUFLEN);
584- strlcpy(config.station.title, str, BUFLEN);
585- */
586- char ttl[BUFLEN / 2 ] = { 0 };
587- char sng[BUFLEN / 2 ] = { 0 };
583+ DBGVB (" call of %s(), config.station.title=%s" , __func__, config.station .title );
588584 if (strlen (config.station .title ) > 0 ) {
589- char * ici;
590- if ((ici = strstr (config.station .title , " - " )) != NULL && TITLE_SIZE2 != 0 ) {
591- strlcpy (sng, ici + 3 , BUFLEN / 2 );
592- strlcpy (ttl, config.station .title , strlen (config.station .title ) - strlen (ici) + 1 );
593-
594- } else {
595- strlcpy (ttl, config.station .title , BUFLEN / 2 );
596- sng[0 ] = ' \0 ' ;
585+ char tmpbuf[strlen (config.station .title )+1 ];
586+ strlcpy (tmpbuf, config.station .title , strlen (config.station .title )+1 );
587+ char *stitle = split (tmpbuf, " - " );
588+ if (stitle && TITLE_SIZE2 != 0 ){
589+ title1.setText (dsp.utf8Rus (tmpbuf, true ));
590+ title2.setText (dsp.utf8Rus (stitle, true ));
591+ }else {
592+ title1.setText (dsp.utf8Rus (tmpbuf, true ));
593+ title2.setText (dsp.utf8Rus (" " , true ));
597594 }
598- #ifdef DEBUG_TITLES
599- strlcpy (ttl, " Duis aute irure dolor in reprehenderit in voluptate velit" , BUFLEN / 2 );
600- strlcpy (sng, " Excepteur sint occaecat cupidatat non proident" , BUFLEN / 2 );
601- #endif
602- title1.setText (dsp.utf8Rus (ttl, true ));
603- if (TITLE_SIZE2 != 0 ) title2.setText (dsp.utf8Rus (sng, true ));
604595#ifdef USE_NEXTION
605596 nextion.newTitle (config.station .title );
606597#endif
607- // dsp.loop(true);
608598 if (player_on_track_change) player_on_track_change ();
609599 }
610- // netserver.requestOnChange(TITLE, 0);
611600}
612601
613602void Display::heap () {
0 commit comments