mDot project for Multitech and Explora worhshop
Dependencies: mDot_X_NUCLEO_IKS01A1 libmDot-dev-mbed5-deprecated
Fork of mDot-IKS01A1 by
Diff: main.cpp
- Revision:
- 10:1e3e3ab9c29c
- Parent:
- 9:e642e8f9ea37
- Child:
- 12:3466445b1ac6
--- a/main.cpp Tue Jan 17 22:53:01 2017 +0000 +++ b/main.cpp Tue Feb 14 20:33:40 2017 +0000 @@ -12,27 +12,35 @@ // This triggers an I2C issue in mbed-os 5.1.5 // Use any other revision to compile. (Tested with libmDot-dev/mbed-os 5.2.2 #define SENET -#ifdef SENET +#ifdef ACTILITY +// Network Id for Senet public network +static uint8_t network_id[] = {0xF0, 0x3D, 0x29,0xAC,0x71,0x00,0x00, 0x00}; +// Register at or Sign in to http://portal.senetco.com/ and register your NodeId to receive your AppId +// {0xD3,0x5A,0x30,0x60,0xA6,0x0D,0x9E,0xEA,0xD9,0xA1,0x19,0x61,0x4F,0x29,0x9E,0x5B} +static uint8_t network_key[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //{0xD3,0x5A,0x30,0x60,0xA6,0x0D,0x9E,0xEA,0xD9,0xA1,0x19,0x61,0x4F,0x29,0x9E,0x5B}; +static uint8_t frequency_sub_band = 0; +static bool public_network = true; +#elif defined(SENET) // Network Id for Senet public network static uint8_t network_id[] = {0x00,0x25,0x0C,0x00,0x00,0x01,0x00,0x01}; // Register at or Sign in to http://portal.senetco.com/ and register your NodeId to receive your AppId // {0xD3,0x5A,0x30,0x60,0xA6,0x0D,0x9E,0xEA,0xD9,0xA1,0x19,0x61,0x4F,0x29,0x9E,0x5B} -static uint8_t network_key[] = {0xD3,0x5A,0x30,0x60,0xA6,0x0D,0x9E,0xEA,0xD9,0xA1,0x19,0x61,0x4F,0x29,0x9E,0x5B}; +static uint8_t network_key[] = {0x5F,0x7B,0x08,0x15,0x55,0x69,0x9A,0x2E,0x3C,0x91,0xE3,0xFE,0xF0,0x2A,0x77,0x79}; // 1 For Senet, configurable on your Conduit static uint8_t frequency_sub_band = 1; // True for Senet, false for your Conduit. static bool public_network = true; #else //Replace with settings on your Conduit -static std::string network_name = "TestTest"; -static std::string network_passphrase = "TestTest"; +static std::string network_name = "EcoLabTest"; +static std::string network_passphrase = "EcoLabTest"; // 1 For Senet, configurable on your Conduit static uint8_t frequency_sub_band = 1; // True for Senet, false for your Conduit. static bool public_network = false; #endif -static uint8_t ack = 1; -static uint8_t tx_datarate = mDot::DR4; +static uint8_t ack = 0; +static uint8_t tx_datarate = mDot::SF_7; // deepsleep consumes slightly less current than sleep // in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up @@ -95,7 +103,7 @@ // in OTA and AUTO_OTA join modes, the credentials can be passed to the library as a name and passphrase or an ID and KEY // only one method or the other should be used! // network ID = crc64(network name) -#ifdef SENET +#if defined(SENET) || defined(ACTILITY) // network KEY = cmac(network passphrase) update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack); #else @@ -245,10 +253,12 @@ send_data(tx_data); + if(deep_sleep){ // if going into deepsleep mode, save the session so we don't need to join again after waking up // not necessary if going into sleep mode since RAM is retained - logInfo("saving network session to NVM"); - dot->saveNetworkSession(); + logInfo("saving network session to NVM"); + dot->saveNetworkSession(); + } // ONLY ONE of the three functions below should be uncommented depending on the desired wakeup method