diff --git a/platformio.ini b/platformio.ini index 72ca256..5124119 100644 --- a/platformio.ini +++ b/platformio.ini @@ -81,19 +81,4 @@ framework = ${common.framework} lib_deps = ${common.lib_deps} ESP8266mDNS painlessMesh - ArduinoOTA - -[env:meshPixel] -src_filter = +<*> - + -platform = ${common.platform} -board = ${common.board} -upload_speed = ${common.upload_speed} -monitor_baud = ${common.monitor_baud} -framework = ${common.framework} -lib_deps = ${common.lib_deps} - painlessMesh - ESP8266mDNS - ArduinoOTA - ESP Async WebServer - ESPAsyncTCP - Adafruit NeoPixel \ No newline at end of file + ArduinoOTA \ No newline at end of file diff --git a/src/examples/meshPixel/MeshPixel.h b/src/examples/meshPixel/MeshPixel.h deleted file mode 100644 index 56fa8ae..0000000 --- a/src/examples/meshPixel/MeshPixel.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __MESH_APP__ -#define __MESH_APP__ - -#include -#include -#include - -#include "config.h" -#include "NeoPattern.cpp" -#include "NeoPatternState.cpp" -#include "NeoPattern_api_json.h" -#include "NeoPattern_api_modes.cpp" -#include "utils_print.h" -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace std::placeholders; - -class MeshPixel : public MeshSprocket { - public: - NeoPixelConfig pixelConfig; - NeoPattern* pixels; - NeoPatternState state; - Task animation; - AsyncWebServer* server; - - MeshPixel(SprocketConfig cfg, OtaConfig otaCfg, WebServerConfig webCfg, NeoPixelConfig pixelCfg) : MeshSprocket(cfg) { - pixelConfig = pixelCfg; - pixels = new NeoPattern(pixelCfg.length, pixelCfg.pin, NEO_GRB + NEO_KHZ800); - server = new AsyncWebServer(80); - addPlugin(new OtaTcpPlugin(otaCfg)); - addPlugin(new WebServerPlugin(webCfg, server)); - addPlugin(new WebConfigPlugin(server)); - addPlugin(new MeshManPlugin(server)); - addPlugin(new PixelPlugin(pixelConfig, pixels)); - startupAnimation(); - } - void startupAnimation() { - pixels->Scanner(pixels->Wheel(COLOR_NOT_CONNECTED), pixelConfig.updateInterval); - //pixels->Fade(0, pixels->Color(255,255,255), 4, pixelConfig.updateInterval, FORWARD); - } - Sprocket* activate(Scheduler* scheduler, Network* network) { - // call parent method that enables dispatching and plugins - MeshSprocket::activate(scheduler, network); - net->mesh.onNewConnection(bind(&MeshPixel::newConnection,this, _1)); - net->mesh.onChangedConnections(bind(&MeshPixel::connectionChanged,this)); - return this; - } using MeshSprocket::activate; - - void animate(NeoPattern* pixels){ - pixels->Update(); - } - - void onMessage( uint32_t from, String &msg ) { - PRINT_MSG(Serial, SPROCKET_TYPE, "msg from %u = %s\n", from, msg.c_str()); - state.fromJsonString(msg); - PIXEL_FNCS[state.mode](pixels, state.valueStr); - } - - void newConnection(uint32_t nodeId){ - PRINT_MSG(Serial, SPROCKET_TYPE, "connected to %u", nodeId); - pixels->RainbowCycle(pixelConfig.updateInterval); - } - void connectionChanged(){ - if(!net->mesh.getNodeList().size()){ - startupAnimation(); - } - } -}; - -#endif \ No newline at end of file diff --git a/src/examples/meshPixel/README.md b/src/examples/meshPixel/README.md deleted file mode 100644 index 03bc339..0000000 --- a/src/examples/meshPixel/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Mesh Sprocket Example - -## MQTT stuff -mosquitto_sub -h citadel.lan -p 1883 -v -t '#' - -mosquitto_pub -h citadel.lan -p 1883 -t '/down/domain_id/gateway' -m '{"device":"broadcast", "msg": {"mode": 3, "value": 4} }' - -Enable OTA: -mosquitto_pub -h citadel.lan -p 1883 -t '/down/wirelos/gateway' -m '{"target":"broadcast", "domain": "wirelos", "msg": {"target":"broadcast", "type": 3, msg: "OTA"} }' diff --git a/src/examples/meshPixel/config.h b/src/examples/meshPixel/config.h deleted file mode 100644 index c51131c..0000000 --- a/src/examples/meshPixel/config.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __MESH_CONFIG__ -#define __MESH_CONFIG__ - -// Scheduler config -#define _TASK_SLEEP_ON_IDLE_RUN -#define _TASK_STD_FUNCTION - -// Chip config -#define SPROCKET_TYPE "MeshPixel" -#define SERIAL_BAUD_RATE 115200 -#define STARTUP_DELAY 3000 - -// Mesh config -#define SPROCKET_MODE 0 -#define WIFI_CHANNEL 11 -#define MESH_PORT 5555 -#define MESH_PREFIX "whateverYouLike" -#define MESH_PASSWORD "somethingSneaky" -#define STATION_SSID "Th1ngs4p" -#define STATION_PASSWORD "th3r31sn0sp00n" -#define HOSTNAME "mesh-node" -#define MESH_DEBUG_TYPES ERROR | STARTUP | CONNECTION -//ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE - -// 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" - -// NeoPixel -#define LED_STRIP_PIN D2 -#define LED_STRIP_LENGTH 12 -#define LED_STRIP_BRIGHTNESS 32 -#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 \ No newline at end of file diff --git a/src/examples/meshPixel/main.cpp b/src/examples/meshPixel/main.cpp deleted file mode 100644 index adaedfa..0000000 --- a/src/examples/meshPixel/main.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "config.h" -#include "MeshNet.h" -#include "MeshPixel.h" - -MeshNet net({ - SPROCKET_MODE, WIFI_CHANNEL, - MESH_PORT, MESH_PREFIX, MESH_PASSWORD, - STATION_SSID, STATION_PASSWORD, HOSTNAME, - MESH_DEBUG_TYPES -}); -MeshPixel sprocket( - { STARTUP_DELAY, SERIAL_BAUD_RATE }, - { OTA_PORT, OTA_PASSWORD }, - { WEB_CONTEXT_PATH, WEB_DOC_ROOT, WEB_DEFAULT_FILE }, - { LED_STRIP_PIN, LED_STRIP_LENGTH, LED_STRIP_BRIGHTNESS, LED_STRIP_UPDATE_INTERVAL, LED_STRIP_DEFAULT_COLOR } -); - -void setup() { - sprocket.join(net); -} - -void loop() { - sprocket.loop(); - yield(); -} \ No newline at end of file diff --git a/src/plugins/PixelPlugin.cpp b/src/plugins/PixelPlugin.cpp deleted file mode 100644 index 09d33b8..0000000 --- a/src/plugins/PixelPlugin.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __PIXEL_PLUGIN__ -#define __PIXEL_PLUGIN__ - -#define _TASK_SLEEP_ON_IDLE_RUN -#define _TASK_STD_FUNCTION - -#include "TaskSchedulerDeclarations.h" -#include "MeshNet.h" -#include "Plugin.h" -#include "NeoPattern.cpp" - -using namespace std; -using namespace std::placeholders; - -class PixelPlugin : public Plugin { - private: - NeoPixelConfig pixelConfig; - NeoPattern* pixels; - public: - Task animation; - PixelPlugin(NeoPixelConfig cfg, NeoPattern* neoPattern){ - pixelConfig = cfg; - pixels = neoPattern; - pixels->begin(); - pixels->setBrightness(pixelConfig.brightness); - } - void activate(Scheduler* userScheduler, Network* network){ - animation.set(TASK_MILLISECOND * pixelConfig.updateInterval, TASK_FOREVER, bind(&PixelPlugin::animate, this)); - userScheduler->addTask(animation); - animation.enable(); - Serial.println("NeoPixels activated"); - } - void animate(){ - pixels->Update(); - } - void enable(){ - animation.enable(); - } - void disable(){ - animation.disable(); - } -}; - -#endif \ No newline at end of file