v0.6.010
This commit is contained in:
@@ -11,6 +11,13 @@
|
||||
#include "controls.h"
|
||||
#include "mqtt.h"
|
||||
|
||||
#if CORE_FOR_LOOP_CONTROLS != 255
|
||||
TaskHandle_t TaskCore0;
|
||||
#ifndef CORE_FOR_LOOP_STACK_SIZE
|
||||
#define CORE_FOR_LOOP_STACK_SIZE 16384
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
@@ -18,30 +25,66 @@ void setup() {
|
||||
config.init();
|
||||
display.init();
|
||||
player.init();
|
||||
player.setOutputPins(false);
|
||||
network.begin();
|
||||
if (network.status != CONNECTED) {
|
||||
netserver.begin();
|
||||
display.start();
|
||||
return;
|
||||
}
|
||||
initControls();
|
||||
netserver.begin();
|
||||
telnet.begin();
|
||||
player.setVol(config.store.volume, true);
|
||||
display.start();
|
||||
if(config.store.smartstart==1) player.play(config.store.lastStation);
|
||||
if(CORE_FOR_LOOP_CONTROLS == 255){
|
||||
initControls();
|
||||
display.start();
|
||||
}
|
||||
|
||||
#ifdef MQTT_HOST
|
||||
mqttInit();
|
||||
#endif
|
||||
|
||||
#if CORE_FOR_LOOP_CONTROLS != 255
|
||||
BaseType_t coreId = xPortGetCoreID();
|
||||
BaseType_t newCoreId = (CORE_FOR_LOOP_CONTROLS==2)?!coreId:CORE_FOR_LOOP_CONTROLS;
|
||||
xTaskCreatePinnedToCore(
|
||||
loopCore0, /* Task function. */
|
||||
"TaskCore0", /* name of task. */
|
||||
CORE_FOR_LOOP_STACK_SIZE, /* Stack size of task */
|
||||
NULL, /* parameter of the task */
|
||||
1, /* priority of the task */
|
||||
&TaskCore0, /* Task handle to keep track of created task */
|
||||
newCoreId); /* pin task to core CORE_FOR_LOOP_CONTROLS */
|
||||
#endif
|
||||
|
||||
delay(500);
|
||||
if(config.store.smartstart==1) player.play(config.store.lastStation);
|
||||
}
|
||||
|
||||
#if CORE_FOR_LOOP_CONTROLS != 255
|
||||
void setupCore0(){
|
||||
initControls();
|
||||
display.start();
|
||||
}
|
||||
|
||||
void loopCore0( void * pvParameters ){
|
||||
setupCore0();
|
||||
for(;;){
|
||||
micros();
|
||||
if (network.status == CONNECTED) {
|
||||
loopControls();
|
||||
}
|
||||
display.loop();
|
||||
vTaskDelay(10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void loop() {
|
||||
if (network.status == CONNECTED) {
|
||||
telnet.loop();
|
||||
player.loop();
|
||||
loopControls();
|
||||
if(CORE_FOR_LOOP_CONTROLS==255) loopControls();
|
||||
}
|
||||
display.loop();
|
||||
if(CORE_FOR_LOOP_CONTROLS==255 || network.status != CONNECTED) display.loop();
|
||||
netserver.loop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user