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

@@ -15,12 +15,13 @@ class MeshApp : public Sprocket {
MeshApp(SprocketConfig cfg) : Sprocket(cfg) {} MeshApp(SprocketConfig cfg) : Sprocket(cfg) {}
Sprocket* activate(Scheduler* scheduler, Network* network) { Sprocket* activate(Scheduler* scheduler, Network* network) {
net = static_cast<MeshNet*>(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 // add a task that sends stuff to the mesh
someTask.set(TASK_SECOND * 5, TASK_FOREVER, someTask.set(TASK_SECOND * 5, TASK_FOREVER,
bind(&MeshApp::heartbeat, this, net)); bind(&MeshApp::heartbeat, this, net));
scheduler->addTask(someTask); scheduler->addTask(someTask);
someTask.enable(); someTask.enable();
return this;
} using Sprocket::activate; } using Sprocket::activate;
void heartbeat(MeshNet* network){ void heartbeat(MeshNet* network){

View File

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