src/encoder.hpp
void ICACHE_RAM_ATTR PinA() {
    cli(); // stop interrupts happening before we read pin values
    _reading_a = digitalRead(_pin_a);
    _reading_b = digitalRead(_pin_b);
    if (_reading_a && _reading_b && _a_flag) { // check that we have both pins at detent (HIGH) and that we are
                                               // expecting detent on this pin's rising edge
        _position++;
        _a_flag = 0;
        _b_flag = 0;
    } else if (_reading_a && !_reading_b) {
        _b_flag = 1; // signal that we're expecting pin B to signal the transition to detent from free rotation
    }
    sei(); // restart interrupts
}
// somewhere to store the direct values we read from our interrupt pins before checking to see
// if we have moved a whole detent
somewhere to store the direct values we read from our interrupt pins before checking to see
if we have moved a whole detent
somewhere to store the direct values we read from our interrupt pins before checking to see if we have moved a whole detent
void ICACHE_RAM_ATTR PinA() {
    cli(); 
    _reading_a = digitalRead(_pin_a);
    _reading_b = digitalRead(_pin_b);
    if (_reading_a && _reading_b && _a_flag) { 
        _position++;
        _a_flag = 0;
        _b_flag = 0;
    } else if (_reading_a && !_reading_b) {
        _b_flag = 1; 
    }
    sei(); 
}
void ICACHE_RAM_ATTR PinA ( ) { cli ( ) ; _reading_a = digitalRead ( _pin_a ) ; _reading_b = digitalRead ( _pin_b ) ; if ( _reading_a && _reading_b && _a_flag ) { _position ++ ; _a_flag = 0 ; _b_flag = 0 ; } else if ( _reading_a && ! _reading_b ) { _b_flag = 1 ; } sei ( ) ; }
somewhere to store the direct values we read from our interrupt pins before checking to see
if we have moved a whole detent
somewhere to store the direct values we read from our interrupt pins before checking to see if we have moved a whole detent
// stop interrupts happening before we read pin values // check that we have both pins at detent (HIGH) and that we are // expecting detent on this pin's rising edge // signal that we're expecting pin B to signal the transition to detent from free rotation // restart interrupts