mirror of
https://gitlab.com/zwirbel/illucat.git
synced 2025-12-15 17:58:20 +01:00
Merge branch 'feature/8-mqcatt' into 'master'
Resolve "MQCaTT" Closes #8 See merge request 0x1d/illucat!8
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -73,6 +73,10 @@
|
|||||||
<span class="heading">System</span>
|
<span class="heading">System</span>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div><label>Free Heap: </label><span class="js-heap"></span><span> bytes</span><br><br></div>
|
<div><label>Free Heap: </label><span class="js-heap"></span><span> bytes</span><br><br></div>
|
||||||
|
<form method='POST' action='/update' enctype='multipart/form-data'>
|
||||||
|
<input type='file' name='update'><input type='submit' value='Update'>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
<button class="js-restart">Restart</button>
|
<button class="js-restart">Restart</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
.sui label {
|
.sui label {
|
||||||
color: #b3b2b2;
|
color: #b3b2b2;
|
||||||
}
|
}
|
||||||
.sui button {
|
.sui button, .sui input[type=file] {
|
||||||
background: #097479;
|
background: #097479;
|
||||||
color: #eeeeee;
|
color: #eeeeee;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
|
|||||||
@@ -30,10 +30,23 @@ lib_deps =
|
|||||||
painlessMesh
|
painlessMesh
|
||||||
https://gitlab.com/wirelos/sprocket-lib.git#develop
|
https://gitlab.com/wirelos/sprocket-lib.git#develop
|
||||||
https://gitlab.com/wirelos/sprocket-plugin-neopixel.git
|
https://gitlab.com/wirelos/sprocket-plugin-neopixel.git
|
||||||
https://gitlab.com/wirelos/sprocket-plugin-web.git
|
|
||||||
|
|
||||||
[env:build]
|
[env:build]
|
||||||
src_filter = +<*> -<wifiMesh/> +<wifi/>
|
src_filter = +<*> -<var/> +<var/wifi/>
|
||||||
|
platform = ${common.platform}
|
||||||
|
board = ${common.board}
|
||||||
|
upload_speed = ${common.upload_speed}
|
||||||
|
monitor_baud = ${common.monitor_baud}
|
||||||
|
framework = ${common.framework}
|
||||||
|
build_flags = -Wl,-Teagle.flash.4m1m.ld
|
||||||
|
-DSPROCKET_PRINT=1
|
||||||
|
lib_deps = ${common.lib_deps}
|
||||||
|
https://gitlab.com/wirelos/sprocket-plugin-web.git
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[env:build]
|
||||||
|
src_filter = +<*> -<var/> +<var/wifi/>
|
||||||
platform = ${common.platform}
|
platform = ${common.platform}
|
||||||
board = ${common.board}
|
board = ${common.board}
|
||||||
upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
@@ -46,7 +59,7 @@ lib_deps = ${common.lib_deps}
|
|||||||
|
|
||||||
|
|
||||||
[env:build-mesh]
|
[env:build-mesh]
|
||||||
src_filter = +<*> +<wifiMesh/> -<wifi/>
|
src_filter = +<*> -<var/> +<var/wifiMesh/>
|
||||||
platform = ${common.platform}
|
platform = ${common.platform}
|
||||||
board = ${common.board}
|
board = ${common.board}
|
||||||
upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
@@ -58,7 +71,7 @@ lib_deps = ${common.lib_deps}
|
|||||||
painlessMesh
|
painlessMesh
|
||||||
|
|
||||||
[env:release]
|
[env:release]
|
||||||
src_filter = +<*> -<wifiMesh/> +<wifi/>
|
src_filter = +<*> -<var/> +<var/wifi/>
|
||||||
platform = ${common.platform}
|
platform = ${common.platform}
|
||||||
board = ${common.board}
|
board = ${common.board}
|
||||||
upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
@@ -70,15 +83,16 @@ lib_deps = ${common.lib_deps}
|
|||||||
https://gitlab.com/wirelos/sprocket-plugin-web.git
|
https://gitlab.com/wirelos/sprocket-plugin-web.git
|
||||||
|
|
||||||
|
|
||||||
;[env:mqttcat]
|
[env:mqcatt]
|
||||||
;src_filter = +<*> -<wifiMesh/> +<wifi/>
|
src_filter = +<*> -<var/> +<var/mqcatt/>
|
||||||
;platform = ${common.platform}
|
platform = ${common.platform}
|
||||||
;board = ${common.board}
|
board = ${common.board}
|
||||||
;upload_speed = ${common.upload_speed}
|
upload_speed = ${common.upload_speed}
|
||||||
;monitor_baud = ${common.monitor_baud}
|
monitor_baud = ${common.monitor_baud}
|
||||||
;framework = ${common.framework}
|
framework = ${common.framework}
|
||||||
;build_flags = -Wl,-Teagle.flash.4m1m.ld
|
build_flags = -Wl,-Teagle.flash.4m1m.ld
|
||||||
; -DSPROCKET_PRINT=1
|
-DSPROCKET_PRINT=1
|
||||||
;lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
; https://gitlab.com/wirelos/sprocket-lib.git#develop
|
https://gitlab.com/wirelos/sprocket-plugin-web.git
|
||||||
; PubSubClient
|
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git
|
||||||
|
PubSubClient
|
||||||
52
src/var/mqcatt/main.cpp
Normal file
52
src/var/mqcatt/main.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#include "mqcatt_config.h"
|
||||||
|
#include <WiFiNet.h>
|
||||||
|
#include <Sprocket.h>
|
||||||
|
#include <ESPAsyncWebServer.h>
|
||||||
|
#include <WebServerConfig.h>
|
||||||
|
#include <WebServerPlugin.h>
|
||||||
|
#include <WebConfigPlugin.h>
|
||||||
|
#include <WebApiPlugin.h>
|
||||||
|
#include <PixelPlugin.h>
|
||||||
|
#include <MqttPlugin.h>
|
||||||
|
|
||||||
|
WiFiNet *network;
|
||||||
|
Sprocket *sprocket;
|
||||||
|
AsyncWebServer *server;
|
||||||
|
WebServerPlugin *webServerPlugin;
|
||||||
|
WebConfigPlugin *webConfigPlugin;
|
||||||
|
WebApiPlugin *webApiPlugin;
|
||||||
|
PixelPlugin *pixelPlugin;
|
||||||
|
MqttPlugin *mqttPlugin;
|
||||||
|
|
||||||
|
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});
|
||||||
|
mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_TOPIC_IN, MQTT_TOPIC_OUT});
|
||||||
|
webServerPlugin = new WebServerPlugin({WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE, WEB_PORT});
|
||||||
|
webConfigPlugin = new WebConfigPlugin(webServerPlugin->server);
|
||||||
|
webApiPlugin = new WebApiPlugin(webServerPlugin->server);
|
||||||
|
sprocket->addPlugin(pixelPlugin);
|
||||||
|
sprocket->addPlugin(webServerPlugin);
|
||||||
|
sprocket->addPlugin(webConfigPlugin);
|
||||||
|
sprocket->addPlugin(webApiPlugin);
|
||||||
|
sprocket->addPlugin(mqttPlugin);
|
||||||
|
|
||||||
|
network = new WiFiNet(
|
||||||
|
WIFI_MODE,
|
||||||
|
STATION_SSID,
|
||||||
|
STATION_PASSWORD,
|
||||||
|
AP_SSID,
|
||||||
|
AP_PASSWORD,
|
||||||
|
HOSTNAME,
|
||||||
|
CONNECT_TIMEOUT);
|
||||||
|
network->connect();
|
||||||
|
|
||||||
|
sprocket->activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
sprocket->loop();
|
||||||
|
yield();
|
||||||
|
}
|
||||||
55
src/var/mqcatt/mqcatt_config.h
Normal file
55
src/var/mqcatt/mqcatt_config.h
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#ifndef __MQCATT_CONFIG__
|
||||||
|
#define __MQCATT_CONFIG__
|
||||||
|
|
||||||
|
// Scheduler config
|
||||||
|
#define _TASK_SLEEP_ON_IDLE_RUN
|
||||||
|
#define _TASK_STD_FUNCTION
|
||||||
|
#define _TASK_PRIORITY
|
||||||
|
|
||||||
|
// Chip config
|
||||||
|
#define SPROCKET_TYPE "ILLUCAT"
|
||||||
|
#define SERIAL_BAUD_RATE 115200
|
||||||
|
#define STARTUP_DELAY 1000
|
||||||
|
|
||||||
|
// Network config
|
||||||
|
#define WIFI_MODE 0
|
||||||
|
#define WIFI_CHANNEL 11
|
||||||
|
#define AP_SSID "illucat"
|
||||||
|
#define AP_PASSWORD "illumination"
|
||||||
|
#define MESH_PREFIX "illucat-mesh"
|
||||||
|
#define MESH_PASSWORD "th3r31sn0sp00n"
|
||||||
|
#define STATION_SSID "MyAP"
|
||||||
|
#define STATION_PASSWORD "th3r31sn0sp00n"
|
||||||
|
#define HOSTNAME "illucat"
|
||||||
|
#define CONNECT_TIMEOUT 10000
|
||||||
|
|
||||||
|
// pixel config
|
||||||
|
#define PIXEL_CONFIG_FILE "/pixelConfig.json"
|
||||||
|
|
||||||
|
// mqtt config
|
||||||
|
#define MQTT_CLIENT_NAME "mqcatt"
|
||||||
|
#define MQTT_HOST "192.168.1.2"
|
||||||
|
#define MQTT_PORT 1883
|
||||||
|
#define MQTT_TOPIC_IN "wirelos/illucat-in/"
|
||||||
|
#define MQTT_TOPIC_OUT "wirelos/illucat-out/"
|
||||||
|
|
||||||
|
// OTA config
|
||||||
|
#define OTA_PORT 8266
|
||||||
|
#define OTA_PASSWORD ""
|
||||||
|
|
||||||
|
// WebServer
|
||||||
|
#define WEB_CONTEXT_PATH "/"
|
||||||
|
#define WEB_DOC_ROOT "/www"
|
||||||
|
#define WEB_DEFAULT_FILE "index.html"
|
||||||
|
#define WEB_PORT 80
|
||||||
|
|
||||||
|
// NeoPixel
|
||||||
|
#define LED_STRIP_PIN D2
|
||||||
|
#define LED_STRIP_LENGTH 8
|
||||||
|
#define LED_STRIP_BRIGHTNESS 48
|
||||||
|
#define LED_STRIP_UPDATE_INTERVAL 200
|
||||||
|
#define LED_STRIP_DEFAULT_COLOR 100
|
||||||
|
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
|
||||||
|
#define COLOR_NOT_CONNECTED 255
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user