Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frequency #7

Open
pdgilbert opened this issue Jul 28, 2020 · 4 comments
Open

frequency #7

pdgilbert opened this issue Jul 28, 2020 · 4 comments

Comments

@pdgilbert
Copy link

FREQUENCY in megahertz needs to be a float, not i64, otherwise only the nominal channel can be used, for example, channel 12 in the 915MHz band. Another option might be to leave it integer but in kHz or Hz. Here is a list of channels copied from some python code.

#https://www.rfwireless-world.com/Tutorials/LoRa-channels-list.html
channels = {
   'CH_00_900': 903.08, 'CH_01_900': 905.24, 'CH_02_900': 907.40,
   'CH_03_900': 909.56, 'CH_04_900': 911.72, 'CH_05_900': 913.88,
   'CH_06_900': 916.04, 'CH_07_900': 918.20, 'CH_08_900': 920.36,
   'CH_09_900': 922.52, 'CH_10_900': 924.68, 'CH_11_900': 926.84, 'CH_12_900': 915.00,

   'CH_10_868': 865.20, 'CH_11_868': 865.50, 'CH_12_868': 865.80,
   'CH_13_868': 866.10, 'CH_14_868': 866.40, 'CH_15_868': 866.70,
   'CH_16_868': 867   , 'CH_17_868': 868   ,   
   }

@eflukx
Copy link

eflukx commented Jan 31, 2022

Agreed; being limited to integer Mega Hertzes seems pretty coarse.. 😉

My personal taste would be to limit this function to integers arguments. IMO it is best not to introduce floats in an embedded system when not needed.

Could make the set_frequency function 'smart' (and backwards compatible!) to multiply the freq: i64 argument below 2000 by 1_000_000. And test if the resulting requested frequency is between in the supported range of 127-1020 MHz

Fancier would be to use an specialized Frequency type, but not sure what that would bring to the table...

@pdgilbert
Copy link
Author

I think this package is not active anymore. I've switched to https://github.com/rust-iot/rust-radio-sx127x and had much more success. My example usage is at https://github.com/pdgilbert/LoRaGPS-rust. There are some issues with it, but those are related to active development moving to embedded-hal v1, not problems just making it work.

@eflukx
Copy link

eflukx commented Feb 1, 2022

hi @pdgilbert thanks for getting back to me on this very old issue 😄

Yes, I've had a look at the radio-sx127x crate first as well, but it wasn't immediately apparent to me how it was supposed to be used. (It seems much rust crates do by with the standard rs docs only and omit proper examples? I'm relatively new to the community but this I find remarkable for a lot of (also otherwise well-maintained) creates). Therefore tried to get going this one first (works now, after some refactoring of my own). Will have a look to your LoRaGPS-rust project, might be just the example code I was looking for.. thanks!

@pdgilbert
Copy link
Author

Yes, as a newbie I too have found the lack of examples frustrating. Also, because of the rapid state of development, random examples often work only with old versions of crates and device HALs. In an effort to help and also maintain my own sanity around what I have working and what is broken I started another project https://github.com/pdgilbert/rust-integration-testing with CI at https://github.com/pdgilbert/rust-integration-testing/actions. This is just to keep track of little examples. For awhile I was running it also with release versions of stuff but at the moment it is more focused on dev version. Some radio-sx127x examples are also there, but the project above is more complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants