Fork for https://developer.mbed.org/users/jony1401/code/SenseAirLP8/
Dependencies: BLE_API mbed nRF51822
Fork of SenseAirLP8 by
Diff: main.cpp
- Revision:
- 5:2c80954571b6
- Parent:
- 3:933dd59ad44d
--- a/main.cpp Mon Aug 21 08:44:33 2017 +0000 +++ b/main.cpp Mon Aug 28 08:50:49 2017 +0000 @@ -95,8 +95,8 @@ uint8_t sentCCbyte = 0x99; -//setup LP8 object -LP8 *lp8 = new LP8(Device, VBB_EN, RDY, Res, lp8Wait); + //setup LP8 object + LP8 *lp8 = new LP8(Device, VBB_EN, RDY, Res, lp8Wait); //Setup GattService @@ -106,7 +106,7 @@ Vcap, errorFlag, ccByte, sentCCbyte); // lp8Service; -// setup ble advertising parameters + // setup ble advertising parameters ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); //general bluetooth information(only support for ble ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); //service list ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); @@ -114,11 +114,12 @@ ble.gap().setAdvertisingInterval(BLE_ADV_INTERVAL); /* advertising interval in ms. */ ble.gap().startAdvertising(); -// Wait for initialization to complete. + // Wait for initialization to complete. while (ble.hasInitialized() == false) { /* spin loop */ } - + /* Waiting while super-capacitor will charged for a first measurement */ + wait(SENSOR_TIMER); //*************************** start the main loop *********************************** @@ -131,7 +132,7 @@ lp8->responsePurge(50); //purge buffer if ( lp8->lp8Init() != true ) { //initCheck = true; - } + } else { initCheck = false;