Local Build Argon using po-util with OpenThread

Hey @rickkas7 or @will What is the strongest RSSI value (where -1 is strong and -100 is weak) that a Xenon will be allowed to connect to an Argon? I am seeing some weird data, where my Xenon is flashing cyan or even green but still registering that the mesh.publish is communicating, almost as if the Mesh will not allow a proper connection between a Xenon and an Argon unless it has a good RSSI value lets say of about -75.

The experiment:

So if I walk with my Xenon far enough away from my Argon, I lose connectivity, but my program shows the RSSI values using a mesh.publish, so as I walk back to the Argon I prove that Mesh.publish is working but my Xenon will not reconnect to the Argon until I get quiet a bit closer.

Data:

The Code:

I changed the code around a bit but loaded similar versions on both the Argon and the Xenon.


#include "Particle.h"
// Particle Mesh Devices RSSI distance testing 
// By Jeremy Ellis
// needs po-util

// po init argon myArgonProject
// cd myArgonProject

// po config mesh-develop 
// po setup-mesh

// MODULAR=n po argon build

// particle login
// particle list
// po argon ota myArgonName



#include "ot_api.h"
extern "C" {
	int8_t otPlatRadioGetRssi(otInstance *aInstance);
};




// Event listener for "mySendToAll" event from Xenons
void myHandler(const char *event, const char *data) {
    delay(5);  // sends the data so an RSSI value is registered
}




/////////////////////////// important globals here ///////////////////////////////

int  myCode = 1;  // Integer to identify this device
int  myCutoffInterest = 18;    // which positive version of RSSI should be fast flash. default 18
bool myXenonAntennaAttached = false;  
bool myArgonBothAntennaAttached = false;  
bool myPublishToConsole = true;        // set true for Argon or debugging

/////////////////////////////// end globals ////////////////////////////

void setup() {
   
   pinMode(D7, OUTPUT);
   Mesh.subscribe("mySendToAll", myHandler);
   if (myXenonAntennaAttached){
       #if (PLATFORM_ID == PLATFORM_XENON) 
	       digitalWrite(ANTSW1, 0);
	       digitalWrite(ANTSW2, 1);
       #endif  
   }
    if (myArgonBothAntennaAttached){
       #if (PLATFORM_ID == PLATFORM_ARGON) 
	       digitalWrite(ANTSW1, 1);
	       digitalWrite(ANTSW2, 0);
       #endif  
   }
     
}

void loop() {
    
     
    // here need to get the RSSI as myCode
    
    
    int8_t rssi = otPlatRadioGetRssi(0);   // activate on monolithic build

    Mesh.publish("mySendToAll", String(rssi));

    //int rssi = myCode;   // for testing 
    

    
    int myNumber;
 
     myNumber = ((int(rssi) * -1)  * 100) - (myCutoffInterest * 100);    // for testing, makes positive and larger
   
   
    if (int(rssi) == 0) {
        digitalWrite(D7, HIGH);  // D7 permanently on,  no connection
    }  else {
    
        if (myNumber <= 50){
            myNumber = 50;   // very fast flashing
        }   
 
        if (myNumber > 0){ 
            digitalWrite(D7, HIGH);
            delay(50);   // very quick flash
            digitalWrite(D7, LOW);
            delay(myNumber);   
        }  else {
       
            Particle.publish("Weird "+ String(myNumber), ", #" + String(rssi) , 60, PRIVATE);  //shows printing an integer variable
            delay(2000);
        }
    
    
    }
    
    if (myPublishToConsole){  // mainly for Argon gateway unless debugging
        Particle.publish("delay #" + String(myNumber), "Device #"+String(myCode) + ", RSSI #" + String(rssi), 60, PRIVATE);  //shows printing an integer variable
        delay(2000); // wait about 2 seconds
    }  
    

}
3 Likes