Dave H's version of the EVB Demo. Sends to specific conduit, and sends with a comma separated text string
Dependencies: DOGS102 ISL29011 MMA845x MPL3115A2 NCP5623B libmDot mbed-rtos mbed-src
Fork of MTDOT-EVBDemo by
Revision 7:74c027d0353b, committed 2015-08-24
- Comitter:
- daveheitzman
- Date:
- Mon Aug 24 18:55:25 2015 +0000
- Parent:
- 6:b62e5106b5bc
- Child:
- 8:014495d266f3
- Commit message:
- when an error is encountered on reading the barometer, it deletes it and rebuilds a new one. Now continues reporting readings after failures.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Aug 24 16:38:59 2015 +0000 +++ b/main.cpp Mon Aug 24 18:55:25 2015 +0000 @@ -96,6 +96,8 @@ SPI mDotspi(PA_7,PA_6,PA_5); // mDot external SPI mDot11, mDot4, and mDot18 +MPL3115A2* resetBaro(const MPL3115A2* oldBaro); + /* **** replace these values with the proper public or private network settings **** * config_network_nameand config_network_pass are for private networks. */ @@ -423,7 +425,10 @@ result = evbAccel->getStatus(); failtime--; } while ((result & MMA845x::XYZDR) == 0 && failtime > 0); - if (failtime==0) {continue; } + if (failtime==0) { + evbBaro=resetBaro(evbBaro); + continue; + } /* * Retrieve and print out accelerometer data @@ -455,7 +460,12 @@ result = evbBaro->getStatus(); failtime--; } while ((result & MPL3115A2::PTDR) == 0 && failtime > 0 ); - if (failtime==0) {continue; } + if (failtime==0) { + evbBaro=resetBaro(evbBaro); + continue; + } + + /* * Retrieve and print out barometric pressure */ @@ -488,7 +498,10 @@ result = evbBaro->getStatus(); failtime--; } while ((result & MPL3115A2::PTDR) == 0 && failtime > 0 ); - if (failtime==0) {continue; } + if (failtime==0) { + evbBaro=resetBaro(evbBaro); + continue; + } /* * Retrieve and print out altitude and temperature @@ -727,3 +740,14 @@ return res; } +MPL3115A2* resetBaro(const MPL3115A2* oldBaro){ + delete oldBaro; + MPL3115A2* baro = new MPL3115A2(mDoti2c); + baro->testWhoAmI(); + + printf("Resetting barometer.. %x \n\r", baro->getStatus() ); + baro->setParameters(MPL3115A2::DATA_NORMAL, MPL3115A2::DM_BAROMETER, MPL3115A2::OR_16, + MPL3115A2::AT_1); + evbBaro->clearMinMaxRegs(); + return baro; +} \ No newline at end of file