Skip to content
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

fix: fixed the In-Built MIC to work properly after toggling the PSLab MIC #2422

Merged
merged 2 commits into from
May 24, 2024

Conversation

AsCress
Copy link
Contributor

@AsCress AsCress commented May 19, 2024

Fixes #2421 and #2173
This issue was arising primarily due to the following two reasons:-

  1. In the ChannelParametersFragment, whenever one checkbox was checked, the other was being unchecked without correcting the state of isAudioInputSelected, causing it to get toggled two times, resulting in it being false, even when one of the audio inputs was selected.
  2. In the OscilloscopeActivity, the synchronized method was placed in the wrong scope, causing lock.wait() to get executed even when there was no PSLab Device connected. As there was no input, the thread would keep waiting forever, as lock.notify() would never be called. Hence, it would never detect a change in isAudioInputSelected.

Changes

  • app/src/main/java/io/pslab/fragment/ChannelParametersFragment.java - corrected the state of isAudioInputSelected whenever a checkbox is checked, due to another getting unchecked.
  • app/src/main/java/io/pslab/activity/OscilloscopeActivity.java - corrected the scope of the synchronized method, so that lock.wait() only gets executed if the PSLab Device is connected.

Screenshots / Recordings

This is a screenshot of the OscilloscopeActivity, after following the required steps to reproduce the issue, as mentioned in #2421.
WhatsApp Image 2024-05-19 at 6 29 45 PM
As one can see, the issue is resolved.

Checklist:

  • No hard coding: I have used resources from strings.xml, dimens.xml and colors.xml without hard coding any value.
  • No end of file edits: No modifications done at end of resource files strings.xml, dimens.xml or colors.xml.
  • Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • No extra space: My code does not contain any extra lines or extra spaces than the ones that are necessary.

@@ -10,6 +10,7 @@
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import android.util.Log;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this is unused?

Copy link
Contributor Author

@AsCress AsCress May 19, 2024

Choose a reason for hiding this comment

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

Oh yes! My bad, I had added these for debugging. I'm removing them.

@AsCress AsCress requested a review from CloudyPadmal May 19, 2024 15:14
@AsCress
Copy link
Contributor Author

AsCress commented May 19, 2024

@CloudyPadmal Done:)

@marcnause
Copy link
Contributor

I have tested the app without the fix and with the fix. I was able to reproduce the problem and I can confirm that I can toggle between both MICs now and the build-in microphone works whenever it is selected in the version which contains the fix.

@marcnause
Copy link
Contributor

@AsCress, just a general remark: I just noticed that you created this pull request on your development branch. I don't know if this was intentional or not. I like to (and sometimes forget to) make an extra branch for every issue I work on (named e.g. issue2421). That way I can switch between working on different issues. Even more convenient: Waiting for the merge of a pull request does not block me from working on other issues.

@AsCress
Copy link
Contributor Author

AsCress commented May 22, 2024

@AsCress, just a general remark: I just noticed that you created this pull request on your development branch. I don't know if this was intentional or not. I like to (and sometimes forget to) make an extra branch for every issue I work on (named e.g. issue2421). That way I can switch between working on different issues. Even more convenient: Waiting for the merge of a pull request does not block me from working on other issues.

@marcnause Thank you very much for testing the fix and your comments!! I'll surely make extra branches for different issues from now on.

@CloudyPadmal CloudyPadmal merged commit 186bb0d into fossasia:development May 24, 2024
2 checks passed
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.

After toggling the PSLab MIC, the In-Built-MIC feature doesn't work, when the PSLab device isn't connected
3 participants