save!
This commit is contained in:
parent
1fc400c695
commit
4d5c26d10c
4 changed files with 46 additions and 10 deletions
|
@ -3,12 +3,29 @@
|
|||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
|
||||
#define ENCODER_COUNT 4
|
||||
#define ENCODER_CACHE_DURATION_MS 4 // 200 HZ
|
||||
|
||||
class Encoder {
|
||||
public:
|
||||
static std::vector<int32_t> read_all();
|
||||
std::vector<int32_t> read_all();
|
||||
std::vector<int32_t> read_all_cached();
|
||||
|
||||
static Encoder& get_instance()
|
||||
{
|
||||
static Encoder instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
Encoder(Encoder const&) = delete;
|
||||
void operator=(Encoder const&) = delete;
|
||||
|
||||
private:
|
||||
Encoder();
|
||||
int32_t encoder_cache[ENCODER_COUNT] = {0};
|
||||
std::chrono::time_point<std::chrono::system_clock> last_read = std::chrono::system_clock::now();
|
||||
};
|
||||
|
||||
#endif // COMPLIB_SERVER_ENCODER_HPP
|
Reference in a new issue