@hevet, Corrected. Thank you. I have already uploaded the new files. As you can see, despite many tests, sometimes I miss something.
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamrobgold wrote:.Yes, they should be on the encoder PCB. I left a place for them on my PCB just in case I use the encoder itself, but correctly they should be as close as possible to the place where the "pins" are created, i.e. at the encoder itself. If you unplug the encoder then these lines are unconnected. The only thing that may remain is a 100nF capacitor between 3.3V and GND for the encoder power supply line.
void displayDimmerTimer()
{
displayDimmerTimeCounter++;
if (displayActive == true)
{
displayDimmerTimeCounter = 0;
displayDimmer(0);
}
if (displayDimmerTimeCounter >= displayAutoDimmerTime)
{
displayDimmer(1); // wywolujemy funkcje przyciemnienia z parametrem 1 (załacz)
displayDimmerTimeCounter = 0;
}
}
void displayDimmerTimer()
{
displayDimmerTimeCounter++;
if (displayActive == true)
{
displayDimmerTimeCounter = 0;
u8g2.setPowerSave(0); // wybudzamymy wyświetlacz z trybu oszczędzania energii
u8g2.setContrast(128); // ustawiamy kontrast wyświetlacza w wartościach 0 - 255
displayDimmer(0);
}
if (displayDimmerTimeCounter >= displayAutoDimmerTime)
{
displayDimmer(1); // wywolujemy funkcje przyciemnienia z parametrem 1 (załacz)
u8g2.setContrast(30); // ustawiamy kontrast w wartościach 0 - 255.
}
if (displayDimmerTimeCounter >= 120) // po 120 sekundach wyświetlacz przełączamy w tryb oszczędzania energii (wyłączamy), wartości w przedziale 0-255.
{
u8g2.setPowerSave(1);
}
}
if (stationNameStream == "") // jezeli nie ma równiez stationName
{
stationStringScroll = "---" ;
} // wstawiamy trzy kreseczki do wyswietlenia
if (stationNameStream == "") // jezeli nie ma równiez stationName
{
stationStringScroll = String(StationNrStr) + "." + stationName; //wstawiamy nr stacji + nazwę stacji
}
robgold wrote:.Clock:
Wollie's library does not allow you to mix audio from the stream along with telling the time. You have to turn one off and run the other. Even someone recently asked this question on GitHub -> Link. To make this cool you would have to slowly mute the audio, turn off the stream , read the time and turn on the stream. The problem is that often turning the stream back on will start playing ads. To think about.
Is it possible to squeeze these lines in your code somewhere - and the clock will chatter every hour or is that not so easy for a layman?
void loop() {
audio.loop();
if(sec1 < millis()){ // every second
sec1 = millis() + 1000;
time_s = gettime_s();
Serial.println(time_s);
if(time_s.endsWith("00:00")){ // time announcement every full hour
char am_pm[5] = "am."
int h = time_s.substring(0,2).toInt();
if(h > 12){h -= 12; strcpy(am_pm, "pm.");}
sprintf(chbuf, "It is now %i%s and %i minutes", h, am_pm, time_s.substring(3,5).toInt());
Serial.println(chbuf);
audio.connecttospeech(chbuf, "en");
}
}
}
//------------------EVENTS----------------------------------------------------------------------------------------------
void audio_info(const char *info){
Serial.printf("info: %sn", info);
}
Casing:
Very nicely that top casing came out of that 'carbon' plate. Print yourself an IR window on a smooth plate and cover it with a piece of car window tinting film. It won't be visible. Did you print with PLA or PETG ?
else if ((currentOption == INTERNET_RADIO) && (timeDisplay == true) && (audio.isRunning() == false))
{
// Struktura przechowująca informacje o czasie
struct tm timeinfo;
if (!getLocalTime(&timeinfo, 5))
{
Serial.println("Nie udało się uzyskać czasu");
return; // Zakończ funkcję, gdy nie udało się uzyskać czasu
}
char timeString[9]; // Bufor przechowujący czas w formie tekstowej
snprintf(timeString, sizeof(timeString), "%02d:%02d:%02d", timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
u8g2.setFont(spleen6x12PL);
u8g2.drawStr(0, 63, " ");
if (millis() - lastCheckTime >= 1000)
{
u8g2.drawStr(0, 63, "... No audio stream ! ...");
lastCheckTime = millis(); // Zaktualizuj czas ostatniego sprawdzenia
}
u8g2.drawStr(208, 63, timeString);
}
else if ((currentOption == INTERNET_RADIO) && (timeDisplay == true) && (audio.isRunning() == false))
{
// Struktura przechowująca informacje o czasie
struct tm timeinfo;
if (!getLocalTime(&timeinfo, 5))
{
Serial.println("Nie udało się uzyskać czasu");
return; // Zakończ funkcję, gdy nie udało się uzyskać czasu
}
char timeString[9]; // Bufor przechowujący czas w formie tekstowej
snprintf(timeString, sizeof(timeString), "%02d:%02d:%02d", timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
u8g2.setFont(spleen6x12PL);
int x, y;
if (displayMode == 0 || displayMode == 2) {
x = 0;
y = 63;
} else if (displayMode == 1) {
x = 50;
y = 33;
}
u8g2.drawStr(x, y, " ");
if (millis() - lastCheckTime >= 1000) {
u8g2.drawStr(x, y, "... No audio stream ! ...");
lastCheckTime = millis(); // Zaktualizuj czas ostatniego sprawdzenia
}
u8g2.drawStr(208, 63, timeString);
}