Skip to content

Commit

Permalink
Renamed setSelectedMode to getSelectedMode in Ready state, Adjusted Y…
Browse files Browse the repository at this point in the history
…oda-style in all files
  • Loading branch information
Akram authored and Akram committed Jul 30, 2024
1 parent 579d460 commit d47c8cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/APPReinforcementLearning/src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void App::loop()
{
Status payload = {SMPChannelPayload::Status::NOT_DONE};

if (DrivingState::getInstance().isAbortRequired() == true)
if (true == DrivingState::getInstance().isAbortRequired())
{
payload = {SMPChannelPayload::Status::DONE};
}
Expand All @@ -139,14 +139,14 @@ void App::loop()
}

/* Send Mode selected to The Supervisor. */
if (&ReadyState::getInstance() == m_systemStateMachine.getState() && (!m_modeSelectionSent))
if (&ReadyState::getInstance() == m_systemStateMachine.getState() && (false == m_modeSelectionSent))
{
uint8_t mode_options = ReadyState::getInstance().setSelectedMode();
uint8_t mode_options = ReadyState::getInstance().getSelectedMode();

if (mode_options > 0)
if (0U < mode_options)
{
SMPChannelPayload::Mode payload =
(mode_options == 1) ? SMPChannelPayload::Mode::DRIVING_MODE : SMPChannelPayload::Mode::TRAINING_MODE;
(1 == mode_options) ? SMPChannelPayload::Mode::DRIVING_MODE : SMPChannelPayload::Mode::TRAINING_MODE;

/* Ignoring return value, as error handling is not available. */
(void)m_smpServer.sendData(m_serialMuxProtChannelIdMode, &payload, sizeof(payload));
Expand Down Expand Up @@ -196,7 +196,7 @@ void App::sendLineSensorsData() const
uint8_t lineSensorIdx = 0U;
LineSensorData payload;

if (LINE_SENSOR_CHANNEL_DLC == maxLineSensors * sizeof(uint16_t))
if (LINE_SENSOR_CHANNEL_DLC == (maxLineSensors * sizeof(uint16_t)))
{
while (maxLineSensors > lineSensorIdx)
{
Expand Down
6 changes: 3 additions & 3 deletions lib/APPReinforcementLearning/src/ReadyState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void ReadyState::process(StateMachine& sm)
* If either Button A or Button B is not pressed and the timer
* expires, the training mode should automatically activate.
*/
else if (true == m_modeTimeoutTimer.isTimeout() && (m_mode == IDLE))
else if (true == m_modeTimeoutTimer.isTimeout() && (IDLE == m_mode))
{
m_mode = TRAINING_MODE;
m_modeTimeoutTimer.restart();
Expand All @@ -135,7 +135,7 @@ void ReadyState::process(StateMachine& sm)
/**Drive forward until START LINE is crossed */
driveUntilStartLineisCrossed();

if ((isStartStopLineDetected(lineSensorValues, maxLineSensors) == false) && (m_isLastStartStopLineDetected == true))
if (false == (isStartStopLineDetected(lineSensorValues, maxLineSensors)) && (true == m_isLastStartStopLineDetected))
{
sm.setState(&DrivingState::getInstance());
}
Expand All @@ -156,7 +156,7 @@ void ReadyState::setLapTime(uint32_t lapTime)
m_lapTime = lapTime;
}

uint8_t ReadyState::setSelectedMode()
uint8_t ReadyState::getSelectedMode()
{
return m_mode;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/APPReinforcementLearning/src/ReadyState.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ReadyState : public IState
*
* @return It returns 1 if DrivingMode is selected or 2 if TrainingMode is selected.
*/
uint8_t setSelectedMode();
uint8_t getSelectedMode();

protected:
private:
Expand Down

0 comments on commit d47c8cf

Please sign in to comment.