mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-16 13:25:03 +01:00
remove network from activation phase
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user