cleanup mesh example

This commit is contained in:
2018-07-19 17:30:05 +02:00
parent 4ec1481902
commit c86f96996d
2 changed files with 4 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
#ifndef __MESH_APP__
#ifndef __MESH_APP__
#define __MESH_APP__
#include <painlessMesh.h>
@@ -15,12 +15,13 @@ class MeshApp : public Sprocket {
MeshApp(SprocketConfig cfg) : Sprocket(cfg) {}
Sprocket* activate(Scheduler* scheduler, Network* network) {
net = static_cast<MeshNet*>(network);
//net->onReceive(bind(&MeshApp::onReceive,this, _1, _2));
net->onReceive(bind(&MeshApp::dispatch,this, _1, _2));
// add a task that sends stuff to the mesh
someTask.set(TASK_SECOND * 5, TASK_FOREVER,
bind(&MeshApp::heartbeat, this, net));
scheduler->addTask(someTask);
someTask.enable();
return this;
} using Sprocket::activate;
void heartbeat(MeshNet* network){

View File

@@ -1,6 +1,6 @@
#include "config.h"
#include "MeshNet.h"
#include "MeshApp.h"
#include "MeshApp.cpp"
MeshNet net({
STATION_MODE, WIFI_CHANNEL,