Skip to content

Commit

Permalink
Merge pull request #74 from Romkabouter/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Romkabouter authored Oct 20, 2021
2 parents 24bbf1b + 6244d5d commit 017a3c4
Show file tree
Hide file tree
Showing 13 changed files with 946 additions and 199 deletions.
5 changes: 5 additions & 0 deletions Esp32-poe-iso.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Get Started for ESP32 POE ISO
- Set the device_type to 5 in the settings.ini
- Connect the device to your computer via USB, like a regular esp32
- First flash, set "upload" as method under the OTA section in the settings.ini. After that you can set it to "ota" as well
- Build and flash the project with PlatformIO, for example run `pio run --target upload` from the commandline
3 changes: 2 additions & 1 deletion PlatformIO/load_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
("MQTT_PASS", "\\\"" + config[sectionMqtt]["password"] + "\\\""),
("MQTT_MAX_PACKET_SIZE", 2000),
("CONFIG_ASYNC_TCP_RUNNING_CORE", 1),
("DEVICE_TYPE", config[sectionGeneral]["device_type"])
("DEVICE_TYPE", config[sectionGeneral]["device_type"]),
("NETWORK_TYPE", config[sectionGeneral]["network_type"])
]

# MQTT "ip" was replaced with "hostname" that can now be an IP or a DNS hostname of the MQTT server
Expand Down
12 changes: 11 additions & 1 deletion PlatformIO/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ default_envs = esp32dev
build_flags =
'-DFIXED_POINT=1'
'-DOUTSIDE_SPEEX=1'

[env]
extra_scripts = pre:load_settings.py
platform = espressif32
upload_speed = 115200
;upload_port = /dev/ttyUSB5
board = esp32dev
;board = esp32-poe-iso
framework = arduino
board_build.partitions = ../OTABuilder/partitions_two_ota.csv
build_flags = ${common.build_flags}
Expand All @@ -37,6 +39,8 @@ lib_deps =
m5stack/M5Atom
fastled/FastLED
yveaux/AC101 @ ^0.0.1
celliesprojects/wm8978-esp32
makuna/NeoPixelBus


[env:esp32dev]
Expand All @@ -58,3 +62,9 @@ build_flags = ${env.build_flags} -DPI_DEVICE_TYPE=3

[env:inmp441Mmax98357a]
build_flags = ${env.build_flags} -DPI_DEVICE_TYPE=4

[env:esp32-poe-iso]
build_flags = ${env.build_flags} -DPI_DEVICE_TYPE=5

[env:taudio]
build_flags = ${env.build_flags} -DPI_DEVICE_TYPE=6
2 changes: 1 addition & 1 deletion PlatformIO/settings.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
hostname=192.168.43.140
deployhost=192.168.43.24
siteId=satellite
;supported: M5ATOMECHO=0, MATRIXVOICE=1, AUDIOKIT=2, INMP441=3, INMP441MAX98357A=4
;supported: M5ATOMECHO=0, MATRIXVOICE=1, AUDIOKIT=2, INMP441=3, INMP441MAX98357A=4, ESP32_POE_ISO=5, TAUDIO=6
device_type=4
;network_type: 0: WiFi, 1: Ethernet
network_type=0
Expand Down
16 changes: 14 additions & 2 deletions PlatformIO/src/General.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

#include <tinyfsm.hpp>
#include <Arduino.h>
#include <WiFi.h>

#if NETWORK_TYPE == NETWORK_ETHERNET
#include <ETH.h>
#else
#include <WiFi.h>
#endif

#include <AsyncMqttClient.h>
#include <PubSubClient.h>
#include "SPIFFS.h"
Expand Down Expand Up @@ -71,6 +77,8 @@ std::string audioTopic = config.siteid + std::string("/audio");
std::string ledTopic = config.siteid + std::string("/led");
std::string debugTopic = config.siteid + std::string("/debug");
std::string restartTopic = config.siteid + std::string("/restart");
std::string sayTopic = "hermes/tts/say";
std::string sayFinishedTopic = "hermes/tts/sayFinished";
AsyncMqttClient asyncClient;
WiFiClient net;
PubSubClient audioServer(net);
Expand All @@ -88,13 +96,17 @@ struct WifiDisconnected;
struct MQTTDisconnected;
struct HotwordDetected;
struct Idle;
struct Speaking;
struct Updating;
struct PlayAudio;

struct WifiDisconnectEvent : tinyfsm::Event { };
struct WifiConnectEvent : tinyfsm::Event { };
struct MQTTDisconnectedEvent : tinyfsm::Event { };
struct MQTTConnectedEvent : tinyfsm::Event { };
struct IdleEvent : tinyfsm::Event { };
struct SpeakEvent : tinyfsm::Event { };
struct OtaEvent : tinyfsm::Event { };
struct StreamAudioEvent : tinyfsm::Event { };
struct PlayAudioEvent : tinyfsm::Event {};
struct HotwordDetectedEvent : tinyfsm::Event { };
Expand Down Expand Up @@ -351,4 +363,4 @@ void saveConfiguration(const char *filename, Config &config) {
Serial.println(F("Failed to write to file"));
}
file.close();
}
}
23 changes: 22 additions & 1 deletion PlatformIO/src/Satellite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,33 @@
- Adding better logic for saving settings in webUI
- Add actual hardware capabilities in webUI
- Restructure AudioKit code
v7.7
- Added ESP32_POE_ISO and TAUDIO
- Added animation function, work in progress
- Added Speaking state for animation preparation (works for matrixvoice)
* ************************************************************************ */

#include <Arduino.h>
#include <ArduinoOTA.h>
#include <WiFi.h>
#define NETWORK_WIFI 0
#define NETWORK_ETHERNET 1

#if NETWORK_TYPE == NETWORK_ETHERNET
#include <ETH.h>
#else
#include <WiFi.h>
#endif

#include "device.h"

#define M5ATOMECHO 0
#define MATRIXVOICE 1
#define AUDIOKIT 2
#define INMP441 3
#define INMP441MAX98357A 4
#define ESP32_POE_ISO 5
#define TAUDIO 6

#ifdef PI_DEVICE_TYPE
#undef DEVICE_TYPE
Expand All @@ -134,6 +148,12 @@
#elif DEVICE_TYPE == INMP441MAX98357A
#include "devices/Inmp441Max98357a.hpp"
Inmp441Max98357a *device = new Inmp441Max98357a();
#elif DEVICE_TYPE == ESP32_POE_ISO
#include "devices/Esp32_poe_iso.hpp"
Esp32_poe_iso *device = new Esp32_poe_iso();
#elif DEVICE_TYPE == TAUDIO
#include "devices/TAudio.hpp"
TAudio *device = new TAudio();
#else
#error DEVICE_TYPE is out of range
#endif
Expand Down Expand Up @@ -171,6 +191,7 @@ void setup() {
ArduinoOTA
.onStart([]() {
Serial.println("Uploading...");
send_event(OtaEvent());
})
.onEnd([]() {
Serial.println("\nEnd");
Expand Down
Loading

0 comments on commit 017a3c4

Please sign in to comment.