1 Commits

Author SHA1 Message Date
Andreas Doebeli
ed191f28e7 got connection to mqtt broker working again 2020-09-14 03:01:16 +02:00
15 changed files with 164 additions and 270 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
.pioenvs
.piolibdeps
.pio
.vscode
data/config.json

View File

@@ -1,4 +1,4 @@
image: python:3.12.10
image: python:2.7-stretch
variables:
S3_BUCKET_NAME: "wirelos"
@@ -12,16 +12,16 @@ stages:
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .pio/
- .pioenvs/
firmware:
stage: build
image: python:3.12.10
image: python:2.7-stretch
before_script:
- pip install -U platformio
script:
- pio run -t clean
- pio run -e release
- pio run
- pio run -t buildfs
release:
@@ -30,11 +30,11 @@ release:
- /^release-.*$/
image: python:latest
script:
#- pip install awscli
- pip install awscli
- mkdir -p ${PROJECT_NAME}/${CI_COMMIT_TAG}
- mv .pio/build/release/firmware.bin ${PROJECT_NAME}/${CI_COMMIT_TAG}
- mv .pio/build/release/spiffs.bin ${PROJECT_NAME}/${CI_COMMIT_TAG}
#- aws s3 --endpoint-url=https://$DO_SPACE_ENDPOINT cp ./ s3://$S3_BUCKET_NAME/ --recursive --exclude "*" --include "*.bin"
- mv .pioenvs/release/firmware.bin ${PROJECT_NAME}/${CI_COMMIT_TAG}
- mv .pioenvs/release/spiffs.bin ${PROJECT_NAME}/${CI_COMMIT_TAG}
- aws s3 --endpoint-url=https://$DO_SPACE_ENDPOINT cp ./ s3://$S3_BUCKET_NAME/ --recursive --exclude "*" --include "*.bin"
artifacts:
paths:
- ${PROJECT_NAME}/${CI_COMMIT_TAG}

View File

@@ -1,8 +0,0 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
# and commit this file to your remote git repository to share the goodness with others.
tasks:
- init: make install

View File

@@ -1,40 +0,0 @@
PIO ?= platformio
flash: upload uploadfs
install:
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
init:
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
build:
$(PIO) run -e esp01
upload:
$(PIO) run -e esp01 -t upload
uploadfs:
$(PIO) run -e esp01 -t uploadfs
spiffs.bin:
#mkspiffs -c data -p 256 -b 4096 -s 524288 spiffs.bin
mkspiffs -c data -p 256 -b 4096 -s 65536 spiffs.bin
upload-esp01:
#esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size 1MB 0x00000 .pio/build/esp01/firmware.bin
#esptool.py --port /dev/ttyUSB0 --baud 57600 write_flash --flash_size 1MB 0x80000 spiffs.bin
# that almost worked
#esptool.py --port /dev/ttyUSB0 --baud 57600 write_flash --flash_mode dio --flash_size 1MB 0x00000 .pio/build/esp01/firmware.bin 0x80000 spiffs.bin
#pio does this
esptool.py --chip esp8266 --port "/dev/ttyUSB0" --baud 921600 write_flash 0x0 .pio/build/esp01/firmware.bin 0x000eb000 spiffs.bin
esptool.py --port /dev/ttyUSB0 --baud 57600 write_flash 43827 spiffs.bin
# for 4MB Flash Size, 3MB SPIFFS
#spiffs.bin:
# mkspiffs -c data -p 256 -b 4096 -s 3145728 spiffs.bin
#
#upload-spiffs.bin:
# esptool --port /dev/ttyUSB0 write_flash 0x300000 spiffs.bin

2
api.md
View File

@@ -51,7 +51,7 @@ Examples:
curl -v -X POST \
--data "topic=pixels/colorWheel" \
--data "payload=20" \
http://192.168.4.1/pixel/api
http://illucat/pixel/api
# set color only on current node
curl -v -X POST \

9
data/config/mqtt.json Normal file
View File

@@ -0,0 +1,9 @@
{
"mqttClientName": "illucat1",
"mqttBrokerHost": "192.168.88.110",
"mqttBrokerPort": 1883,
"mqttRootTopic": "wirelos/illucat",
"mqttUser": "",
"mqttPass": ""
}

View File

@@ -1,9 +1,9 @@
{
"stationMode": 0,
"stationMode": 1,
"hostname": "illucat",
"apSSID": "illucat",
"apPassword": "illumination",
"connectTimeout": 15000,
"stationSSID": "dis-wifi",
"stationPassword": "dis-wifi-passwort"
"connectTimeout": 5000,
"stationSSID": "thobens-416257",
"stationPassword": "467304645DB5"
}

