if(R_Encoder_Active !=0)
{
if(R_Encoder_Active ==1)
{
switch (radio_mode)
{
case 0: rx.seek(RDA_SEEK_WRAP, RDA_SEEK_UP, showStatus); break;
case 1: rx.setVolumeUp(); break;
case 2: rx.setFrequencyUp(); break;
default:break;
}
}
else
{
switch (radio_mode)
{
case 0: rx.seek(RDA_SEEK_WRAP, RDA_SEEK_DOWN, showStatus); break;
case 1: rx.setVolumeDown(); break;
case 2: rx.setFrequencyDown(); break;
default:break;
}
}
R_Encoder_Active =0;
update_Fre();
update_Rss();
}
if(Button_Active == 1)
{
radio_mode++;
Button_Active = 0;
update_Fre();
update_Rss();
if(radio_mode>5) radio_mode = 0;
tft.fillRect(80,40,32,14,Display_Backround_Color);
tft.setTextSize(2);
tft.setCursor(90,40);
tft.print(String(radio_mode));
}
大家看看,是不是这么写,比较合理。
|