Bugfixing

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-07-16 16:45:55 +02:00
parent 7369a5ea90
commit 7583d80646
3 changed files with 19 additions and 6 deletions

View File

@@ -620,8 +620,8 @@ void loop() {
if (power == true) {
Communication();
if (af) {
if ((aftest && millis() >= aftimer + 3000) || (USN > 250 || WAM > 250)) {
if (af && radio.rds.correctPI != 0) {
if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) {
aftimer = millis();
aftest = false;
frequency = radio.TestAF();
@@ -1583,6 +1583,7 @@ void ModeButtonPress() {
EEPROM.writeInt(EE_INT16_AMLEVELOFFSET, AMLevelOffset);
EEPROM.writeByte(EE_BYTE_UNIT, unit);
EEPROM.writeByte(EE_BYTE_AF, af);
EEPROM.writeByte(EE_BYTE_STEREO, StereoToggle);
EEPROM.commit();
Serial.end();
if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
@@ -3050,6 +3051,7 @@ void readRds() {
if (!advancedRDS) tft.drawString(RTold, 1, 223, GFXFF);
dropout = true;
aftest = true;
aftimer = millis();
} else {
if (dropout == true && PIold.length() != 0) {
tft.setTextColor(PrimaryColor);

View File

@@ -25,12 +25,11 @@ uint16_t TEF6686::TestAF() {
uint16_t currentusn;
uint16_t currentwam;
int16_t currentoffset;
uint16_t currentpi;
byte timing;
devTEF_Radio_Get_Quality_Status(&status, &currentlevel, &currentusn, &currentwam, &currentoffset, &dummy1, &dummy2, &dummy3);
devTEF_Radio_Get_RDS_Status(&rdsStat, &currentpi, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
devTEF_Radio_Get_RDS_Status(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
for (int x = 0; x < af_counter; x++) {
timing = 0;
@@ -57,7 +56,7 @@ uint16_t TEF6686::TestAF() {
devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 7, 4, af[highestIndex].frequency);
delay(200);
devTEF_Radio_Get_RDS_Status(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
if ((rdsStat & (1 << 9)) && rds.rdsA == currentpi) {
if ((rdsStat & (1 << 9)) && rds.rdsA == rds.correctPI) {
currentfreq = af[highestIndex].frequency;
for (byte y = 0; y < 50; y++) {
af[y].frequency = 0;
@@ -338,6 +337,8 @@ void TEF6686::readRDS(bool showrdserrors)
if (rdsReady) { // We have all data to decode... let's go...
//PI decoder
if (rds.correct) rds.correctPI = rds.rdsA;
if (rds.region != 1 && (!rds.rdsAerror || rds.pierrors)) {
if (rds.rdsA != piold) {
piold = rds.rdsA;
@@ -822,6 +823,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
}
rdsblock = 0;
piold = 0;
rds.correctPI = 0;
rds.ECC = 0;
rds.LIC = 0;
rds.pinHour = 0;

View File

@@ -107,7 +107,7 @@ typedef struct _rds_ {
String PTYN;
char stationType[18];
char picode[6];
uint16_t hour, minute, day, month, year, offsetplusmin, rdsA, rdsB, rdsC, rdsD, rdsErr;
uint16_t hour, minute, day, month, year, offsetplusmin, rdsA, rdsB, rdsC, rdsD, rdsErr, correctPI;
int8_t offset;
unsigned int ECC;
unsigned int LIC;
@@ -158,12 +158,20 @@ typedef struct _eon_ {
String ps;
} eon_;
typedef struct _logbook_ {
char picode[6];
uint16_t frequency;
int16_t SignalLevel;
String stationName;
String DateTime;
} logbook_;
class TEF6686 {
public:
af_ af[50];
eon_ eon[20];
rds_ rds;
logbook_ logbook[22];
uint16_t TestAF();
void readRDS(bool showrdserrors);
void SetFreq(uint16_t frequency);
@@ -208,6 +216,7 @@ class TEF6686 {
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
uint8_t af_counter;
uint8_t eon_counter;
uint8_t logbook_counter;
uint8_t rdsblock;
uint8_t rtplusblock;
bool mute;