View File

@@ -1,6 +1,9 @@
{
"mqttClientName" : "illucat1",
"mqttBrokerHost" : "192.168.1.2",
"mqttBrokerPort" : 1883,
"mqttRootTopic" : "wirelos/illucat"
"mqttClientName": "illucat1",
"mqttBrokerHost": "192.168.4.1",
"mqttBrokerPort": 1883,
"mqttRootTopic": "wirelos/illucat",
"mqttUser": "foo",
"mqttPass": ""
}

View File

@@ -1,7 +1,7 @@
{
"pin": 4,
"length": 8,
"brightness": 50,
"brightness": 127,
"updateInterval": 100,
"defaultColor": 100
}

View File

@@ -16,46 +16,23 @@
<span class="heading">Pixels</span>
<div class="content">
<ul>
<li class="form-row ParamSelect"
data-label="Hue"
data-name="hue"
data-topic="pixels/hue"
data-default="0"
<li class="form-row ParamSelect" data-label="Hue" data-name="hue" data-topic="pixels/hue" data-default="0"
data-external="/gradients.json">
</li>
<li class="form-row ParamColor"
data-name="color"
data-topic="pixels/color"
data-label="Color">
<li class="form-row ParamColor" data-name="color" data-topic="pixels/color" data-label="Color">
</li>
<li class="form-row ParamColor"
data-name="color"
data-topic="pixels/color2"
data-label="Color 2">
<li class="form-row ParamColor" data-name="color" data-topic="pixels/color2" data-label="Color 2">
</li>
<!-- data-entries='[{"text": "Color", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}]' -->
<li class="form-row ParamSelect"
data-label="Pattern"
data-name="pattern"
data-topic="pixels/pattern"
<li class="form-row ParamSelect" data-label="Pattern" data-name="pattern" data-topic="pixels/pattern"
data-default="0"
data-entries='[{"text": "None", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Color Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}, {"text": "Fire", "value": "6"}]'
></li>
<li class="form-row ParamSlider"
data-name="brightness"
data-min="0"
data-max="255"
data-value="64"
data-topic="pixels/brightness"
data-label="Brightness">
data-entries='[{"text": "None", "value": "0"}, {"text": "Rainbow", "value": "1"}, {"text": "TheaterChase", "value": "2"}, {"text": "Color Wipe", "value": "3"}, {"text": "Scanner", "value": "4"}, {"text": "Fade", "value": "5"}, {"text": "Fire", "value": "6"}]'>
</li>
<li class="form-row ParamSlider"
data-name="totalSteps"
data-min="1"
data-max="255"
data-value="16"
data-topic="pixels/totalSteps"
data-label="Steps">
<li class="form-row ParamSlider" data-name="brightness" data-min="0" data-max="255" data-value="64"
data-topic="pixels/brightness" data-label="Brightness">
</li>
<li class="form-row ParamSlider" data-name="totalSteps" data-min="1" data-max="255" data-value="16"
data-topic="pixels/totalSteps" data-label="Steps">
</li>
</ul>
</div>
@@ -70,12 +47,15 @@
<span class="heading">Settings</span>
<div class="content">
<h2>Network</h2>
<div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.json" data-endpoint="/config"></div>
<div class="Form" data-fileName="/config/wifi.json" data-name="configForm" data-from="/config/wifi.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>IRC</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="/config/mqtt.json" data-name="configForm" data-from="/config/mqtt.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>
</div>

View File

