-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/param_server' of github.com:hytech-racing/MCU i…
…nto feature/param_server
- Loading branch information
Showing
6 changed files
with
60 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
#ifndef __ETHERNETINTERFACE_H__ | ||
#define __ETHERNETINTERFACE_H__ | ||
#ifndef ETHERNETINTERFACE | ||
#define ETHERNETINTERFACE | ||
#include <QNEthernet.h> | ||
|
||
#include <Arduino.h> | ||
#include "QNEthernet.h" | ||
#include "circular_buffer.h" | ||
|
||
using namespace qindesign::network; | ||
|
||
EthernetUDP udp; | ||
|
||
uint8_t mac_address[6]; | ||
class EthernetInterface | ||
{ | ||
public: | ||
EthernetInterface() {}; | ||
void begin(int port); | ||
/// @brief sends all udp packets in queue | ||
void handle_sending(); | ||
/// @brief receives all udp packets | ||
void handle_recvs(); | ||
|
||
void init_ethernet_device(); | ||
private: | ||
EthernetUDP udp_ethernet_; | ||
} | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,16 @@ | ||
#pragma once | ||
#include <unordered_map> | ||
#ifndef PARAMETERSYSTEM | ||
#define PARAMETERSYSTEM | ||
#include "Parameters.h" | ||
|
||
namespace Parameters { | ||
template<typename T> | ||
void setParameter(T& paramType, float value) { | ||
paramType.set(value); | ||
} | ||
|
||
class FloatParameter { | ||
public: | ||
virtual float get() const = 0; | ||
virtual void set(float value) = 0; | ||
virtual ~FloatParameter() {} | ||
}; | ||
template<typename T> | ||
auto getParameter(T& paramType){ | ||
return paramType.get(); | ||
} | ||
|
||
class BoolParameter { | ||
public: | ||
virtual bool get() const = 0; | ||
virtual void set(bool value) = 0; | ||
virtual ~BoolParameter() {} | ||
}; | ||
|
||
class MaxSpeed : public FloatParameter { | ||
float value; | ||
public: | ||
MaxSpeed() : value(120.0) {} | ||
float get() const override { return value; } | ||
void set(float v) override { value = v; } | ||
}; | ||
|
||
class Threshold : public FloatParameter { | ||
float value; | ||
public: | ||
Threshold() : value(0.75) {} | ||
float get() const override { return value; } | ||
void set(float v) override { value = v; } | ||
}; | ||
|
||
class IsActive : public BoolParameter { | ||
bool value; | ||
public: | ||
IsActive() : value(false) {} | ||
bool get() const override { return value; } | ||
void set(bool v) override { value = v; } | ||
}; | ||
|
||
MaxSpeed MaxSpeedInstance; | ||
Threshold ThresholdInstance; | ||
std::unordered_map<const char *, Parameters::FloatParameter*> floatLookupMap = { | ||
{"b1fc2577", &MaxSpeedInstance}, | ||
{"0da627ad", &ThresholdInstance}, | ||
}; | ||
|
||
IsActive IsActiveInstance; | ||
std::unordered_map<const char *, Parameters::BoolParameter*> boolLookupMap = { | ||
{"57401e59", &IsActiveInstance}, | ||
}; | ||
|
||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
syntax = "proto3"; | ||
|
||
package ht_eth; | ||
|
||
message config | ||
{ | ||
string id = 1; | ||
oneof config_val { | ||
bool bool_val = 2; | ||
float float_val = 3; | ||
int32 int_val = 4; | ||
} | ||
} | ||
|
||
message CASE_output | ||
{ | ||
float vehm_fl_slip = 1; | ||
float vehm_fr_slip = 2; | ||
float vehm_rl_slip = 3; | ||
float vehm_rr_slip = 4; | ||
} |