Bugfixing
This commit is contained in:
+4
-2
@@ -620,8 +620,8 @@ void loop() {
|
|||||||
if (power == true) {
|
if (power == true) {
|
||||||
Communication();
|
Communication();
|
||||||
|
|
||||||
if (af) {
|
if (af && radio.rds.correctPI != 0) {
|
||||||
if ((aftest && millis() >= aftimer + 3000) || (USN > 250 || WAM > 250)) {
|
if ((aftest && millis() >= aftimer + 3000) || ((USN > 250 || WAM > 250) && millis() >= aftimer + 1000)) {
|
||||||
aftimer = millis();
|
aftimer = millis();
|
||||||
aftest = false;
|
aftest = false;
|
||||||
frequency = radio.TestAF();
|
frequency = radio.TestAF();
|
||||||
@@ -1583,6 +1583,7 @@ void ModeButtonPress() {
|
|||||||
EEPROM.writeInt(EE_INT16_AMLEVELOFFSET, AMLevelOffset);
|
EEPROM.writeInt(EE_INT16_AMLEVELOFFSET, AMLevelOffset);
|
||||||
EEPROM.writeByte(EE_BYTE_UNIT, unit);
|
EEPROM.writeByte(EE_BYTE_UNIT, unit);
|
||||||
EEPROM.writeByte(EE_BYTE_AF, af);
|
EEPROM.writeByte(EE_BYTE_AF, af);
|
||||||
|
EEPROM.writeByte(EE_BYTE_STEREO, StereoToggle);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
Serial.end();
|
Serial.end();
|
||||||
if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
|
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);
|
if (!advancedRDS) tft.drawString(RTold, 1, 223, GFXFF);
|
||||||
dropout = true;
|
dropout = true;
|
||||||
aftest = true;
|
aftest = true;
|
||||||
|
aftimer = millis();
|
||||||
} else {
|
} else {
|
||||||
if (dropout == true && PIold.length() != 0) {
|
if (dropout == true && PIold.length() != 0) {
|
||||||
tft.setTextColor(PrimaryColor);
|
tft.setTextColor(PrimaryColor);
|
||||||
|
|||||||
+5
-3
@@ -25,12 +25,11 @@ uint16_t TEF6686::TestAF() {
|
|||||||
uint16_t currentusn;
|
uint16_t currentusn;
|
||||||
uint16_t currentwam;
|
uint16_t currentwam;
|
||||||
int16_t currentoffset;
|
int16_t currentoffset;
|
||||||
uint16_t currentpi;
|
|
||||||
|
|
||||||
byte timing;
|
byte timing;
|
||||||
|
|
||||||
devTEF_Radio_Get_Quality_Status(&status, ¤tlevel, ¤tusn, ¤twam, ¤toffset, &dummy1, &dummy2, &dummy3);
|
devTEF_Radio_Get_Quality_Status(&status, ¤tlevel, ¤tusn, ¤twam, ¤toffset, &dummy1, &dummy2, &dummy3);
|
||||||
devTEF_Radio_Get_RDS_Status(&rdsStat, ¤tpi, &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++) {
|
for (int x = 0; x < af_counter; x++) {
|
||||||
timing = 0;
|
timing = 0;
|
||||||
@@ -57,7 +56,7 @@ uint16_t TEF6686::TestAF() {
|
|||||||
devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 7, 4, af[highestIndex].frequency);
|
devTEF_Set_Cmd(TEF_FM, Cmd_Tune_To, 7, 4, af[highestIndex].frequency);
|
||||||
delay(200);
|
delay(200);
|
||||||
devTEF_Radio_Get_RDS_Status(&rdsStat, &rds.rdsA, &rds.rdsB, &rds.rdsC, &rds.rdsD, &rds.rdsErr);
|
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;
|
currentfreq = af[highestIndex].frequency;
|
||||||
for (byte y = 0; y < 50; y++) {
|
for (byte y = 0; y < 50; y++) {
|
||||||
af[y].frequency = 0;
|
af[y].frequency = 0;
|
||||||
@@ -338,6 +337,8 @@ void TEF6686::readRDS(bool showrdserrors)
|
|||||||
if (rdsReady) { // We have all data to decode... let's go...
|
if (rdsReady) { // We have all data to decode... let's go...
|
||||||
|
|
||||||
//PI decoder
|
//PI decoder
|
||||||
|
if (rds.correct) rds.correctPI = rds.rdsA;
|
||||||
|
|
||||||
if (rds.region != 1 && (!rds.rdsAerror || rds.pierrors)) {
|
if (rds.region != 1 && (!rds.rdsAerror || rds.pierrors)) {
|
||||||
if (rds.rdsA != piold) {
|
if (rds.rdsA != piold) {
|
||||||
piold = rds.rdsA;
|
piold = rds.rdsA;
|
||||||
@@ -822,6 +823,7 @@ void TEF6686::clearRDS (bool fullsearchrds)
|
|||||||
}
|
}
|
||||||
rdsblock = 0;
|
rdsblock = 0;
|
||||||
piold = 0;
|
piold = 0;
|
||||||
|
rds.correctPI = 0;
|
||||||
rds.ECC = 0;
|
rds.ECC = 0;
|
||||||
rds.LIC = 0;
|
rds.LIC = 0;
|
||||||
rds.pinHour = 0;
|
rds.pinHour = 0;
|
||||||
|
|||||||
+10
-1
@@ -107,7 +107,7 @@ typedef struct _rds_ {
|
|||||||
String PTYN;
|
String PTYN;
|
||||||
char stationType[18];
|
char stationType[18];
|
||||||
char picode[6];
|
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;
|
int8_t offset;
|
||||||
unsigned int ECC;
|
unsigned int ECC;
|
||||||
unsigned int LIC;
|
unsigned int LIC;
|
||||||
@@ -158,12 +158,20 @@ typedef struct _eon_ {
|
|||||||
String ps;
|
String ps;
|
||||||
} eon_;
|
} eon_;
|
||||||
|
|
||||||
|
typedef struct _logbook_ {
|
||||||
|
char picode[6];
|
||||||
|
uint16_t frequency;
|
||||||
|
int16_t SignalLevel;
|
||||||
|
String stationName;
|
||||||
|
String DateTime;
|
||||||
|
} logbook_;
|
||||||
|
|
||||||
class TEF6686 {
|
class TEF6686 {
|
||||||
public:
|
public:
|
||||||
af_ af[50];
|
af_ af[50];
|
||||||
eon_ eon[20];
|
eon_ eon[20];
|
||||||
rds_ rds;
|
rds_ rds;
|
||||||
|
logbook_ logbook[22];
|
||||||
uint16_t TestAF();
|
uint16_t TestAF();
|
||||||
void readRDS(bool showrdserrors);
|
void readRDS(bool showrdserrors);
|
||||||
void SetFreq(uint16_t frequency);
|
void SetFreq(uint16_t frequency);
|
||||||
@@ -208,6 +216,7 @@ class TEF6686 {
|
|||||||
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
|
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
|
||||||
uint8_t af_counter;
|
uint8_t af_counter;
|
||||||
uint8_t eon_counter;
|
uint8_t eon_counter;
|
||||||
|
uint8_t logbook_counter;
|
||||||
uint8_t rdsblock;
|
uint8_t rdsblock;
|
||||||
uint8_t rtplusblock;
|
uint8_t rtplusblock;
|
||||||
bool mute;
|
bool mute;
|
||||||
|
|||||||
Reference in New Issue
Block a user