@@ -8,64 +8,28 @@
; Please visit documentation for the other options and examples
; http://docs.platformio.org/page/projectconf.html
[platformio]
env_default = build
;[platformio]
;env_default = build
[common]
framework = arduino
platform = platformio/espressif8266@2.3.2
platform = espressif8266@2.0.4
board = esp12e
upload_speed = 115200
monitor_baud = 115200
monitor_baud = 74880
lib_deps =
Hash
TaskScheduler
SPIFFS
ArduinoJson@5.13.4
adafruit/Adafruit NeoPixel@1.7.0
me-no-dev/ESPAsyncTCP@1.2.0
me-no-dev/ESPAsyncWebServer@1.2.3
me-no-dev/AsyncTCP@1.1.1
Adafruit NeoPixel
ESPAsyncTCP
ESP8266mDNS
;symlink://../../core
;symlink://../../plugins/neopixel
https://gitlab.com/wirelos/sprocket-lib.git#master
https://gitlab.com/wirelos/sprocket-plugin-neopixel.git#master
ESP Async WebServer
https://gitlab.com/wirelos/sprocket-lib.git#develop
https://gitlab.com/wirelos/sprocket-plugin-neopixel.git
[env:esp01]
src_filter = +<*> -<var/> +<var/wifi/>
platform = ${common.platform}
board = esp01_1m
board_build.f_cpu = 80000000L
board_build.flash_mode = qio
board_build.filesystem = spiffs
board_build.ldscript = eagle.flash.1m256.ld
upload_speed = ${common.upload_speed}
monitor_baud = ${common.monitor_baud}
framework = ${common.framework}
build_flags = -Wl,-Teagle.flash.1m256.ld -DSPROCKET_PRINT=1
lib_deps = ${common.lib_deps}
;symlink://../../network/wifi
;symlink://../../plugins/web
https://gitlab.com/wirelos/sprocket-network-wifi.git#master
https://gitlab.com/wirelos/sprocket-plugin-web.git#master
;[env:build-esp32]
;platform = espressif32
;board = esp32dev
;src_filter = +<*> -<var/> +<var/wifi/>
;upload_speed = ${common.upload_speed}
;monitor_baud = ${common.monitor_baud}
;framework = ${common.framework}
;build_flags = -DSPROCKET_PRINT=1
;lib_deps = ${common.lib_deps}
; symlink://../../network/wifi
; symlink://../../plugins/web
; ;https://gitlab.com/wirelos/sprocket-network-wifi.git#next
; ;https://gitlab.com/wirelos/sprocket-plugin-web.git#next
;
;
[env:build]
src_filter = +<*> -<var/> +<var/wifi/>
platform = ${common.platform}
@@ -76,10 +40,22 @@ framework = ${common.framework}
build_flags = -Wl,-Teagle.flash.4m1m.ld
-DSPROCKET_PRINT=1
lib_deps = ${common.lib_deps}
;symlink://../../network/wifi
;symlink://../../plugins/web
https://gitlab.com/wirelos/sprocket-network-wifi.git#master
https://gitlab.com/wirelos/sprocket-plugin-web.git#master
https://gitlab.com/wirelos/sprocket-network-wifi.git#next
https://gitlab.com/wirelos/sprocket-plugin-web.git#next
[env:build-mesh]
src_filter = +<*> -<var/> +<var/wifiMesh/>
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/painlessMesh.git
https://gitlab.com/wirelos/sprocket-network-mesh.git#forked-mesh
[env:release]
src_filter = +<*> -<var/> +<var/wifi/>
@@ -91,69 +67,38 @@ framework = ${common.framework}
build_flags = -Wl,-Teagle.flash.4m1m.ld
-DSPROCKET_PRINT=0
lib_deps = ${common.lib_deps}
;symlink://../../network/wifi
;symlink://../../plugins/web
https://gitlab.com/wirelos/sprocket-network-wifi.git#master
https://gitlab.com/wirelos/sprocket-plugin-web.git#master
https://gitlab.com/wirelos/sprocket-network-wifi.git#next
https://gitlab.com/wirelos/sprocket-plugin-web.git#next
;[env:build-mesh]
;src_filter = +<*> -<var/> +<var/wifiMesh/>
;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/painlessMesh.git
; https://gitlab.com/wirelos/sprocket-network-mesh.git#forked-mesh
;
;[env:release]
;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=0
;lib_deps = ${common.lib_deps}
; symlink://../../network/wifi
; symlink://../../plugins/web
; ;https://gitlab.com/wirelos/sprocket-network-wifi.git#next
; ;https://gitlab.com/wirelos/sprocket-plugin-web.git#next
;
;[env:mqcatt]
;src_filter = +<*> -<var/> +<var/mqcatt/>
;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-network-wifi.git#next
; https://gitlab.com/wirelos/sprocket-plugin-web.git#next
; https://gitlab.com/wirelos/sprocket-plugin-mqtt.git#next
; PubSubClient
;
;[env:illuchat]
;src_filter = +<*> -<var/> +<var/illuchat/>
;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-network-wifi.git#next
; https://gitlab.com/wirelos/sprocket-plugin-web.git#next
; https://gitlab.com/wirelos/sprocket-plugin-irc.git
; https://gitlab.com/wirelos/sprocket-plugin-mqtt.git#next
; PubSubClient
; ArduinoIRC
;
[env:mqcatt]
src_filter = +<*> -<var/> +<var/mqcatt/>
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-network-wifi.git#next
https://gitlab.com/wirelos/sprocket-plugin-web.git#next
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git#next
PubSubClient
[env:illuchat]
src_filter = +<*> -<var/> +<var/illuchat/>
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-network-wifi.git#next
https://gitlab.com/wirelos/sprocket-plugin-web.git#next
https://gitlab.com/wirelos/sprocket-plugin-irc.git
https://gitlab.com/wirelos/sprocket-plugin-mqtt.git#next
PubSubClient
ArduinoIRC

