50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "Config.h"
|
|
#include "Buttons.h"
|
|
#include "Display.h"
|
|
#include "Pwm.h"
|
|
#include "Receiver.h"
|
|
|
|
class SignalProbe {
|
|
public:
|
|
SignalProbe();
|
|
void begin();
|
|
void update();
|
|
|
|
private:
|
|
bool captureStart();
|
|
void resetMinimum();
|
|
void updateCapture();
|
|
void advanceFrequency();
|
|
void advancePulse();
|
|
void applyPwm();
|
|
void show();
|
|
|
|
Button startButton_, modeButton_;
|
|
Display display_;
|
|
PwmGenerator pwm_;
|
|
PulseReceiver receiver_;
|
|
ActualPwm actual_ = {};
|
|
uint8_t frequencyIndex_ = 2;
|
|
uint8_t pulseIndex_ = 0;
|
|
bool pwmEnabled_ = true;
|
|
bool rxActiveHigh_ = RX_LIGHT_ON_GPIO_LEVEL == HIGH;
|
|
bool receiverInitialized_ = false;
|
|
bool rxReady_ = false;
|
|
bool havePulseStart_ = false;
|
|
bool havePulseEnd_ = false;
|
|
bool extraEdgeInPeriod_ = false;
|
|
bool displayDirty_ = true;
|
|
uint64_t pulseStartTick_ = 0;
|
|
uint64_t pulseEndTick_ = 0;
|
|
uint64_t minTicks_ = UINT64_MAX;
|
|
uint64_t pulseCount_ = 0;
|
|
uint64_t edgeCount_ = 0;
|
|
uint64_t rejectedPeriods_ = 0;
|
|
uint32_t lastDisplayMs_ = 0;
|
|
uint32_t bothHeldSinceMs_ = 0;
|
|
bool bothHeld_ = false;
|
|
bool bothHeldHandled_ = false;
|
|
};
|