mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-15 05:02:21 +01:00
cleanup mesh example
This commit is contained in:
@@ -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){
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
#include "MeshNet.h"
|
||||
#include "MeshApp.h"
|
||||
#include "MeshApp.cpp"
|
||||
|
||||
MeshNet net({
|
||||
STATION_MODE, WIFI_CHANNEL,
|
||||
Reference in New Issue
Block a user