Skip to content

Commit

Permalink
special case one ISR period, remove unused vars.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Aug 8, 2022
1 parent 744f2a2 commit d821b54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions CRIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DigitalPin<coilOutPin> _coilOutPin(OUTPUT, LOW);
DigitalPin<diagOutPin> _diagOutPin(OUTPUT, LOW);
DigitalPin<speakerOutPin> _speakerOutPin(OUTPUT, LOW);

CRIO::CRIO() : scheduled(false), _remainingPulseUs(0), _pulseState(0), pw(pulseWindowUs), maxPitch(maxMidiPitch), breakoutUs(minBreakoutUs), _ticksSinceLastPulse(0), handlePulsePtr(&CRIO::handleNoPulse) {
CRIO::CRIO() : _remainingPulseUs(0), pw(pulseWindowUs), maxPitch(maxMidiPitch), breakoutUs(minBreakoutUs), _ticksSinceLastPulse(0), handlePulsePtr(&CRIO::handleNoPulse) {
}

bool CRIO::percussionEnabled() {
Expand All @@ -30,14 +30,12 @@ inline void CRIO::pulseOn() {
_speakerOutPin.high();
_diagOutPin.high();
_coilOutPin.high();
_pulseState = true;
}

inline void CRIO::pulseOff() {
_coilOutPin.low();
_diagOutPin.low();
_speakerOutPin.low();
_pulseState = false;
}

bool CRIO::handlePulse() {
Expand Down Expand Up @@ -86,7 +84,7 @@ void CRIO::schedulePulse(cr_fp_t pulseUs) {
return;
}
_remainingPulseUs = cr_pulse_t(roundFixed(pulseUs));
if (_remainingPulseUs > masterClockPeriodUs) {
if (_remainingPulseUs >= masterClockPeriodUs) {
handlePulsePtr = &CRIO::handleLongPulse;
} else {
handlePulsePtr = &CRIO::handleShortPulse;
Expand Down
2 changes: 0 additions & 2 deletions CRIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class CRIO {
virtual void updateLcdCoeff();
virtual bool percussionEnabled();
virtual bool fixedPulseEnabled();
bool scheduled;
cr_fp_t pw;
uint8_t maxPitch;
cr_fp_t breakoutUs;
Expand All @@ -51,7 +50,6 @@ class CRIO {
bool handleNoPulse();
void pulseOff();
void pulseOn();
bool _pulseState;
bool (CRIO::*handlePulsePtr)(void);
cr_pulse_t _remainingPulseUs;
uint16_t _ticksSinceLastPulse;
Expand Down

0 comments on commit d821b54

Please sign in to comment.