reenable ota

This commit is contained in:
2018-11-24 17:27:21 +01:00
parent efa9849f1b
commit b24077de52
6 changed files with 21 additions and 7 deletions

View File

@@ -2,5 +2,5 @@
"mqttClientName" : "illucat",
"mqttBrokerHost" : "192.168.1.2",
"mqttBrokerPort" : 1883,
"mqttRootTopic" : "wirelos/illucat"
"mqttRootTopic" : "wirelos/led/illucat"
}

View File

@@ -73,8 +73,8 @@
<div class="Form" data-fileName="/config.json" data-name="configForm" data-from="/config.json" data-endpoint="/config"></div>
<h2>NeoPixel</h2>
<div class="Form" data-fileName="/pixelConfig.json" data-name="configForm" data-from="/pixelConfig.json" data-endpoint="/config"></div>
<!-- <h2>MQTT</h2>
<div class="Form" data-fileName="/mqttConfig.json" data-name="configForm" data-from="/mqttConfig.json" data-endpoint="/config"></div> -->
<h2>MQTT</h2>
<div class="Form" data-fileName="/mqttConfig.json" data-name="configForm" data-from="/mqttConfig.json" data-endpoint="/config"></div>
<h2>IRC</h2>
<div class="Form" data-fileName="/ircConfig.json" data-name="configForm" data-from="/ircConfig.json" data-endpoint="/config"></div>
</div>

View File

@@ -100,4 +100,6 @@ lib_deps = ${common.lib_deps}
https://gitlab.com/wirelos/sprocket-network-wifi.git
https://gitlab.com/wirelos/sprocket-plugin-web.git
https://gitlab.com/wirelos/sprocket-plugin-irc.git
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git
PubSubClient
ArduinoIRC

View File

@@ -52,5 +52,11 @@
#define WEB_DEFAULT_FILE "index.html"
#define WEB_PORT 80
// mqtt config
#define MQTT_CLIENT_NAME "illucat"
#define MQTT_HOST "192.168.1.2"
#define MQTT_PORT 1883
#define MQTT_ROOT_TOPIC "wirelos/led/illucat"
#endif

View File

@@ -9,6 +9,7 @@
#include <PixelPlugin.h>
#include <IrcPlugin.h>
#include <OtaTcpPlugin.cpp>
#include <MqttPlugin.h>
WiFiNet *network;
Sprocket *sprocket;
@@ -18,6 +19,7 @@ WebApiPlugin *webApiPlugin;
PixelPlugin *pixelPlugin;
IrcPlugin *ircPlugin;
OtaTcpPlugin *otaTcp;
MqttPlugin *mqttPlugin;
void setup()
{
@@ -25,6 +27,7 @@ void setup()
sprocket = new Sprocket({STARTUP_DELAY, SERIAL_BAUD_RATE});
pixelPlugin = new PixelPlugin({LED_STRIP_PIN, LED_STRIP_LENGTH, LED_STRIP_BRIGHTNESS, LED_STRIP_UPDATE_INTERVAL});
ircPlugin = new IrcPlugin({IRC_SERVER, IRC_PORT, chipName, chipName});
mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_ROOT_TOPIC});
webServerPlugin = new WebServerPlugin({WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE, WEB_PORT});
webConfigPlugin = new WebConfigPlugin(webServerPlugin->server);
webApiPlugin = new WebApiPlugin(webServerPlugin->server);
@@ -36,6 +39,7 @@ void setup()
sprocket->addPlugin(webApiPlugin);
sprocket->addPlugin(otaTcp);
sprocket->addPlugin(ircPlugin);
sprocket->addPlugin(mqttPlugin);
network = new WiFiNet(
WIFI_MODE,
@@ -49,6 +53,7 @@ void setup()
webServerPlugin->server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
webServerPlugin->server->serveStatic(IRC_CONFIG_FILE, SPIFFS, "ircConfig.json");
webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "mqttConfig.json");
sprocket->subscribe("irc/connected", [](String msg) {
if (atoi(msg.c_str()))

View File

@@ -36,16 +36,17 @@
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
#define COLOR_NOT_CONNECTED 255
// OTA config
#define OTA_PORT 8266
#define OTA_PASSWORD ""
// mqtt config
#define MQTT_CLIENT_NAME "illucat"
#define MQTT_HOST "192.168.1.2"
#define MQTT_PORT 1883
#define MQTT_ROOT_TOPIC "wirelos/illucat"
// OTA config
#define OTA_PORT 8266
#define OTA_PASSWORD ""
// WebServer
#define WEB_CONTEXT_PATH "/"
#define WEB_DOC_ROOT "/www"