diff --git a/sampler/src/main.cpp b/sampler/src/main.cpp index 2387ff7..dd2eb66 100644 --- a/sampler/src/main.cpp +++ b/sampler/src/main.cpp @@ -236,7 +236,10 @@ void setup() { //audio AudioMemory(20); +#if !defined(TEENSY36) + //NOTE!! teensy36 board.. output broken? .. so disable this for teensy36.. this is the cause?? dacs1.analogReference(EXTERNAL); +#endif mixer1.gain(0,1.0); mixer1.gain(1,1.0); mixer1.gain(2,0); diff --git a/src/main.cpp b/src/main.cpp index d7985ed..c6023bf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,13 +44,18 @@ // they need this to reduce noise from AP beacon signals. // but, then they cannot build-up net. by themselves. // 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 // --> a quirk.. due to bi-directional I2C hardship. // 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. // 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 //==================== //======================== @@ -58,8 +63,7 @@ #define MESH_PASSWORD "cc*vvvv/kkk" #define MESH_PORT 5555 #define MESH_CHANNEL 5 -// #define MESH_ANCHOR -#define LONELY_TO_DIE (30000) +#define LONELY_TO_DIE (1000) //======================= // @@ -155,7 +159,8 @@ void nothappyalone() { // isConnected_prev = isConnected; } -Task nothappyalone_task(1000, TASK_FOREVER, ¬happyalone, &runner, true); // by default, ENABLED. +// Task nothappyalone_task(1000, TASK_FOREVER, ¬happyalone, &runner, true); // by default, ENABLED. +Task nothappyalone_task(100, TASK_FOREVER, ¬happyalone); // by default, ENABLED. //task #2 : regular post collection #if !defined(DISABLE_I2C_REQ) @@ -247,6 +252,7 @@ void receivedCallback(uint32_t from, String & msg) { // REQUIRED Wire.endTransmission(); } void changedConnectionCallback() { + Serial.println(mesh.getNodeList().size()); // check status -> modify status LED if (mesh.getNodeList().size() > 0) { // (still) connected. @@ -257,6 +263,8 @@ void changedConnectionCallback() { Serial.println("connected!"); // isConnected = true; + runner.addTask(nothappyalone_task); + nothappyalone_task.enable(); } else { // disconnected!! @@ -270,6 +278,8 @@ void changedConnectionCallback() { Serial.println("hi. client, we ve got a change in the net."); } void newConnectionCallback(uint32_t nodeId) { + Serial.println(mesh.getNodeList().size()); + Serial.println("newConnectionCallback."); 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); // -#if defined(MESH_ANCHOR) +#if defined(SET_ROOT) + mesh.setRoot(true); +#endif +#if defined(SET_CONTAINSROOT) mesh.setContainsRoot(true); #endif //callbacks mesh.onReceive(&receivedCallback); mesh.onNewConnection(&newConnectionCallback); mesh.onChangedConnections(&changedConnectionCallback); + Serial.println(mesh.getNodeList().size()); //tasks runner.addTask(statusblinks);