Skip to content

Extract the fsk Flag into a use_fsk Object #21

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Mikefly123
Copy link
Member

Summary

This is a really simple tweak. Currently in the radio_manager initialization we are passing an in place creation of a nvm Flag object rather than creating the Flag object first and then passing it in.

This PR just extracts that object creation so you can actually call it in the runtime rather than just have it be a static object that cannot be changed. If this conflicts with the new modify_config changes that are incoming for the radio feel free to let me know and reject this change!

How was this tested

  • Added new unit tests
  • Ran code on hardware (screenshots are helpful)
  • Other (Please describe)

@Mikefly123 Mikefly123 self-assigned this May 21, 2025
@Mikefly123 Mikefly123 added the bug Something isn't working label May 21, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the inline creation of the FSK flag in radio_manager to a standalone use_fsk variable, enabling runtime modification of the flag.

  • Extracts the Flag(index=..., bit_index=7) instantiation into a local variable use_fsk
  • Updates the RFM9xManager constructor call to use the new use_fsk variable instead of an inline instantiation
Comments suppressed due to low confidence (2)

main.py:77

  • [nitpick] The variable name use_fsk could be misleading since it holds a Flag object, not a boolean. Consider renaming it to fsk_flag or flag_use_fsk for clarity.
use_fsk = Flag(index=register.FLAG, bit_index=7)

main.py:77

  • Add unit tests to verify that modifying the use_fsk flag at runtime correctly updates the radio behavior, ensuring this refactor is covered by automated tests.
use_fsk = Flag(index=register.FLAG, bit_index=7)

Copy link
Member

@hrfarmer hrfarmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So sorry I missed this pr, but yeah I was planning to have a PR up that would pull the radio modulation from config and get rid of the FSK flag altogether.

@Mikefly123
Copy link
Member Author

Hey @hrfarmer, gotcha! Do you have a feel for how long you think it'll take to get these changes in? I do agree that it is probably a much better idea to just pull which modulation you want to use from config.

I can probably open a separate ticket for this, but the reason I wanted to make this change in the meantime was because it doesn't seem like the fsk mode on the radio (using the adafruit_rfm lib) actually works. At least in the sense of having two FC boards, one with a loop that is sending packets and the other in a loop that receiving packets, I have not been able to confirm messages between the two. This might be a config issue on my side though, needs more testing.

In any case, because there isn't a way to conveniently edit the NVM flag at the moment it is pretty easy for one radio to accidentally be set to LoRa mode and another to be set to FSK mode without a simple way to swap between the two.

@hrfarmer
Copy link
Member

@Mikefly123 I should be able to get it up by monday at latest, I've been pretty slammed by my job recently but I'm trying to get back into the swing of things now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants