0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-27 12:53:53 +01:00

maybe my receiver is bugged? (rds spy)

This commit is contained in:
2025-12-28 23:30:37 +01:00
parent 9c348e25d6
commit 1ed47ea077
2 changed files with 9 additions and 8 deletions

View File

@@ -5,7 +5,6 @@ _Rft_toggle = false
_Rft_last_id = -1 _Rft_last_id = -1
_Rft_version = 0 _Rft_version = 0
_Rft_crc_mode = -1 _Rft_crc_mode = -1
_Rft_crc_state = 0
_Rft_crc_sent = false _Rft_crc_sent = false
_Rft_aid = 0xFF7F _Rft_aid = 0xFF7F
@@ -24,7 +23,7 @@ local function start_rft()
_Rft_crc_sent = true _Rft_crc_sent = true
if _Rft_crc_mode ~= 0 then warn("rft: No other crc than mode 0 is supported as of now") end if _Rft_crc_mode ~= 0 then warn("rft: No other crc than mode 0 is supported as of now") end
_Rft_crc_mode = 0 _Rft_crc_mode = 0
return true, (2 << 14), _Rft_aid, (1 << 12) | (_Rft_crc_mode & 7) << 9 | (seg & 511), crc16(_Rft_file) return true, (2 << 14), _Rft_aid, (1 << 12) | (0 & 7) << 9 | (0 & 0x1ff), crc16(_Rft_file)
else else
_Rft_crc_sent = false _Rft_crc_sent = false
end end
@@ -59,7 +58,7 @@ function load_station_logo(path, id, crc)
if id == _Rft_last_id then if id == _Rft_last_id then
_Rft_toggle = not _Rft_toggle _Rft_toggle = not _Rft_toggle
_Rft_crc_state = 0 _Rft_crc_sent = 0
_Rft_version = _Rft_version + 1 _Rft_version = _Rft_version + 1
if _Rft_version > 7 then _Rft_version = 0 end if _Rft_version > 7 then _Rft_version = 0 end
end end

View File

@@ -26,15 +26,17 @@ inline int _strncpy(char *dest, const char *src, int n) {
return i; return i;
} }
uint16_t crc16_ccitt(const char* data, uint16_t len) { uint16_t crc16_ccitt(const char* data, uint16_t len) {
uint16_t i, crc=0xFFFF; uint16_t crc = 0xffff;
for (i=0; i < len; i++ ) {
crc = (unsigned char)(crc >> 8) | (crc << 8); for (size_t i = 0; i < len; i++) {
crc = (crc >> 8) | (crc << 8);
crc ^= data[i]; crc ^= data[i];
crc ^= (unsigned char)(crc & 0xff) >> 4; crc ^= (crc & 0xff) >> 4;
crc ^= (crc << 8) << 4; crc ^= (crc << 8) << 4;
crc ^= ((crc & 0xff) << 4) << 1; crc ^= ((crc & 0xff) << 4) << 1;
} }
return ((crc ^= 0xFFFF) & 0xFFFF);
return crc ^ 0xffff;
} }
inline uint16_t get_block_from_group(RDSGroup *group, uint8_t block) { inline uint16_t get_block_from_group(RDSGroup *group, uint8_t block) {