View File

@@ -8,8 +8,8 @@
// Chip config
#define SPROCKET_TYPE "ILLUCAT"
#define SERIAL_BAUD_RATE 115200
#define STARTUP_DELAY 1000
#define SERIAL_BAUD_RATE 74880
#define STARTUP_DELAY 5000
// Mesh config
#define SPROCKET_MODE 0
@@ -19,8 +19,8 @@
#define AP_PASSWORD "illumination"
#define MESH_PREFIX "illucat-mesh"
#define MESH_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "MyAP"
#define STATION_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "thobens-416257"
#define STATION_PASSWORD "467304645DB5"
#define HOSTNAME "illucat"
#define CONNECT_TIMEOUT 10000
#define MESH_DEBUG_TYPES ERROR | STARTUP | CONNECTION
@@ -46,5 +46,6 @@
#define LED_STRIP_DEFAULT_COLOR 100
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
#define COLOR_NOT_CONNECTED 255
#define LED_STRIP_DEFAULT_PATTERN 1
#endif

View File

@@ -1,6 +1,7 @@
#include "mqcatt_config.h"
#include <WiFiNet.h>
#include <Sprocket.h>
#include "../../IlluCat.h"
#include <ESPAsyncWebServer.h>
#include <WebServerConfig.h>
#include <WebServerPlugin.h>
@@ -21,7 +22,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});
mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_ROOT_TOPIC});
mqttPlugin = new MqttPlugin({MQTT_CLIENT_NAME, MQTT_HOST, MQTT_PORT, MQTT_ROOT_TOPIC, MQTT_USER, MQTT_PASS});
webServerPlugin = new WebServerPlugin({WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE, WEB_PORT});
webConfigPlugin = new WebConfigPlugin(webServerPlugin->server);
webApiPlugin = new WebApiPlugin(webServerPlugin->server);
@@ -42,7 +43,7 @@ void setup()
network->connect();
webServerPlugin->server->serveStatic(PIXEL_CONFIG_FILE, SPIFFS, "pixelConfig.json");
webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "mqttConfig.json");
webServerPlugin->server->serveStatic(MQTT_CONFIG_FILE, SPIFFS, "config/mqtt.json");
sprocket->activate();
sprocket->publish("pixels/pattern", "1");

View File

@@ -8,8 +8,8 @@
// Chip config
#define SPROCKET_TYPE "ILLUCAT"
#define SERIAL_BAUD_RATE 115200
#define STARTUP_DELAY 1000
#define SERIAL_BAUD_RATE 74880
#define STARTUP_DELAY 5000
// Network config
#define WIFI_MODE 0
@@ -18,14 +18,14 @@
#define AP_PASSWORD "illumination"
#define MESH_PREFIX "illucat-mesh"
#define MESH_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "MyAP"
#define STATION_PASSWORD "th3r31sn0sp00n"
#define STATION_SSID "thobens-416257"
#define STATION_PASSWORD "467304645DB5"
#define HOSTNAME "illucat"
#define CONNECT_TIMEOUT 10000
// config files
#define PIXEL_CONFIG_FILE "/pixelConfig.json"
#define MQTT_CONFIG_FILE "/mqttConfig.json"
#define MQTT_CONFIG_FILE "/config/mqtt.json"
// NeoPixel
#define LED_STRIP_PIN D2
@@ -35,7 +35,7 @@
#define LED_STRIP_DEFAULT_COLOR 100
#define COLOR_CONNECTED LED_STRIP_DEFAULT_COLOR
#define COLOR_NOT_CONNECTED 255
#define LED_STRIP_DEFAULT_PATTERN 1
// OTA config
#define OTA_PORT 8266
@@ -43,9 +43,11 @@
// mqtt config
#define MQTT_CLIENT_NAME "illucat"
#define MQTT_HOST "192.168.1.2"
#define MQTT_HOST "192.168.88.110"
#define MQTT_PORT 1883
#define MQTT_ROOT_TOPIC "wirelos/illucat"
#define MQTT_USER ""
#define MQTT_PASS ""
// WebServer
#define WEB_CONTEXT_PATH "/"
@@ -53,5 +55,4 @@
#define WEB_DEFAULT_FILE "index.html"
#define WEB_PORT 80
#endif