Skip to content

m2k: signal generator infinite loop bug fix#1948

Merged
AlexandraTrifan merged 1 commit intomainfrom
bug_fix_signal_generator_math
Mar 10, 2025
Merged

m2k: signal generator infinite loop bug fix#1948
AlexandraTrifan merged 1 commit intomainfrom
bug_fix_signal_generator_math

Conversation

@IonutMuthi
Copy link
Copy Markdown
Contributor

For small sps values on math channel the function "get_samples_count" will get stuck in an infinite loop due to size value reaching 0 before attempting "size <<=1 "


// for size 0 return 0 going further with this value will get stuck in an infinite loop
if(size == 0) {
return 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should disable the Run button in this case.
What happens here is the the SigGen does not output anything, but the Run button is checked, suggesting that data is in fact generated on the DAC, which is not the case..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added some changes so the run button would be disabled for situations where the values used for Math signals sample rate and record length would not combine to provide a correct value

@IonutMuthi IonutMuthi force-pushed the bug_fix_signal_generator_math branch from 3e80660 to cb57263 Compare March 4, 2025 14:24
@AlexandraTrifan
Copy link
Copy Markdown
Contributor

There are still some corner cases that are not handled in this PR. If we set the sample rate to 1sps and increase the record length until you manage to press Run (you need a record len of 1s). Press Run and then decrease the record length. The Run button is only greyed out but didn't change from "Stop" to "Run".
Also there seem to be some conflicts with the main branch.

Signed-off-by: IonutMuthi <ionut.muthi@analog.com>
@IonutMuthi IonutMuthi force-pushed the bug_fix_signal_generator_math branch from 461deea to bb112ac Compare March 10, 2025 08:14
@AlexandraTrifan AlexandraTrifan merged commit 3ddf222 into main Mar 10, 2025
23 of 27 checks passed
@AlexandraTrifan AlexandraTrifan deleted the bug_fix_signal_generator_math branch March 10, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal Generator: Pressing "Run" for Math channels makes scopy freeze

2 participants