You've already forked TEF6686_ESP32
c with classes and also remove useless drivers in tft_espi
This commit is contained in:
@@ -440,7 +440,7 @@ typedef struct _rds_ {
|
||||
String stationText32;
|
||||
String RTContent1;
|
||||
String RTContent2;
|
||||
String PTYN;
|
||||
Detector<String, 1> PTYN{""};
|
||||
String ECCtext;
|
||||
String stationIDtext;
|
||||
String stationNameLong;
|
||||
@@ -466,23 +466,23 @@ typedef struct _rds_ {
|
||||
bool rdsBerror;
|
||||
bool rdsCerror;
|
||||
bool rdsDerror;
|
||||
bool hasArtificialhead;
|
||||
bool hasCompressed;
|
||||
Detector<bool, 1> hasArtificialhead{false};
|
||||
Detector<bool, 1> hasCompressed{false};
|
||||
bool hasDynamicPTY;
|
||||
bool hasStereo;
|
||||
Detector<bool, 1> hasStereo{false};
|
||||
bool hasRDS;
|
||||
bool hasECC;
|
||||
bool hasDABAF;
|
||||
bool hasLongPS;
|
||||
bool hasRT;
|
||||
bool hasEnhancedRT;
|
||||
bool TP;
|
||||
bool hasTA;
|
||||
Detector<bool, 1> TP{false};
|
||||
Detector<bool, 1> TA{false};
|
||||
Detector<bool, 1> hasEON{false};
|
||||
bool hasAID;
|
||||
Detector<bool, 1> hasTMC{false};
|
||||
bool hasAF;
|
||||
bool hasCT;
|
||||
Detector<bool, 1> hasCT{false};
|
||||
bool hasPTYN;
|
||||
bool rtAB;
|
||||
bool rtAB32;
|
||||
@@ -507,10 +507,10 @@ typedef struct _af_ {
|
||||
} af_;
|
||||
|
||||
typedef struct _eon_ {
|
||||
uint16_t mappedfreq;
|
||||
uint16_t mappedfreq2;
|
||||
uint16_t mappedfreq3;
|
||||
uint16_t pi;
|
||||
uint16_t mappedfreq;
|
||||
uint16_t mappedfreq2;
|
||||
uint16_t mappedfreq3;
|
||||
uint16_t pi;
|
||||
char picode[6];
|
||||
String ps;
|
||||
bool ta;
|
||||
|
||||
@@ -4,20 +4,23 @@
|
||||
template <typename T, size_t MaxObservers>
|
||||
class Detector {
|
||||
public:
|
||||
explicit Detector(T initial) : value(initial) {
|
||||
explicit Detector(T initial) : value(initial), prev(initial) {
|
||||
for (size_t i = 0; i < MaxObservers; ++i) seen[i] = false;
|
||||
}
|
||||
|
||||
void set(const T& v) {
|
||||
if (v == value) return;
|
||||
|
||||
prev = value;
|
||||
value = v;
|
||||
for (size_t i = 0; i < MaxObservers; ++i) seen[i] = false;
|
||||
}
|
||||
|
||||
void amend(const T& v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
bool changed(size_t id) {
|
||||
if (id >= MaxObservers) return false;
|
||||
|
||||
if (!seen[id]) {
|
||||
seen[id] = true;
|
||||
return true;
|
||||
@@ -25,11 +28,68 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
const T& get() const {
|
||||
const T& get() const { return value; }
|
||||
const T& getPrev() const { return prev; }
|
||||
|
||||
template <typename U>
|
||||
Detector& operator+=(const U& d) { set(value + d); return *this; }
|
||||
|
||||
template <typename U>
|
||||
Detector& operator-=(const U& d) { set(value - d); return *this; }
|
||||
|
||||
template <typename U>
|
||||
Detector& operator*=(const U& d) { set(value * d); return *this; }
|
||||
|
||||
template <typename U>
|
||||
Detector& operator/=(const U& d) { set(value / d); return *this; }
|
||||
|
||||
template <typename U>
|
||||
Detector& operator%=(const U& d) { set(value % d); return *this; }
|
||||
|
||||
template <typename U>
|
||||
T operator+(const U& d) const { return value + d; }
|
||||
|
||||
template <typename U>
|
||||
T operator-(const U& d) const { return value - d; }
|
||||
|
||||
template <typename U>
|
||||
T operator*(const U& d) const { return value * d; }
|
||||
|
||||
template <typename U>
|
||||
T operator/(const U& d) const { return value / d; }
|
||||
|
||||
template <typename U>
|
||||
T operator%(const U& d) const { return value % d; }
|
||||
|
||||
template <typename U>
|
||||
bool operator==(const U& v) const { return value == v; }
|
||||
|
||||
template <typename U>
|
||||
bool operator!=(const U& v) const { return value != v; }
|
||||
|
||||
template <typename U>
|
||||
bool operator<(const U& v) const { return value < v; }
|
||||
|
||||
template <typename U>
|
||||
bool operator>(const U& v) const { return value > v; }
|
||||
|
||||
template <typename U>
|
||||
bool operator<=(const U& v) const { return value <= v; }
|
||||
|
||||
template <typename U>
|
||||
bool operator>=(const U& v) const { return value >= v; }
|
||||
|
||||
Detector& operator=(const T& v) {
|
||||
set(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator const T&() const {
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
T value;
|
||||
T prev;
|
||||
bool seen[MaxObservers];
|
||||
};
|
||||
|
||||
@@ -37,18 +37,18 @@ extern TFT_eSPI tft;
|
||||
extern bool dynamicspi;
|
||||
extern bool Data_Accelerator;
|
||||
extern bool advancedRDS, afmethodBold, afpage;
|
||||
extern bool afscreen, aftest, artheadold;
|
||||
extern bool afscreen, aftest;
|
||||
extern bool autoDST, autolog, autologged;
|
||||
extern bool autosquelch, batterydetect, beepresetstart;
|
||||
extern bool beepresetstop, BWreset, bwtouchtune;
|
||||
extern bool BWtune, change, clockampm;
|
||||
extern bool compressedold, direction, dropout;
|
||||
extern bool direction, dropout;
|
||||
extern bool dynamicPTYold, edgebeep, externaltune;
|
||||
extern bool findMemoryAF;
|
||||
extern bool firstTouchHandled;
|
||||
extern bool flashing;
|
||||
extern bool fmsi, fullsearchrds;
|
||||
extern bool hasafold, hasCTold, haseonold;
|
||||
extern bool hasafold, haseonold;
|
||||
extern bool initdxscan, invertdisplay, leave;
|
||||
extern bool LowLevelInit;
|
||||
extern bool memorystore;
|
||||
@@ -62,7 +62,6 @@ extern bool rdsflagreset;
|
||||
extern bool rdsreset;
|
||||
extern bool rdsstatscreen;
|
||||
extern bool RDSSPYTCP, RDSSPYUSB;
|
||||
extern bool rdsstereoold;
|
||||
extern bool rotaryaccelerate;
|
||||
extern bool rtcset;
|
||||
extern bool scandxmode;
|
||||
@@ -85,7 +84,6 @@ extern bool SQ;
|
||||
extern bool Stereostatusold;
|
||||
extern bool StereoToggle;
|
||||
extern bool store;
|
||||
extern bool TAold, TPold;
|
||||
extern bool touchrepeat;
|
||||
extern bool touch_detect;
|
||||
extern bool tuned;
|
||||
@@ -243,7 +241,6 @@ extern int SStatusold;
|
||||
extern int Stereostatus;
|
||||
extern int volume;
|
||||
extern int XDRBWset;
|
||||
extern int XDRBWsetold;
|
||||
extern int xPos;
|
||||
extern int xPos2;
|
||||
extern int16_t OStatus;
|
||||
@@ -272,7 +269,6 @@ extern String ECCString;
|
||||
extern String eonpsold[20];
|
||||
extern String PIold;
|
||||
extern String PSold;
|
||||
extern String ptynold;
|
||||
extern String PTYold;
|
||||
extern String rds_clock;
|
||||
extern String rds_clockold;
|
||||
@@ -290,8 +286,7 @@ extern String StereoStatusCommandold;
|
||||
extern String SWMIBandstring;
|
||||
extern String SWMIBandstringold;
|
||||
extern String XDRGTK_key;
|
||||
extern String XDRGTKRDS;
|
||||
extern String XDRGTKRDSold;
|
||||
extern Detector<String, 1> XDRGTKRDS;
|
||||
extern uint16_t BW;
|
||||
extern uint16_t MStatus;
|
||||
extern uint16_t SWMIBandPos;
|
||||
@@ -302,7 +297,7 @@ extern uint16_t WAM;
|
||||
extern uint8_t buff_pos;
|
||||
extern unsigned int ConverterSet;
|
||||
extern unsigned int freq_scan;
|
||||
extern unsigned int frequency;
|
||||
extern Detector<unsigned int, 1> frequency;
|
||||
extern unsigned int frequency_OIRT;
|
||||
extern unsigned int frequency_AM;
|
||||
extern unsigned int frequency_LW;
|
||||
@@ -323,7 +318,6 @@ extern unsigned int frequency_MIBand_75M;
|
||||
extern unsigned int frequency_MIBand_90M;
|
||||
extern unsigned int frequency_MW;
|
||||
extern unsigned int frequency_SW;
|
||||
extern unsigned int frequencyold;
|
||||
extern unsigned int HighEdgeOIRTSet;
|
||||
extern unsigned int HighEdgeSet;
|
||||
extern unsigned int LowEdgeOIRTSet;
|
||||
@@ -348,8 +342,6 @@ extern unsigned long aftickerhold;
|
||||
extern unsigned long aftimer;
|
||||
extern unsigned long autosquelchtimer;
|
||||
extern unsigned long blockcounterold[33];
|
||||
extern unsigned long eccticker;
|
||||
extern unsigned long ecctickerhold;
|
||||
extern unsigned long eonticker;
|
||||
extern unsigned long eontickerhold;
|
||||
extern unsigned long flashingtimer;
|
||||
@@ -363,8 +355,6 @@ extern unsigned long peakholdmillis;
|
||||
extern unsigned long processed_rdsblocksold[33];
|
||||
extern unsigned long pslongticker;
|
||||
extern unsigned long pslongtickerhold;
|
||||
extern unsigned long rtplusticker;
|
||||
extern unsigned long rtplustickerhold;
|
||||
extern unsigned long rtticker;
|
||||
extern unsigned long rttickerhold;
|
||||
extern unsigned long rotarytimer;
|
||||
|
||||
Reference in New Issue
Block a user