remove network from activation phase

This commit is contained in:
2018-11-08 13:46:17 +01:00
parent bb81391d00
commit f290ec6197
19 changed files with 138 additions and 66 deletions

View File

@@ -13,30 +13,28 @@ MeshNet::MeshNet(MeshConfig cfg) : Network() {
}
Network* MeshNet::init(){
Serial.println("init mesh");
config.fromFile("/config.json");
//mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on
mesh.setDebugMsgTypes( config.debugTypes );
return this;
}
int MeshNet::connect(){
mesh.init( config.meshSSID, config.meshPassword, scheduler, config.meshPort, WIFI_AP_STA, config.channel );
mesh.onNewConnection(bind(&MeshNet::newConnectionCallback, this, _1));
mesh.onChangedConnections(bind(&MeshNet::changedConnectionCallback, this));
mesh.onNodeTimeAdjusted(bind(&MeshNet::nodeTimeAdjustedCallback, this, _1));
connectStation(config.stationMode);
return this;
if(config.stationMode){
connectStation();
}
}
int MeshNet::connectStation(int doConnect) {
if(doConnect){
int MeshNet::connectStation() {
Serial.println("connect station");
mesh.stationManual(config.stationSSID, config.stationPassword);
mesh.setHostname(config.hostname.c_str());
return 1;
}
return 0;
}
void MeshNet::sendTo(uint32_t target, String msg){
mesh.sendSingle(target, msg);