Add style check matching RP2040 core (#740)
Will let us backport the BackgroundAudio patches to libhelix easier and clean up some ugly formatting we've let develop.
This commit is contained in:
1 parent
62dd23a74a
commit
f9e72dbb21
434 files changed
+94604
-93082
No files matched your search
@@ -4,9 +4,9 @@ void setup() {}
|
||||
void loop() {}
|
||||
#else
|
||||
#if defined(ESP32)
|
||||
#include <WiFi.h>
|
||||
#include <WiFi.h>
|
||||
#else
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#endif
|
||||
#include "AudioFileSourceICYStream.h"
|
||||
#include "AudioFileSourceSPIRAMBuffer.h"
|
||||
@@ -25,7 +25,7 @@ const char* ssid = STASSID;
|
||||
const char* password = STAPSK;
|
||||
|
||||
// Randomly picked URL
|
||||
const char *URL="http://kvbstreams.dyndns.org:8000/wkvi-am";
|
||||
const char *URL = "http://kvbstreams.dyndns.org:8000/wkvi-am";
|
||||
|
||||
AudioGeneratorMP3 *mp3;
|
||||
AudioFileSourceICYStream *file;
|
||||
@@ -33,8 +33,7 @@ AudioFileSourceSPIRAMBuffer *buff;
|
||||
AudioOutputI2SNoDAC *out;
|
||||
|
||||
// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
|
||||
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
|
||||
{
|
||||
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string) {
|
||||
const char *ptr = reinterpret_cast<const char *>(cbData);
|
||||
(void) isUnicode; // Punt this ball for now
|
||||
// Note that the type and string may be in PROGMEM, so copy them to RAM for printf
|
||||
@@ -44,8 +43,7 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, const char *stri
|
||||
|
||||
|
||||
// Called when there's a warning or error (like a buffer underflow or decode hiccup)
|
||||
void StatusCallback(void *cbData, int code, const char *string)
|
||||
{
|
||||
void StatusCallback(void *cbData, int code, const char *string) {
|
||||
const char *ptr = reinterpret_cast<const char *>(cbData);
|
||||
static uint32_t lastTime = 0;
|
||||
static int lastCode = -99999;
|
||||
@@ -58,8 +56,7 @@ void StatusCallback(void *cbData, int code, const char *string)
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(1000);
|
||||
Serial.println("Connecting to WiFi");
|
||||
@@ -67,7 +64,7 @@ void setup()
|
||||
WiFi.disconnect();
|
||||
WiFi.softAPdisconnect(true);
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
|
||||
WiFi.begin(ssid, password);
|
||||
|
||||
// Try forever
|
||||
@@ -81,7 +78,7 @@ void setup()
|
||||
file = new AudioFileSourceICYStream(URL);
|
||||
file->RegisterMetadataCB(MDCallback, (void*)"ICY");
|
||||
// Initialize 23LC1024 SPI RAM buffer with chip select ion GPIO4 and ram size of 128KByte
|
||||
buff = new AudioFileSourceSPIRAMBuffer(file, 4, 128*1024);
|
||||
buff = new AudioFileSourceSPIRAMBuffer(file, 4, 128 * 1024);
|
||||
buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
|
||||
out = new AudioOutputI2SNoDAC();
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
@@ -89,17 +86,18 @@ void setup()
|
||||
mp3->begin(buff, out);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
static int lastms = 0;
|
||||
|
||||
if (mp3->isRunning()) {
|
||||
if (millis()-lastms > 1000) {
|
||||
if (millis() - lastms > 1000) {
|
||||
lastms = millis();
|
||||
Serial.printf("Running for %d ms...\n", lastms);
|
||||
Serial.flush();
|
||||
}
|
||||
if (!mp3->loop()) mp3->stop();
|
||||
}
|
||||
if (!mp3->loop()) {
|
||||
mp3->stop();
|
||||
}
|
||||
} else {
|
||||
Serial.printf("MP3 done\n");
|
||||
delay(1000);
|
||||
|
||||
Reference in new issue
Block a user