Skip to content

Tuning Capability for 76-108MHz FM Frequencies #5

Open
@nnakapa

Description

@nnakapa

Hi,

I really appreciate your useful library. However, I encountered a problem: I couldn't tune to frequencies under 87MHz because I live in Japan, where our frequency range is between 76 - 108MHz. Upon inspecting the related functions in the library, I identified some issues. I have modified the code and confirmed that it now allows tuning between 76MHz and 108MHz.

Here are the changes I made:

I added the RADIO_REG_CHAN_BAND_FM or RADIO_REG_CHAN_BAND_FMWORLD value and RADIO_REG_CHAN_SPACE_100 values to reg_channel during the function's execution to register the value.

I modified the freq_low value to adapt according to whether the user selects the FM band or the FMWORLD band.

Below is the output from the diff command. Could you please review my modifications?

diff tinkeringtech_rda5807m_org.py tinkeringtech_rda5807m_new.py 
2a3
> # SPDX-FileCopyrightText: 2024 Norihiko Nakabayashi, modified for Japanese users
103,108d103
<     # FMWORLD Band
<     freq_low = 8700
<     freq_high = 10800
<     freq_steps = 10
<     rssi = 0
< 
110c105
<     def __init__(self, board, rds_parser, frequency=10000, volume=1):
---
>     def __init__(self, board, rds_parser, band="FM", frequency=10000, volume=1):
133c128
<         # Band - Default FMWORLD
---
>         # Band - Default FM
136c131,139
<         self.band = "FM"
---
>         self.band = band
>         # FMWORLD Band
>         if band == "FM":
>             self.freq_low = 8700
>         else:
>             self.freq_low = 7600
>         self.freq_high = 10800
>         self.freq_steps = 10
>         self.rssi = 0
189c192,200
<         reg_channel = RADIO_REG_CHAN_TUNE  # Enable tuning
---
>         # Changes bands to FM or FMWORLD
>         band = self.band
>         if band == "FM":
>             r = RADIO_REG_CHAN_BAND_FM
>         else:
>             r = RADIO_REG_CHAN_BAND_FMWORLD
>         reg_channel = (
>             r | RADIO_REG_CHAN_SPACE_100 | RADIO_REG_CHAN_TUNE
>         )  # Enable tuning
202a214
> 
240c252
<         return ("".join(sfreq)) + " Mhz"
---
>         return ("".join(sfreq)) + " MHz"

Best regards,

Nori

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions