net stability helping.. trials.

+ teensy36 dacs problem? quick patch...
This commit is contained in:
Dooho Yi 2019-12-13 16:19:47 +09:00
parent 0938dbf328
commit 33df8c26b7
2 changed files with 23 additions and 6 deletions

View file

@ -236,7 +236,10 @@ void setup() {
//audio //audio
AudioMemory(20); AudioMemory(20);
#if !defined(TEENSY36)
//NOTE!! teensy36 board.. output broken? .. so disable this for teensy36.. this is the cause??
dacs1.analogReference(EXTERNAL); dacs1.analogReference(EXTERNAL);
#endif
mixer1.gain(0,1.0); mixer1.gain(0,1.0);
mixer1.gain(1,1.0); mixer1.gain(1,1.0);
mixer1.gain(2,0); mixer1.gain(2,0);

View file

@ -44,13 +44,18 @@
// they need this to reduce noise from AP beacon signals. // they need this to reduce noise from AP beacon signals.
// but, then they cannot build-up net. by themselves. // but, then they cannot build-up net. by themselves.
// we need who can do AP.. // we need who can do AP..
// ==> TODO! just prepare some 'dummy' postmans around. w/ AP activated. // ==> TODO! just prepare some 'dummy' postmans around. w/ AP activated.
#define DISABLE_I2C_REQ #define DISABLE_I2C_REQ
// --> a quirk.. due to bi-directional I2C hardship. // --> a quirk.. due to bi-directional I2C hardship.
// ideally, we want to make this sampler node also speak. // ideally, we want to make this sampler node also speak.
// but, I2C doesn't work. maybe middleware bug.. we later want to change to diff. proto. // but, I2C doesn't work. maybe middleware bug.. we later want to change to diff. proto.
// for example, UART or so. // for example, UART or so.
// ==> BEWARE! yet, still we need to take off this.. for 'osc' node. // ==> BEWARE! yet, still we need to take off this.. for 'osc' node.
// #define SET_ROOT
#define SET_CONTAINSROOT
// --> for the network stability
// declare 1 root node and branches(constricted to 'contains the root')
// to improve the stability of the net
//==========</configuration>========== //==========</configuration>==========
//============<parameters>============ //============<parameters>============
@ -58,8 +63,7 @@
#define MESH_PASSWORD "cc*vvvv/kkk" #define MESH_PASSWORD "cc*vvvv/kkk"
#define MESH_PORT 5555 #define MESH_PORT 5555
#define MESH_CHANNEL 5 #define MESH_CHANNEL 5
// #define MESH_ANCHOR #define LONELY_TO_DIE (1000)
#define LONELY_TO_DIE (30000)
//============</parameters>=========== //============</parameters>===========
// //
@ -155,7 +159,8 @@ void nothappyalone() {
// //
isConnected_prev = isConnected; isConnected_prev = isConnected;
} }
Task nothappyalone_task(1000, TASK_FOREVER, &nothappyalone, &runner, true); // by default, ENABLED. // Task nothappyalone_task(1000, TASK_FOREVER, &nothappyalone, &runner, true); // by default, ENABLED.
Task nothappyalone_task(100, TASK_FOREVER, &nothappyalone); // by default, ENABLED.
//task #2 : regular post collection //task #2 : regular post collection
#if !defined(DISABLE_I2C_REQ) #if !defined(DISABLE_I2C_REQ)
@ -247,6 +252,7 @@ void receivedCallback(uint32_t from, String & msg) { // REQUIRED
Wire.endTransmission(); Wire.endTransmission();
} }
void changedConnectionCallback() { void changedConnectionCallback() {
Serial.println(mesh.getNodeList().size());
// check status -> modify status LED // check status -> modify status LED
if (mesh.getNodeList().size() > 0) { if (mesh.getNodeList().size() > 0) {
// (still) connected. // (still) connected.
@ -257,6 +263,8 @@ void changedConnectionCallback() {
Serial.println("connected!"); Serial.println("connected!");
// //
isConnected = true; isConnected = true;
runner.addTask(nothappyalone_task);
nothappyalone_task.enable();
} }
else { else {
// disconnected!! // disconnected!!
@ -270,6 +278,8 @@ void changedConnectionCallback() {
Serial.println("hi. client, we ve got a change in the net."); Serial.println("hi. client, we ve got a change in the net.");
} }
void newConnectionCallback(uint32_t nodeId) { void newConnectionCallback(uint32_t nodeId) {
Serial.println(mesh.getNodeList().size());
Serial.println("newConnectionCallback.");
changedConnectionCallback(); changedConnectionCallback();
} }
@ -292,13 +302,17 @@ void setup() {
// void init(String ssid, String password, uint16_t port = 5555, WiFiMode_t connectMode = WIFI_AP_STA, uint8_t channel = 1, uint8_t hidden = 0, uint8_t maxconn = MAX_CONN); // void init(String ssid, String password, uint16_t port = 5555, WiFiMode_t connectMode = WIFI_AP_STA, uint8_t channel = 1, uint8_t hidden = 0, uint8_t maxconn = MAX_CONN);
// //
#if defined(MESH_ANCHOR) #if defined(SET_ROOT)
mesh.setRoot(true);
#endif
#if defined(SET_CONTAINSROOT)
mesh.setContainsRoot(true); mesh.setContainsRoot(true);
#endif #endif
//callbacks //callbacks
mesh.onReceive(&receivedCallback); mesh.onReceive(&receivedCallback);
mesh.onNewConnection(&newConnectionCallback); mesh.onNewConnection(&newConnectionCallback);
mesh.onChangedConnections(&changedConnectionCallback); mesh.onChangedConnections(&changedConnectionCallback);
Serial.println(mesh.getNodeList().size());
//tasks //tasks
runner.addTask(statusblinks); runner.addTask(statusblinks);