-
Notifications
You must be signed in to change notification settings - Fork 186
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
Restructuring: ui_driver.c #91
Comments
Hello Danilo, I agree with the proposal you have done. It is loically intended and all coders will understand and identiy function by filename. vy 73 |
It is a very good idea since this file is frequently visited. It could be of a great help to have it split. For safety as also for clarity. 73, Bojan S53DZ |
Hi there, Please bear in mind that this issue needs horrific amount of work. I've already started working on this issue few weeks ago to examine difficulties - with this amount of shared global state, and tight coupling it needs not only spliting but also designing proper architectural design. Furthermore, it makes 50% of project's code. There're also some dragons, like #95, which we'd encounter refactoring this code. The bottom line is: this project needs refactoring of What do you think about changing direct function calls to some kind of a priority list of functions to call after each event, on which each module can register on load? Yes, of course - it'll take some (but not much!) memory and processing time, but hardware is cheaper than our time. If you'd consider in this approach, I'm open to discuss it further. |
Well, it is clearly the case that ui_driver is a beast. Anyway, I am completely aligned with what you say. What I suggested here is intended as a prelude to this. One more thing: before we start doing restructuring on this level, I would like to have some kind of test and measurement system for certain performance critera in place, to ensure quick feedback regarding performance impacts after changes. Why: The audio interrupt handler right now creates a load of at least 30% (with the "right" settings even more) Many of the interesting applications such as live decoding of digital modes will need even more performance. I am not so sure about how much "dynamic" loading/unloading we should have, except in some places such as the signal processing flow routing. In most cases, an semidynamic approach which is resolved at compile time is preferable for performance and memory consumption reasons. Simply having a separate display driver / UI thread which is interleaved with the "normal" application for instance would free a lot of performance (right now, lot of waiting for the SPI bytes to be transmitted), this would work very well with an event driven approach. If we go into this direction, I would suggest to look into using an existing RTOS to provide the primitives for threads, interprocess communication and synchronization. I have been developing embedded operating systems many years, so I know a bit what this takes, I don't want to do that, there is plenty available. Especially FreeRTOS seems to be a candidate here since it only does the basic stuff which would allow us to use a lot of the existing hardware drivers from ST. If your idea will meet these goals, I don't know. I am open for discussion, I am quite interested to see your proposal. But we should also listen to the others to not offend them. |
One question, out of pure curiosity: how did you measured audio interrupt handler load? I can't recall any instrumentation in the code itself. |
That is no secret: I used the Power LED (on/off at start/stop of ISR) plus oscilloscope/logic analyzer. |
The reason I supported the proposal thrown by db4ple was simply based on what was said in the proposal itself. The last *_master *_version .27.0 of the file was 11.985 lines long, the last *_devel *_version is 9.702 lines long. This alone is a good reason to split it in some reasonable units. But I think by doing this we should not increase the need to use more RAM, MC processing power. So by my opinion it should be done step by step. Polishing first. As it was said: RAM, flash, 165MHz are the ceiling merit for the time. 73, Bojan S53DZ |
Flash we have plenty. RAM not so much, and CPU cycles are wasted a lot, but to get these back, tghere is a need for some architectural change. But refactoring the architecture of unstable and/or unreadable software is an adventure I don't need for my well being. |
There's a lot of commented out, work-in-progress or not used anywhere functions. |
Ufff... I saw your work of the last night and now I know what I will do today :) I do not want to comment each ull request so I deceided to nswer only HERE.
I am not sure I have answered all what happens here the last 1 hours but I hope. Now I will start reviewing and merging your work. Many thanks for all! |
I would suggest to split ui_driver.c into several parts.
Rationale: It is way to big, several only loosely related activities are in there. Being so large, if will in future with more collaborators happen more often that they will work on the same file. While not being catastrophic, merge can be more painful.
Proposal:
One related to loading and saving configuration values. (Roughly 800 lines of code)
One related to anything truely UI (buttons, knobs, touchscreen) (many lines of code)
One related to support the RF and AUDIO (configuration of Si570, Code, filter activation etc.) (at least 2000 - 3000 lines of code).
I started marking functions for move to new rf/audio related files using TODO: comments. Work is not complete and it is not too urgent, but 10k+ lines in a single file is quite a lot to deal with.
The text was updated successfully, but these errors were encountered: