-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Optimize Addresses.h generation and fix incorrect addresses for certain output types like DcsBios::LED #240
Conversation
maciekish
commented
Sep 23, 2023
•
edited
Loading
edited
- Recreate Addresses.h in init() on each run, completely replacing it and avoiding stale entries.
- Fixes incorrect parameters for certain output functions like DcsBios::LED, DcsBios::ServoOutput etc
…ale entries. Also only writes the file once speeding up the whole process greatly.
…ript by adding _ADDR
I think it's probably fine to have both entries in the json - I initially didn't fully understand why they were there. However, I'm not super familiar with the arduino stuff so I'd like to better understand why both values are needed to begin with. Additionally, I'd suggest reading the values from the documentation where they've already been defined instead of recomputing them in the save call: local full_identifier = BIOS.util.addressDefineIdentifier(moduleName, identifier) could be local full_identifier = output.address_identifier |
It’s fine but redundant, since i’ve already made the change its better like this, saves a bit of space. The only caveat is that if anyone changes the _ADDR suffix for any reason they have to be smart and seach the whole project for _ADDR and make sure they get them all. Regarding the recomputation, do you mean in Util.lua or Protocol.lua? I’m not at the computer right now but i don’t think the documentation output is accessible at that point. Anyway the recomputation is stable and fast, and only runs in „developer mode” anyway. I don’t believe this is an issue, but if you want i can look into it later? |
@charliefoxtwo I see what you mean now, it was immediately obvious when i opened it on a big screen. However, there are addresses which are undocumented and only using |
Since the address only is used in the reference tool and will alps be added to bort (an external project), I suggest having both in the json files. Otherwise even if everything in the bios project is changed, bort will still need separate changes (same for the external ctrl ref tool). Regarding recomputing, it's not performance I'm concerned about, just consistency. I'll note that if the json documentation doesn't have an address_identifier then it won't display in the reference tool either, so recomputing probably doesn't offer much value (it would add the entry, sure but that entry would be completely undocumented and the user would have no idea it exists). In my module refactor I've made sure every output will have those items added, but in the meantime some modules define new outputs inline so it's definitely possible some won't have one. |
@charliefoxtwo I completely forgot about Bort today, you're right. Let's put the address_only_idenfitier back. I think thats why i did it like this initially, i remember we were talking about Bort a few weeks back. Regarding the undocumented addresses, should we keep it this way until the refactoring is complete? |
…n javascript by adding _ADDR" This reverts commit c2f1917.
Done ↑ |
It's fine either way 🤷 I'm happy with the changes you've made which at least check to see if the documentation exists |
I'd leave it as is then, i feel uneasy with stuff disappearing. This should all be done and ready in that case. |
Turns out it was simpler than i thought, i have refactored it to make it self-contained now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@maciekish this isn't necessarily a new issue but something I just noticed from your previous PR: |
Oh boy, yeah that will definitely cause a compile error. I don’t use the ::LED, ::Servo etc functions so i missed this 🤦🏻 Will have to look at it tomorrow as its past midnight here now. Is it possible to run test with a C compiler on Github as well? Or at least a linter? |
No worries. I'm not sure what sort of compiler we'd run or how we'd set it up, but it's not out of the question. If you can come up with a github action that will validate that stuff, I'm fine with it. But I'm not sure you'll be able to, since the documentation doesn't have any record of how those constants will be used, and documentation tools could display them any number of ways. If you come up with something, let me know. |
I have identified the issue and will submit a PR shortly. |
Actually since the changes include the optimized addresses.h generation in this PR, i have added the fix to this PR. I identified the following output types:
Which result in the following three defines to support all cases:
They are only generated as required based on the control type, for example there is no I have also updated the json files and the js to use the correct address. |
Anything else to fix here? |
can we just remove the float bit? I don't think we should leave that around since it kind of implies we should be doing something there when in fact we don't. |
Sure, thats kind of the reason i added it as well. I'll get it updated tomorrow. |
Done, i skimmed through the conflicts it looks like indentation only but not sure how to properly resolve them in Github. |
Just read about this and if there is no resolve button on this page the conflicts are considered too complex to be solved from here. |
Since i don't have write access, it looks like i cant do anything about them. I could try downloading and committing the current A-4E-C files to just resolve the conflicts but you would have to re-run the export as i don't have access to DCS for 2 days and by that time we may have more conflicts... |
You should merge master into this branch locally, resolve the conflicts locally, and then push the changes. That should take care of it. I suspect the conflicts are in the json files, so you'll probably need to regenerate them. |
I thought that will mess up the PR, but i'll give it a try. I can't regenerate the files until tomorrow evening at the earliest though. |
Merging the target branch into the source branch to keep it up to date is totally normal behavior :) |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one item needs to be changed for cross-OS compatibility on the local compile, everything else looks good
Co-authored-by: Charlie <30303272+charliefoxtwo@users.noreply.github.com>
I updated the path but Github is still complaining.. |
It was for a few minutes then it looked the same as yours. Thanks for all the input 👍🏻 |