API update

Removed ASCII converter, since it was not working ;-)
Hopefully fixed the CT when time is at midnight.
Added option to hide RDS errors:
showrdserrors = true Do show always
showrdserrors = false Only show errorless RDS
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-06-03 13:15:22 +02:00
parent 825cc68339
commit ecd4bb4702
6 changed files with 67617 additions and 30 deletions

View File

@@ -209,6 +209,7 @@ bool cleanup;
bool direction;
bool dropout;
bool fullsearchrds;
bool showrdserrors = true;
bool LowLevelInit = false;
bool menu;
bool menuopen = false;
@@ -1357,7 +1358,7 @@ void KeyDown() {
void readRds() {
if (band == 0) {
RDSstatus = radio.readRDS();
RDSstatus = radio.readRDS(showrdserrors);
ShowRDSLogo(RDSstatus);
if (RDSstatus == 0) {
@@ -1463,7 +1464,7 @@ void showCT() {
if (radio.rds.offsetplusmin == true) timeoffset = (-1 * radio.rds.offset) / 2; else timeoffset = radio.rds.offset / 2;
byte rdshour = radio.rds.hours + timeoffset;
rdshour = (((int)rdshour + 24) % 24);
setTime((radio.rds.hours + timeoffset), radio.rds.minutes, 0, 0, 0, 0);
setTime(rdshour, radio.rds.minutes, 0, 0, 0, 0);
rds_clock = ((hour() < 10 ? "0" : "") + String(hour()) + ":" + (minute() < 10 ? "0" : "") + String(minute()));
} else {
rds_clock = "";

14
debug.cfg Normal file
View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Example OpenOCD configuration file for ESP32-S3 connected via builtin USB-JTAG adapter.
#
# For example, OpenOCD can be started for ESP32-S3 debugging on
#
# openocd -f board/esp32s3-builtin.cfg
#
# Source the JTAG interface configuration file
source [find interface/esp_usb_jtag.cfg]
# Source the ESP32-S3 configuration file
source [find target/esp32s3.cfg]

67571
debug.svd Normal file

File diff suppressed because it is too large Load Diff

17
debug_custom.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name":"Arduino on ESP32-S3",
"toolchainPrefix":"xtensa-esp32s3-elf",
"svdFile":"debug.svd",
"request":"attach",
"overrideAttachCommands":[
"set remote hardware-watchpoint-limit 2",
"monitor reset halt",
"monitor gdb_sync",
"thb setup",
"c"
],
"overrideRestartCommands":[
"monitor reset halt",
"monitor gdb_sync"
]
}

View File

@@ -250,7 +250,7 @@ bool TEF6686::getStatusAM(int16_t &level, uint16_t &noise, uint16_t &cochannel,
return modulation;
}
bool TEF6686::readRDS()
bool TEF6686::readRDS(bool showrdserrors)
{
char status;
uint16_t rdsStat = 0, rdsErr = 65535, rdsErrA = 65535, rdsErrB = 65535, rdsErrC = 65535, rdsErrD = 65535;
@@ -270,7 +270,9 @@ bool TEF6686::readRDS()
rdsErrCheck = rdsErr == 0;
rdsDataReady = ((rdsStat & (1 << 15)) && (rdsStat & (1 << 9)));
rds.errors = rdsErr;
if (rdsDataReady)
bool x;
if (showrdserrors == false) x = rdsErrCheck; else x = true;
if (rdsDataReady && x)
{
//PI
if (rds.stationID == 0) rds.stationID = rds.rdsA;
@@ -294,8 +296,8 @@ bool TEF6686::readRDS()
if ((offset == 0) && (ps_process == 0)) ps_process = 1;
if (ps_process == 1) {
ps_buffer[(offset * 2) + 0] = ascii_converter(rds.rdsD >> 8);
ps_buffer[(offset * 2) + 1] = ascii_converter(rds.rdsD & 0xFF);
ps_buffer[(offset * 2) + 0] = rds.rdsD >> 8;
ps_buffer[(offset * 2) + 1] = rds.rdsD & 0xFF;
ps_buffer[(offset * 2) + 2] = 0;
ps_process = strlen(ps_buffer) == 8 ? 2 : 1;
}
@@ -381,10 +383,10 @@ bool TEF6686::readRDS()
if (rt_process == 1)
{
rds.stationTextOffset = offset;
rt_buffer[offset + 0] = ascii_converter(rds.rdsC >> 8);
rt_buffer[offset + 1] = ascii_converter(rds.rdsC & 0xff);
rt_buffer[offset + 2] = ascii_converter(rds.rdsD >> 8);
rt_buffer[offset + 3] = ascii_converter(rds.rdsD & 0xff);
rt_buffer[offset + 0] = rds.rdsC >> 8;
rt_buffer[offset + 1] = rds.rdsC & 0xff;
rt_buffer[offset + 2] = rds.rdsD >> 8;
rt_buffer[offset + 3] = rds.rdsD & 0xff;
if (offset > offsetold) offsetold = offset;
@@ -516,23 +518,6 @@ bool TEF6686::readRDS()
return rdsDataReady;
}
uint8_t TEF6686::ascii_converter (uint8_t src)
{
char dest = src;
switch (src)
{
case 0x91: dest = 225; break; //ä
case 0x97: dest = 239; break; //ö
case 0x99: dest = 245; break; //ü
case 0xD1: dest = 225; break; //Ä
case 0xD7: dest = 239; break; //Ö
case 0xD9: dest = 245; break; //Ü
case 0x8D: dest = 226; break; //ß
case 0xBB: dest = 223; break; //°
}
return (dest);
}
bool TEF6686::checkDouble (uint16_t value)
{
for (int i = 0; i < 50; i++) if (af[i].frequency == value)return (true);

View File

@@ -54,7 +54,7 @@ class TEF6686 {
public:
af_ af[50];
rds_ rds;
bool readRDS(void);
bool readRDS(bool showrdserrors);
void SetFreq(uint16_t frequency);
void SetFreqAM(uint16_t frequency);
bool getProcessing(uint16_t &highcut, uint16_t &stereo, uint16_t &sthiblend, uint8_t &stband_1, uint8_t &stband_2, uint8_t &stband_3, uint8_t &stband_4);
@@ -97,8 +97,7 @@ class TEF6686 {
void tone(uint16_t time, int16_t amplitude, uint16_t frequency);
private:
uint8_t ascii_converter (uint8_t src);
uint16_t rdsTimeOut = 32768;
uint16_t rdsTimeOut = 32768;
uint8_t ps_process;
uint8_t rt_process;
char ps_buffer[9];