Changed from ESP8266 to ESP32. Works much better.

HTTP server is disabled (for now).
This commit is contained in:
2019-11-11 05:32:41 +01:00
parent c313f6eb72
commit 2d1f049444
14 changed files with 249 additions and 180 deletions

View File

@ -5,12 +5,10 @@
#include "player.h"
#include "mqtt_client.h"
#include <MFRC522.h>
#include <Adafruit_MCP23017.h>
class Controller {
private:
MFRC522* _rfid;
Adafruit_MCP23017* _mcp;
SPIMaster* _spi;
MQTTClient* _mqtt_client;
bool _rfid_enabled = true;
@ -32,7 +30,7 @@ private:
unsigned long _last_mqtt_report_at = 0;
void _send_mqtt_report();
public:
Controller(Player* p, Adafruit_MCP23017* m, SPIMaster* s);
Controller(Player* p, SPIMaster* s);
void set_mqtt_client(MQTTClient* m);
String get_status_json();
void loop();

View File

@ -1,3 +1,4 @@
/*
#pragma once
#include <ESP8266WebServer.h>
#include "player.h"
@ -25,3 +26,4 @@ public:
HTTPServer(Player* p, Controller* c);
void loop();
};
*/

View File

@ -2,7 +2,7 @@
#include "config.h"
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
class MQTTClient {
private:

View File

@ -77,11 +77,10 @@ private:
uint8_t _volume;
uint16_t _stop_delay;
uint32_t _skip_to;
Adafruit_MCP23017* _mcp;
SPIMaster* _spi;
unsigned long _stopped_at;
public:
Player(Adafruit_MCP23017* m, SPIMaster* s);
Player(SPIMaster* s);
void vol_up();
void vol_down();
void track_next();

View File

@ -5,11 +5,8 @@
#include "config.h"
class SPIMaster {
private:
Adafruit_MCP23017* _mcp;
public:
SPIMaster(Adafruit_MCP23017* m) {
_mcp = m;
SPIMaster() {
PIN_SD_CS_SETUP();
PIN_VS1053_XCS_SETUP();
PIN_VS1053_XDCS_SETUP();

View File

@ -1,8 +0,0 @@
#include <Adafruit_MCP23017.h>
#include "config.h"
void print_mcp_status(Adafruit_MCP23017* mcp) {
DEBUG(" AAAAAAAA BBBBBBBB\n");
DEBUG(" 76543210 76543210\n");
DEBUG("State of MCP pins: %08s %08s\n", String(mcp->readGPIO(0), 2).c_str(), String(mcp->readGPIO(1), 2).c_str());
}