Skip to content

Conversation

@raphaelcoeffic
Copy link
Member

As we now have JSON files for some parts of the hardware definitions, it would be
good to remove these redundant definitions and use only the JSON files.

For a smooth transition, the removal and checks should happen as automated as possible.

See radio/util/hw_defs/README.md for more details.

Copy link
Collaborator

@3djc 3djc left a comment

Choose a reason for hiding this comment

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

This seems like a step backward to me. There is no reason to require a human entry for this as the navigation type is purely defined by the available keys.

@philmoz
Copy link
Collaborator

philmoz commented Jul 17, 2025

This seems like a step backward to me. There is no reason to require a human entry for this as the navigation type is purely defined by the available keys.

Maybe I am misunderstanding; but I thought the idea was to remove the KEYS_GPIO_xxx stuff?

@pfeerick pfeerick added needs: rebase A git rebase on top of the latest destination branch version is required compilation Related to compiling the firmware and firmware options house keeping 🧹 Cleanup of code and house keeping labels Jul 23, 2025
@pfeerick pfeerick added this to the 3.0 milestone Jul 23, 2025
@raphaelcoeffic
Copy link
Member Author

This will be continued once #6095 has been merged.

@pfeerick pfeerick changed the title chores(radio): remove hardware definitions present in JSON chore(radio): remove hardware definitions present in JSON Jul 27, 2025
@raphaelcoeffic raphaelcoeffic removed the needs: rebase A git rebase on top of the latest destination branch version is required label Jul 28, 2025
@pfeerick
Copy link
Member

pfeerick commented Jul 28, 2025

Perhaps some cleanup for the commented out blocks in unless some of that is commented out debug code?

  • cmake/Macros.cmake
  • radio/src/bootloader/CMakeLists.txt
  • radio/util/hw_defs/hal_json.py

and taking the draft flag off if you feel this is ready to go (since you need it for other PRs to carry on ;) ) After #6392 has been merged? 🤭

Any specific handsets you need tested? Else I'll be using the X9D+2016, TX16S, TProV2, NB4+ to start with...

@raphaelcoeffic
Copy link
Member Author

Perhaps some cleanup for the commented out blocks

I'm not quite sure what to with that: on one hand, we might need that code again for some special purposes (like generating stuff as a one-off), but on the other, this is not supposed to happen once the transition is made to JSON-only.

I'd suggest cleaning up this code later on, once we are confident with the transition being completed.

@raphaelcoeffic
Copy link
Member Author

and taking the draft flag off if you feel this is ready to go (since you need it for other PRs to carry on ;) ) After #6392 has been merged?

Regarding targets that have been started before this PR gets merged, the best course of action is to generate the JSON before rebasing on top of main with this PR already merged. This way, the JSON generated can be added to the target's PR.

Regarding the PA01 in particular, I have no string feelings, either way before or after is fine with me. Worst case I'll generate the missing JSON out of main, and add it to this PR. That's not a big issue.

@3djc
Copy link
Collaborator

3djc commented Jul 29, 2025

Please merge after the PR i will submit today ;)

@pfeerick
Copy link
Member

pfeerick commented Jul 29, 2025 via email

@raphaelcoeffic
Copy link
Member Author

So is the draft flag coming off as you're ready to live with the consequences, or is this PR going to hide behind it a bit longer?

Depends, there will be quite a lot to test. I need to re-check with my scripts that we don't have any usage of the removed defines. Also verify that the tooling is effective and allows us to potentially add more defines to the list of removed stuff later on (whereby this is not a huge priority, we can see then).

both TX15 and PA01 are still only announced, not in the wild yet AFAIK

Really, I have no problem rebasing on top of these 2 PRs.

The real question for me is: will be able to stop building simulator plugins for F2 radios once we have the JSON for these radios "frozen" and shipped with Companion without building anything? @elecpower what do you say?

@pfeerick
Copy link
Member

Okey dokey, just wanted to be sure of the status of this PR, as it's holding up you being able to continue with #6435. Better to get the other two in since they're only days away at most and give this time for testing. But I don't think it should be held back for too long... after all, best testing is usually having to have to use the darn thing, and yank it if there are major issues. AFAIK it should address the Cpn issue but Neil is the proper authority there ;)

@elecpower
Copy link
Collaborator

Companion loads all json files it finds at compile time so provided devs don't decide to clean up the frozen unsupported radios we should be okay in the short term.

However once the json definition changes the frozen files will become less usable/reliable.

What I would like to see is the inclusion of a definition version in all json files. That makes it clear to Companion how to interpret and at what point they become unsupported for conversion.

@raphaelcoeffic
Copy link
Member Author

raphaelcoeffic commented Jul 30, 2025

However once the json definition changes the frozen files will become less usable/reliable.

We can enforce conformity to the data model. This is the purpose of the validator I added. At the moment, it is not yet running in "strict" mode (would fail on additional attributes not defined in the data model), but we could make it run that way and add it to the GH checks.

What I would like to see is the inclusion of a definition version in all json files. That makes it clear to Companion how to interpret and at what point they become unsupported for conversion.

I would prefer to keep it simple. Given that we have schema checks, changing the schema also forces us to update the JSON for legacy radios, or remove them altogether. I hope this is sufficient.

@elecpower
Copy link
Collaborator

I can live with keeping unsupported radio json files conforming for a reasonable time.

We keep all Companion releases so there is a conversion path should a user wait too long to transfer their models.

@raphaelcoeffic raphaelcoeffic marked this pull request as ready for review August 22, 2025 15:42
@pfeerick pfeerick added the needs: rebase A git rebase on top of the latest destination branch version is required label Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compilation Related to compiling the firmware and firmware options house keeping 🧹 Cleanup of code and house keeping needs: rebase A git rebase on top of the latest destination branch version is required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants