v0.9.368
This commit is contained in:
60
yoRadio/src/main.cpp
Normal file
60
yoRadio/src/main.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "Arduino.h"
|
||||
#include "core/options.h"
|
||||
#include "core/config.h"
|
||||
#include "core/telnet.h"
|
||||
#include "core/player.h"
|
||||
#include "core/display.h"
|
||||
#include "core/network.h"
|
||||
#include "core/netserver.h"
|
||||
#include "core/controls.h"
|
||||
#include "core/mqtt.h"
|
||||
#include "core/optionschecker.h"
|
||||
|
||||
extern __attribute__((weak)) void yoradio_on_setup();
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
if(REAL_LEDBUILTIN!=255) pinMode(REAL_LEDBUILTIN, OUTPUT);
|
||||
if (yoradio_on_setup) yoradio_on_setup();
|
||||
pm.on_setup();
|
||||
config.init();
|
||||
display.init();
|
||||
player.init();
|
||||
network.begin();
|
||||
if (network.status != CONNECTED && network.status!=SDREADY) {
|
||||
netserver.begin();
|
||||
initControls();
|
||||
display.putRequest(DSP_START);
|
||||
while(!display.ready()) delay(10);
|
||||
return;
|
||||
}
|
||||
if(SDC_CS!=255) {
|
||||
display.putRequest(WAITFORSD, 0);
|
||||
Serial.print("##[BOOT]#\tSD search\t");
|
||||
}
|
||||
config.initPlaylistMode();
|
||||
netserver.begin();
|
||||
telnet.begin();
|
||||
initControls();
|
||||
display.putRequest(DSP_START);
|
||||
while(!display.ready()) delay(10);
|
||||
#ifdef MQTT_ROOT_TOPIC
|
||||
mqttInit();
|
||||
#endif
|
||||
if (config.getMode()==PM_SDCARD) player.initHeaders(config.station.url);
|
||||
player.lockOutput=false;
|
||||
if (config.store.smartstart == 1) player.sendCommand({PR_PLAY, config.lastStation()});
|
||||
pm.on_end_setup();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
telnet.loop();
|
||||
if (network.status == CONNECTED || network.status==SDREADY) {
|
||||
player.loop();
|
||||
//loopControls();
|
||||
}
|
||||
loopControls();
|
||||
netserver.loop();
|
||||
}
|
||||
|
||||
#include "core/audiohandlers.h"
|
||||
Reference in New Issue
Block a user