Start Wifi after initializing VS1053 - faster bootup when multiple tries setting up VS1053 are needed.
This commit is contained in:
parent
e28a541fe9
commit
429979c6d1
@ -30,7 +30,8 @@ private:
|
|||||||
unsigned long _last_mqtt_report_at = 0;
|
unsigned long _last_mqtt_report_at = 0;
|
||||||
void _send_mqtt_report();
|
void _send_mqtt_report();
|
||||||
public:
|
public:
|
||||||
Controller(Player* p, MCP* m, MQTTClient* mqtt);
|
Controller(Player* p, MCP* m);
|
||||||
|
void set_mqtt_client(MQTTClient* m);
|
||||||
String get_status_json();
|
String get_status_json();
|
||||||
void loop();
|
void loop();
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "spi_master.h"
|
#include "spi_master.h"
|
||||||
|
|
||||||
Controller::Controller(Player* p, MCP* m, MQTTClient* mqtt) {
|
Controller::Controller(Player* p, MCP* m) {
|
||||||
_player = p;
|
_player = p;
|
||||||
_mcp = m;
|
_mcp = m;
|
||||||
_mqtt_client = mqtt;
|
|
||||||
_rfid = new MFRC522(PIN_RC522_CS, MFRC522::UNUSED_PIN);
|
_rfid = new MFRC522(PIN_RC522_CS, MFRC522::UNUSED_PIN);
|
||||||
|
|
||||||
SPIMaster::enable(PIN_MCP);
|
SPIMaster::enable(PIN_MCP);
|
||||||
@ -25,6 +24,10 @@ Controller::Controller(Player* p, MCP* m, MQTTClient* mqtt) {
|
|||||||
for (uint8_t i=0; i<NUM_BUTTONS; i++) _button_last_pressed_at[i]=0;
|
for (uint8_t i=0; i<NUM_BUTTONS; i++) _button_last_pressed_at[i]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::set_mqtt_client(MQTTClient* m) {
|
||||||
|
_mqtt_client = m;
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::loop() {
|
void Controller::loop() {
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
if ((_last_rfid_scan_at < now - RFID_SCAN_INTERVAL) || (now < _last_rfid_scan_at)) {
|
if ((_last_rfid_scan_at < now - RFID_SCAN_INTERVAL) || (now < _last_rfid_scan_at)) {
|
||||||
@ -33,7 +36,7 @@ void Controller::loop() {
|
|||||||
}
|
}
|
||||||
_check_serial();
|
_check_serial();
|
||||||
_check_buttons();
|
_check_buttons();
|
||||||
|
|
||||||
if ((_last_mqtt_report_at < now - MQTT_REPORT_INTERVAL) || (now < _last_mqtt_report_at)) {
|
if ((_last_mqtt_report_at < now - MQTT_REPORT_INTERVAL) || (now < _last_mqtt_report_at)) {
|
||||||
_send_mqtt_report();
|
_send_mqtt_report();
|
||||||
_last_mqtt_report_at = now;
|
_last_mqtt_report_at = now;
|
||||||
|
Loading…
Reference in New Issue
Block a user