Skip to content
Snippets Groups Projects
Commit 8cca312f authored by Federico Mandelli's avatar Federico Mandelli
Browse files

[CanProtocol] Fixed pipeline

parent 79a21ae5
No related branches found
No related tags found
1 merge request!169[CanProtocol] Added stats in CanProtocol
......@@ -30,14 +30,8 @@ namespace Boardcore
namespace Canbus
{
CanProtocol::CanProtocol(CanbusDriver* can, MsgHandler onReceive)
{
// We assume the bus to be configured at its max velocity
CanProtocol(can, onReceive, 500 * 1000);
}
CanProtocol::CanProtocol(CanbusDriver* can, MsgHandler onReceive,
uint32_t baudRate)
uint32_t baudRate = 500 * 1000)
: can(can), onReceive(onReceive)
{
loadEstimator = new BusLoadEstimation(baudRate);
......
......@@ -51,16 +51,6 @@ class CanProtocol
using MsgHandler = std::function<void(CanMessage data)>;
public:
/**
* @brief Construct a new CanProtocol object.
*
* @param can Pointer to a CanbusDriver object.
*
* @param onReceive function to be called when a new message is received.
*/
CanProtocol(CanbusDriver* can, MsgHandler onReceive);
/**
* @brief Construct a new CanProtocol object.
*
......@@ -68,7 +58,7 @@ public:
*
* @param onReceive function to be called when a new message is received.
*
* @param baudRate used to calculate bus usage.
* @param baudRate used to calculate bus usage (default 500*1000).
*/
CanProtocol(CanbusDriver* can, MsgHandler onReceive, uint32_t baudRate);
......
......@@ -115,7 +115,7 @@ void sendNewRequest()
protocol->enqueueData(0x00, id, 0x01, 0x00, 0x00, f);
}
class MessageCollector : public ActiveObject
class MessageCollect : public ActiveObject
{
public:
void run() override
......@@ -190,7 +190,7 @@ private:
Stats msgstats;
};
MessageCollector mc;
MessageCollect mc;
int main()
{
......@@ -203,7 +203,10 @@ int main()
bt.samplePoint = SAMPLE_POINT;
CanbusDriver* c1 = new CanbusDriver(CAN1, cfg, bt);
CanbusDriver* c = new CanbusDriver(CAN2, cfg, bt);
if (false && c1)
{
}
CanbusDriver* c = new CanbusDriver(CAN2, cfg, bt);
protocol = new CanProtocol(c, bind(&handleCanMessage, _1), BAUD_RATE);
// Allow every message _1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment