
UART Command Parser Time Manager Data Store for SD Card for stm32l476 [it's not Licensed as BSD/GPLx]
Dependencies: mbed SDFileSystem
Diff: common/DeviceRepeater.cpp
- Revision:
- 17:c2709a9c0a68
- Parent:
- 16:602bc04e3cb5
--- a/common/DeviceRepeater.cpp Thu May 30 03:00:15 2019 +0000 +++ b/common/DeviceRepeater.cpp Mon Jun 10 23:50:04 2019 +0000 @@ -18,6 +18,7 @@ stat = DEV_NOT_INIT; repeat_max_count = DEFAULT_REPEAT_MAX_COUNT; repeat_stride_sec = DEFAULT_REPEAT_STRIDE; + repeat_singleshot = DEFAULT_REPEAT_SINGLESHOT; } bool DeviceRepeater::readyToStart(void) @@ -70,6 +71,17 @@ return true; } +bool DeviceRepeater::setRepeatSingleShot(bool setMode) +{ + /* never accept in Not Ready To Run */ + if (!this->readyToStart()) { + return false; + } + /* TODO */ + repeat_singleshot = setMode; + return true; +} + bool DeviceRepeater::start(void) { bool ret; @@ -136,13 +148,34 @@ repeat_remain_sec--; } if (repeat_remain_sec == 0) { + bool procRun; FILE *pSDFile = pSds->getFilePointer(); /*****************************************************/ /* TODO - kick Senser and send XFD/XDS Data */ /*****************************************************/ /** Sensing and Sending Data **/ - pDriver->exec(deviceID, pUR->getCurrentUart(), pSDFile); + procRun = pDriver->exec(deviceID, pUR->getCurrentUart(), pSDFile); pSds->syncFile(); + if (repeat_singleshot) { + /* Check Exec Sigle On */ + if (procRun == true) { + /* Already - Executed Mesurement in exec */ + /** GOTO Shutdown */ + /* STOP ticking (0->1) */ + /*****************************************************/ + /* TODO - add callback for changing RUNNING to READY */ + /*****************************************************/ + repeat_remain_cnt = 0; + pDriver->run2ready(); + pSds->syncFile(); + repeat_remain_sec = 0; + stat = DEV_READY; + pClock->detach(); + return; + } else { + /* Not Yet - NO Execution in exec */ + } + } } if (repeat_remain_sec <= 0) { if (repeat_remain_cnt > 0) {