-
-
Notifications
You must be signed in to change notification settings - Fork 156
Removed superfluous dataBuffer in graph_spectrum to prevent the random spectrum type change bug #841
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
Removed superfluous dataBuffer in graph_spectrum to prevent the random spectrum type change bug #841
Conversation
…m spectrum type change bug
## Walkthrough
The changes refactor how spectrum data buffers are managed by removing reliance on a global `dataBuffer` object. Functions now explicitly pass `fieldIndex`, `curve`, and `fieldName` as parameters. The logic for restoring or mutating a global data buffer was eliminated, and related function signatures and calls were updated accordingly.
## Changes
| File(s) | Change Summary |
|-----------------------|--------------------------------------------------------------------------------------------------------|
| src/graph_spectrum.js | Refactored `dataLoad` to accept explicit parameters; updated calls in `plotSpectrum` and event handlers; removed global `dataBuffer` logic. |
| src/graph_spectrum_calc.js | Changed `GraphSpectrumCalc.setDataBuffer` to accept three parameters instead of a single object. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant UI
participant FlightLogAnalyser
participant GraphSpectrumCalc
UI->>FlightLogAnalyser: plotSpectrum(fieldIndex, curve, fieldName)
FlightLogAnalyser->>GraphSpectrumCalc: setDataBuffer(fieldIndex, curve, fieldName)
GraphSpectrumCalc-->>FlightLogAnalyser: (updates internal buffer)
FlightLogAnalyser-->>UI: (renders spectrum plot)Possibly related PRs
Suggested labels
Suggested reviewers
|
|
|
Preview URL: https://71e3bbcf.betaflight-blackbox.pages.dev |
|
@coderabbitai |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1215 🏁 Script executed: Length of output: 77 🏁 Script executed: Length of output: 2823 @demvlad Yes, this solution (PR #841) is significantly better than #839. Here's why: Fundamental Approach DifferencePR #839 (Reactive Fix):
PR #841 (Proactive Fix):
Why PR #841 is Superior
The trade-off is that PR #841 is more invasive to the existing API, but this is a worthwhile change for the improved reliability and maintainability it provides. As you noted in the PR description, PR #839 "did not fully prevent the random dataBuffer destruction bug" - this confirms that the band-aid approach wasn't sufficient, making the more thorough fix in PR #841 the right choice. |



The continue of #837 #838 #839 PRs.
The last #839 PR has not full the random dataBuffer destroing bug prevention
There is no dataBuffer, there is no this bug by using this PR
Summary by CodeRabbit