Closed chard62 closed 2 weeks ago
The easiest way is as follows:
// global
String stationName = "";
_f_newStationName = false
void loop(){
...
if(_f_newStationName){ // station has changed
_f_newStationName = false;
if(stationName.startsWith,.....
......
}
}
void audio_showstation(const char* info) {
if(!info) return;
stationName = info;
SerialPrintfln("StationName: %s", info);
_f_newStationName = true;
}
YES! Thank you so much. The problem was that I was using char* when I should have used String! Being a c++ noob, I thought they were equivalent. Now I know something new, thanks to your help!
Closing now.
c++ noob here, sorry if this is the wrong place. If this is the right place, can you please offer some suggestions? If this is the wrong place, please suggest the best place to start.
I have a simple radio that is working, thanks to your great sample code. This is on an ESP32-S3-Zero (Waveshare). I'm using Platform IO as the IDE (in VS Code).
Now I am trying to save the station name and stream title in a string variable, inside the
audio_showstation()
andaudio_showstreamtitle()
functions. Here's a small snippet:You can see in the comments that when I use strcpy(), the ESP32 goes into a bootloop. When I try
station_name = "";,
c++ complains. If I just go ahead and compile with the loop code (last 5 lines), the serial port displays only partial error messages coming from audioI2S.platformio.ini: