Skip to content

Commit

Permalink
Removed debug functions.
Browse files Browse the repository at this point in the history
Commited by error in f9d2e4c
  • Loading branch information
gabryelreyes committed Oct 20, 2023
1 parent 8713c0f commit 30c5cf8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 47 deletions.
59 changes: 13 additions & 46 deletions lib/RemoteControl/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ void App::setup()

/* Providing line sensor data */
m_smpChannelIdLineSensors = m_smpServer.createChannel(CH_NAME_LINE_SENSORS, lineSensorChannelDlc);

(void)m_smpServer.createChannel("DEBUG", (6U * sizeof(int16_t)));
}

void App::loop()
Expand Down Expand Up @@ -170,57 +168,26 @@ void App::sendRemoteControlResponses()
(void)m_smpServer.sendData(m_smpChannelIdRemoteCtrlRsp, payload, sizeof(remoteControlRspId));

m_lastRemoteControlRspId = remoteControlRspId;

uint8_t payloadSize = (6U * sizeof(int16_t));
uint8_t buffer[payloadSize] = {0U};
Util::int16ToByteArray(&buffer[0U * sizeof(int16_t)], sizeof(int16_t),
DifferentialDrive::getInstance().getMaxMotorSpeed());
(void)m_smpServer.sendData("DEBUG", buffer, payloadSize);
}
}

void App::sendLineSensorsData() const
{
// ILineSensors& lineSensors = Board::getInstance().getLineSensors();
// uint8_t maxLineSensors = lineSensors.getNumLineSensors();
// const uint16_t* lineSensorValues = lineSensors.getSensorValues();
// uint8_t lineSensorIdx = 0U;
// uint8_t payload[maxLineSensors * sizeof(uint16_t)];

// while (maxLineSensors > lineSensorIdx)
// {
// Util::uint16ToByteArray(&payload[lineSensorIdx * sizeof(uint16_t)], sizeof(uint16_t),
// lineSensorValues[lineSensorIdx]);

// ++lineSensorIdx;
// }

// (void)m_smpServer.sendData(m_smpChannelIdLineSensors, payload, sizeof(payload));

uint8_t payloadSize = (12U);
uint8_t buffer[payloadSize] = {0U};

int16_t linearSetpointLeft;
int16_t linearSetpointRight;

DifferentialDrive::getInstance().getLinearSpeed(linearSetpointLeft, linearSetpointRight);

Util::int16ToByteArray(&buffer[0U * sizeof(int16_t)], sizeof(int16_t),
DifferentialDrive::getInstance().getLinearSpeed());
Util::int16ToByteArray(&buffer[1U * sizeof(int16_t)], sizeof(int16_t),
Speedometer::getInstance().getLinearSpeedCenter());
Util::int16ToByteArray(&buffer[2U * sizeof(int16_t)], sizeof(int16_t), linearSetpointLeft);
Util::int16ToByteArray(&buffer[3U * sizeof(int16_t)], sizeof(int16_t),
Speedometer::getInstance().getLinearSpeedLeft());
Util::int16ToByteArray(&buffer[4U * sizeof(int16_t)], sizeof(int16_t), linearSetpointRight);
Util::int16ToByteArray(&buffer[5U * sizeof(int16_t)], sizeof(int16_t),
Speedometer::getInstance().getLinearSpeedRight());

IMotors& motors = Board::getInstance().getMotors();
if (0 == motors.getLeftSpeed())
ILineSensors& lineSensors = Board::getInstance().getLineSensors();
uint8_t maxLineSensors = lineSensors.getNumLineSensors();
const uint16_t* lineSensorValues = lineSensors.getSensorValues();
uint8_t lineSensorIdx = 0U;
uint8_t payload[maxLineSensors * sizeof(uint16_t)];

while (maxLineSensors > lineSensorIdx)
{
(void)m_smpServer.sendData("DEBUG", buffer, payloadSize);
Util::uint16ToByteArray(&payload[lineSensorIdx * sizeof(uint16_t)], sizeof(uint16_t),
lineSensorValues[lineSensorIdx]);

++lineSensorIdx;
}

(void)m_smpServer.sendData(m_smpChannelIdLineSensors, payload, sizeof(payload));
}

/******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion lib/RemoteControl/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class App
static const uint32_t DIFFERENTIAL_DRIVE_CONTROL_PERIOD = 5;

/** Sending Data period in ms. */
static const uint32_t SEND_LINE_SENSORS_DATA_PERIOD = 1000;
static const uint32_t SEND_LINE_SENSORS_DATA_PERIOD = 20;

/** SerialMuxProt channel name for receiving commands. */
static const char* CH_NAME_CMD;
Expand Down

0 comments on commit 30c5cf8

Please sign in to comment.