From c992495e429912dcfe22c24f313ded7b18fb6e18 Mon Sep 17 00:00:00 2001 From: Nathan Hui Date: Thu, 31 Oct 2024 20:25:02 -0700 Subject: [PATCH] style: Formats document --- src/rideTask.cpp | 68 ++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/src/rideTask.cpp b/src/rideTask.cpp index 8a7849e..947161b 100644 --- a/src/rideTask.cpp +++ b/src/rideTask.cpp @@ -22,7 +22,7 @@ /** * @brief creates file name for log * @todo implement RIDE_setFileName - * @param startTime + * @param startTime */ static void RIDE_setFileName(system_tick_t startTime) { @@ -30,24 +30,20 @@ static void RIDE_setFileName(system_tick_t startTime) } /** @brief deployment schedule of ensembles to run * @see SCH_getNextEvent -*/ -DeploymentSchedule_t deploymentSchedule[] = -{ - {nullptr, nullptr, 0, 0, 0, 0, nullptr, {0}} -}; + */ +DeploymentSchedule_t deploymentSchedule[] = {{nullptr, nullptr, 0, 0, 0, 0, nullptr, {0}}}; RideTask::RideTask() : scheduler(deploymentSchedule) { - } /** * @brief initialize ride task * Sets LEDs and initializes schedule -*/ + */ void RideTask::init() { - SF_OSAL_printf("Entering STATE_DEPLOYED" __NL__); + SF_OSAL_printf("Entering STATE_DEPLOYED" __NL__); pSystemDesc->pChargerCheck->start(); this->ledStatus.setColor(RIDE_RGB_LED_COLOR); this->ledStatus.setPattern(RIDE_RGB_LED_PATTERN_GPS); @@ -55,35 +51,29 @@ void RideTask::init() this->ledStatus.setPriority(RIDE_RGB_LED_PRIORITY); this->ledStatus.setActive(); - - this->startTime = millis(); - + this->scheduler.initializeScheduler(); pSystemDesc->pRecorder->openSession(); - } /** -* @brief runs tasks given by scheduler -*/ + * @brief runs tasks given by scheduler + */ STATES_e RideTask::run(void) { - - DeploymentSchedule_t* pNextEvent = NULL; + DeploymentSchedule_t *pNextEvent = NULL; system_tick_t nextEventTime; - - SF_OSAL_printf( __NL__ "Deployment started at %" PRId32 __NL__, millis()); + + SF_OSAL_printf(__NL__ "Deployment started at %" PRId32 __NL__, millis()); while (1) { RIDE_setFileName(this->startTime); - SCH_error_e retval = this->scheduler.getNextTask(&pNextEvent, - &nextEventTime, - millis()); - //Check if scheduler failed to find nextEvent + SCH_error_e retval = this->scheduler.getNextTask(&pNextEvent, &nextEventTime, millis()); + // Check if scheduler failed to find nextEvent if (TASK_SEARCH_FAIL == retval) { SF_OSAL_printf("getNextEvent is null! Exiting RideTask..." __NL__); @@ -93,41 +83,35 @@ STATES_e RideTask::run(void) delay(nextEventTime - millis()); SF_OSAL_printf("|%" PRId32, (std::uint32_t)millis()); pNextEvent->measure(pNextEvent); - SF_OSAL_printf("|%" PRId32 __NL__, (std::uint32_t)millis()); - + SF_OSAL_printf("|%" PRId32 __NL__, (std::uint32_t)millis()); + // pNextEvent->lastMeasurementTime = nextEventTime; - if(pSystemDesc->pWaterSensor->getLastStatus() == - WATER_SENSOR_LOW_STATE) + if (pSystemDesc->pWaterSensor->getLastStatus() == WATER_SENSOR_LOW_STATE) { - SF_OSAL_printf("Out of water!" __NL__); + SF_OSAL_printf("Out of water!" __NL__); return STATE_UPLOAD; } - if(pSystemDesc->flags->batteryLow) + if (pSystemDesc->flags->batteryLow) { - SF_OSAL_printf("Low Battery!" __NL__); + SF_OSAL_printf("Low Battery!" __NL__); return STATE_DEEP_SLEEP; } - - - } return STATE_UPLOAD; } - /** -* @brief exits ride state -*/ + * @brief exits ride state + */ void RideTask::exit(void) { - SF_OSAL_printf("Closing session" __NL__); + SF_OSAL_printf("Closing session" __NL__); pSystemDesc->pRecorder->closeSession(); // Deinitialize sensors - //pSystemDesc->pTempSensor->stop(); - //pSystemDesc->pCompass->close(); - //pSystemDesc->pIMU->close(); - //pSystemDesc->pGPS->gpsModuleStop(); - + // pSystemDesc->pTempSensor->stop(); + // pSystemDesc->pCompass->close(); + // pSystemDesc->pIMU->close(); + // pSystemDesc->pGPS->gpsModuleStop(); }