This commit is contained in:
@ -40,7 +40,7 @@ struct GpioEvent {
|
||||
pin_type pin_id;
|
||||
GpioEvent::Type event;
|
||||
|
||||
GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event){
|
||||
GpioEvent(uint64_t timestamp, pin_type pin_id, GpioEvent::Type event) {
|
||||
this->timestamp = timestamp;
|
||||
this->pin_id = pin_id;
|
||||
this->event = event;
|
||||
|
@ -51,7 +51,7 @@ void LinearAxis::update() {
|
||||
}
|
||||
|
||||
void LinearAxis::interrupt(GpioEvent ev) {
|
||||
if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value){
|
||||
if (ev.pin_id == step_pin && !Gpio::pin_map[enable_pin].value) {
|
||||
if (ev.event == GpioEvent::RISE) {
|
||||
last_update = ev.timestamp;
|
||||
position += -1 + 2 * Gpio::pin_map[dir_pin].value;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
return (*(intptr_t*)timerid);
|
||||
}
|
||||
|
||||
static void handler(int sig, siginfo_t *si, void *uc){
|
||||
static void handler(int sig, siginfo_t *si, void *uc) {
|
||||
Timer* _this = (Timer*)si->si_value.sival_ptr;
|
||||
_this->avg_error += (Clock::nanos() - _this->start_time) - _this->period; //high_resolution_clock is also limited in precision, but best we have
|
||||
_this->avg_error /= 2; //very crude precision analysis (actually within +-500ns usually)
|
||||
|
Reference in New Issue
Block a user