billthefarmer / scope

Android Oscilloscope

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vertical grid lines and X-axis labels are missing in frequency domain view (i.e. spectrum view)

Olf0 opened this issue · comments

commented

Observed with Oscilloscope 1.14 under AOSP 4.1.2, while in the time domain view the vertical grid lines and X-axis labels are present.
Two screenshots to illustrate this:

  • Frequency domain view (broken): screenshot_org billthefarmer scope-1 1 4_frequency-domain
  • Time domain view (O.K.): screenshot_org billthefarmer scope-1 1 4_time-domain

I can't reproduce this. I have tested it on an emulator running android 4.1.2. Which phone are you using?

commented

This is on a Jolla 1 phone (Qualcomm Krait dual-core) under SailfishOS 2.1.3.7 (basically a regular Linux distribution) with AlienDalvik 0.17.35 (based on AOSP 4.1.2, API level 16) as Android runtime environment.

Crosschecked on a Blackberry phone under BBos 10.3 (based on QNX with Qt) and its AOSP 4.4 based (API level 19) Android runtime environment (i.e. with a similar architecture of the software stack, but quite different components compared to SFOS / AlienDalvik): Yes, the vertical grid lines and X-axis marks are indeed present.

Shall I capture logs on the phone under SailfishOS with AlienDalvik, i.e. may logs be helpful?

There won't be anything useful in the logs. This is interesting because the only thing unusual about the spectrum scale and graticule is that it uses the Math.log function, but so does the dB calculation and the spectrum trace, and that's working correctly.

I will attach a debug version of the app with logging added which may shed some light. It also has the workaround for #16. The log output on adb logcat looks like this:

$ /d/adt/android-sdk-windows/platform-tools/adb logcat | grep Freq
12-11 11:13:56.640 12942 12942 D FreqScale: Scale 0.0060948194
12-11 11:13:56.640 12942 12942 D FreqScale: Fps 10.7666015625
12-11 11:13:56.640 12942 12942 D FreqScale: X 101.60816
12-11 11:13:56.641 12942 12942 D FreqScale: X 251.94743
12-11 11:13:56.643 12942 12942 D FreqScale: X 365.6747
12-11 11:13:56.644 12942 12942 D FreqScale: X 479.40198
12-11 11:13:56.645 12942 12942 D FreqScale: X 629.7413
12-11 11:13:56.646 12942 12942 D FreqScale: X 743.4685
12-11 11:13:56.647 12942 12942 D FreqScale: X 857.1958
12-11 11:13:56.648 12942 12942 D FreqScale: X 1007.53503
12-11 11:13:56.649 12942 12942 D FreqScale: X 1121.2623
12-11 11:13:56.650 12942 12942 D FreqScale: X 1234.9896
12-11 11:13:56.651 12942 12942 D FreqScale: X 1385.329

Scope-debug.zip

commented

Dear @billthefarmer,

first of all many thanks for promptly creating a debug version of "Oscilloscope".
The funny thing is, it does not only fix issue #16 for me (as advertised), but also issue #15 (this issue)!

Nevertheless, I captured logs (locally with aLogcat). Side note: Thanks for showing the expected output, which helped me to refine aLogcat's settings.

HTH and kudos to you for creating all these nice tools, e.g. Oscilloscope, Signal Generator, Tuner and more.

Cheers & thanks again!

commented

Well, I started having doubts, if I carried out the tests correctly. I did not mention, that I tried the scope-114-debug version on my other Jolla 1 phone (which is primarily used for testing purposes), as it has the same basic software stack installed, hence I assumed switching the phone to be irrelevant (and ultimately it was).

First I installed the original scope-114 version from F-Droid on my testing phone again: To my big surprise, the frequency scale and vertical grid lines were displayed (when I successfully managed to enter the spectrum view, after a couple of tries due to issue #16).

So I took my "production" Jolla 1 phone (still with the F-Droid version of scope-114 installed) and repeated this: At least it reproducibly did not show the frequency scale and vertical grid lines in the spectrum view.

I was just about to clear "Oscilloscope"'s app data on the "production" phone right away, but decided to archive it first, if starting anew should really make a difference. After clearing /data/data/org.billthefarmer.scope/shared_prefs/org.billthefarmer.scope_preferences.xml this issue (#15) was gone!

I will compare the archived version of the preferences with the current one in order to track down the offending line (hopefully).

commented

[root@sailfish tmp]# ls -l prefs-anew/
total 8
-rw-r----- 1 root root 126 2017-12-12 01:09 _has_set_default_values.xml
-rw-r----- 1 root root 150 2017-12-12 01:09 org.billthefarmer.scope_preferences.xml
[root@sailfish tmp]# ls -l shared_prefs/
total 8
-rw-rw---- 1 10056 10056 126 2017-12-02 08:34 _has_set_default_values.xml
-rw-rw---- 1 10056 10056 195 2017-12-10 05:52 org.billthefarmer.scope_preferences.xml
[root@sailfish tmp]# diff shared_prefs/org.billthefarmer.scope_preferences.xml prefs-anew/org.billthefarmer.scope_preferences.xml
3d2
< <boolean name="pref_screen" value="false" />
[root@sailfish tmp]#

commented

For a final check, I transfered to settings file with the offending line <boolean name="pref_screen" value="false" /> to the test-phone:

  • With the scope-114-debug version, the issue (#15) is not reproducible.
  • With the scope-114 from F-Droid, the issue (#15) is reproducible!

I have no idea, when and how the offending line was introduced into the preferences file, as I always set the preferences at "Oscilloscope"'s GUI and never manually edited it.

For reference, the complete file:

Well that's interesting, pref_screen is the screen preference to stop the screen turning off while you're busy testing something - here. And that's the only reference to it apart from the declaration at the top of the file. I never check preference files because you need to turn on root privileges to access them. The only other change I made was to move this line to here because the audio input system doesn't work correctly on the 4.1.2 emulator, so fps wasn't getting set because the audio system never gets started.

So one possible cause of the problem is that fps wasn't getting set, but on the other hand the audio system was working because you got a correct trace. And the scope works.

The preference should be there, perhaps they don't get in the file unless you set them, I don't know as I never check. I will release another version with those changes and the debugging removed. F-Droid is currently rather slow, it can take more than a week for a release to work it's way through their system.

I just thought of another possible reason for this, perhaps in that particular implementation of the android run time system the draw methods for the views got executed before the audio thread had got around to setting fps, so me moving it to before the audio system started was enough to fix it.

commented

The preference should be there, perhaps they don't get in the file unless you set them, [...]

That perfectly makes sense: I believe I once switched the pref_screen setting on (to try it) and off again, later.

commented

Fixed in Oscilloscope 1.1.5 (obtained from F-Droid).
Thank you, @billthefarmer, this was a nice, little Christmas present.
All the best and an excellent start into the new year!