UDK + Shield
Dependencies: DOGS102 ISL29011 MMA845x MPL3115A2 NCP5623B libmDot_1012-hotifx mbed-rtos mbed-src Senet_Packet X_NUCLEO_IKS01A1
Fork of MTDOT-EVBDemo_Senet by
Diff: main.cpp
- Revision:
- 6:b22dfacacae1
- Parent:
- 5:a33dcda3507b
- Child:
- 7:3ccfc47b8e0b
--- a/main.cpp Wed Dec 02 13:28:31 2015 +0000 +++ b/main.cpp Tue Jul 05 20:58:46 2016 +0000 @@ -101,7 +101,8 @@ */ static std::string config_network_name = "TAB-CubeNet"; static std::string config_network_pass = "1nt3gral"; -static uint8_t config_frequency_sub_band = 1; +static uint8_t config_frequency_sub_band = 0; +static bool config_adr_on = true; /* config_app_id and config_app_key are for public networks. */ static uint8_t app_id[8] = {0x00,0x25,0x0C,0x00,0x00,0x01,0x00,0x01}; @@ -109,6 +110,7 @@ static uint8_t app_key[16] = //9C49 - {0xB4,0xAD,0x1A,0x25,0x69,0x7F,0xF6,0x8E,0xD3,0x4B,0x83,0xC4,0xB6,0xC0,0xF2,0x3C}; //{0xA0,0xC8,0x3D,0xD1,0x7B,0x32,0x97,0x1B,0x71,0xDC,0x53,0xB5,0x4D,0x89,0xC6,0x19}; {0xFC,0xD1,0x8B,0x22,0x9E,0xA0,0xDA,0x4F,0x6B,0x8F,0x39,0x26,0xAF,0x07,0x8A,0x05}; //9CFF + //{0xB3,0x53,0x00,0xDA,0xF6,0x0A,0x6C,0xF9,0x54,0x57,0x79,0x50,0x6F,0x19,0xE1,0x3A}; //9C35 std::vector<uint8_t> config_app_key(app_key,app_key+sizeof(app_key)/sizeof(uint8_t)); uint8_t result, pckt_time=100; @@ -268,7 +270,11 @@ if ((mdot_ret = mdot_radio->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) { log_error(mdot_radio, "failed to set frequency sub band", mdot_ret); } - + + printf("setting ADR\r\n"); + if ((mdot_ret = mdot_radio->setAdr(config_adr_on)) != mDot::MDOT_OK) { + log_error(mdot_radio, "failed to set ADR", mdot_ret); + } /* * setNetworkName is used for private networks. * Use setNetworkID(AppID) for public networks @@ -544,7 +550,7 @@ mdot_data.push_back(converts.t_u[1]); mdot_data.push_back(converts.t_u[0]); */ - if((reflected_value != position_value)||(position_changed)) + if((reflected_value != position_value)||(position_changed)||(0 == (i%100))) { if ((mdot_ret = mdot_radio->send(mdot_data)) != mDot::MDOT_OK) { log_error(mdot_radio, "failed to send", mdot_ret); @@ -570,7 +576,7 @@ } } } - } while(!exit_program && (i < 65000)); + } while(!exit_program /*&& (i < 65000)*/); evbBaro->triggerOneShot(); @@ -658,7 +664,8 @@ pckt_time /= 2; else pckt_time = 20; - thread_3->signal_set(0x10); // signal config_pkt_xmit to send packet + //thread_3->signal_set(0x10); // signal config_pkt_xmit to send packet + position_changed = true; } Thread::wait(5);