Tympan / Tympan_Library

Arduino/Teensy Library for Tympan Open Source Hearing Aid
MIT License
124 stars 33 forks source link

RevE Review of Example Sketches #35

Closed chipaudette closed 3 years ago

chipaudette commented 3 years ago

Prior to the Release of RevE, we need to review the example sketches in the develop branch.

Items to do:

1) Convert all examples from "myTympan(TympanRev::D)" to "myTympan(TympanRev:E)" 2) Find all sketches that still use the old bluetooth style, which we'll need to convert to BLE

What to test:

1) Compile for RevE (Teensy 4.1).

Order of Priority:

1) The sketches in the "01-Basic" directory are the most critical. These must be right. They are also probably the most-likely to be already working perfectly. So, they should be quick. 2) Everything else will be slower to test and use

hgeithner-creare commented 3 years ago

The following has been tested using Teensydunio 1.54 and Arduino 1.8.15.

Example Changed to RevE Check with RevE Check with RevD Notes
01-AudioPassThru Yes Pass Pass
01-BasicGain Yes Pass Pass
01-ChangeSampleRate Yes Pass Pass
01-PrintCPUandMemoryUsage Yes Pass Pass
01-TrebleBoost Yes Pass Pass
01-TrebleBoost_wComp Yes Pass Pass
02-BluetoothAudio_PassThru Yes Fail Pass Could not hear the Tympan mic mixed with audio on RevD. RevE would not appear on the Bluetooth list (Android/iOS).
02-ControlViaSerial Yes Pass Pass
02-ControlViaSerialAndBluetooth Yes Configure for BLE
02-DetectExtMic Yes Pass Pass
02-EchoBLE Yes Pass Pass
02-MyAudioAlgorithm Yes Pass Pass
02-OutputToneWithSteppedamplitude Yes Pass Pass
02-RenameTympanBT Yes N/A N/A
02-SDWavPlayer Yes Couldn't access the SD card for RevE. Buzzing sound playing over audio for RevD.
02-SDWriting_01_StereoAudio Yes Pass? Pass Cannot access recorded file on SD Card for RevE
02-SDWriting_02_RemoteControlled Yes Pass Pass
02-SoundLevelMeter Yes Pass Pass? Couldn't get RevD to connect to app.
02-SoundLevelMeter_2Chan Yes Pass Pass Deprecate?
02-TympanPDMMics Yes Pass Pass Configure for BLE
03-WDRC_FIR_8Band Yes Pass Pass
03-WDRC_SingleBand Yes Pass Pass
04-FormantShifter_FD Yes Pass Pass
04-FrequencyCompressor_FD Yes Pass Pass
04-FrequencyShifter_FD Yes Pass Pass
04-GenericFreqDomainExample_FD Yes Pass Pass
04-LowpassFilter_FD Yes Pass Pass
04-NoiseReduction_FD Yes Pass Pass
05-WDRC_3BandIIR_wAFC Yes Fail Fail Did not play anything (not sure this ever worked for me so maybe I am doing something wrong)
05-WDRC_8BandFIR Yes Fail Fail High pitch tone (not sure this ever worked for me so maybe I am doing something wrong)
05-WDRC_8BandIIR_wAFC Yes Fail Fail Did not play anything (not sure this ever worked for me so maybe I am doing something wrong)
06-BasicGain_wApp Yes Pass Pass GUI fits to Tab A screen. As of 7/20/21 the Tympan connected to the app.
08-WDRC_XBand_PrescripSave_wApp ----- ------ ------- Configure for BLE

When you first compile/upload any sketch to the Tympan (either D or E) the message seen below is displayed. If you compile a second time, the message does not get printed. compiling_Message_Teensydunio1 54

The following message is printed with Teensy 4.1: new_Teensy_Loaded_Message

chipaudette commented 3 years ago

Regarding the errors/warnings upon first compilation...

I fixed the "jump to case" warning and its associated note about "crosses initialization". The problem was that I created a variable ("int pinVal") within one of the cases in a switch-case block of code. While that's sorta fine, it's best practice to employ curly braces within the case to explicitly limit the scope of pinVal. Once I added the curly braces, this warning went away.

I also got rid of the unused new_val variable, making that warning go away.

I don't know what to do about the type-punned pointer (that was originally created by @kxm-creare). I don't know if we should avoid employing this technique, or if there is some simple fix to suppress the compiler warning.

Not shown in your report is that there is that the compilation can fail due to some minw (or is it mingw?) issue. It's like there are too many items getting compiled it gets confused. If you compile again (when it uses some cached items from the first compile) it compiles fine. I wish I knew how to avoid that problem, but I don't. :(

chipaudette commented 3 years ago

Regarding the message printed with the Teensy 4.1...

That's a fine message. That's the way that Teensyduino 1.54 as expanded its reporting of FLASH and RAM usage. The Teensy 4.x has a more complicated memory structure than the Teensy 3.x. The Teensy 4.x has two RAM areas. They expanded the reporting to be more explicit. I don't know what the details of the message mean, but I guess it's a good thing.

Either way, your screenshot reflects normal operation (I believe). I think that this means that it's good.

chipaudette commented 3 years ago

@hgeithner-creare , I see that you flagged the example "02-BluetoothAudio_PassThru" for additional work regarding BLE (because it lacked the usual BLE commands). This, though, is a werdo example in that it employs bluetooth, but not as a means for conveying commands back-and-forth. Instead, it uses bluetooth in a completely different mode. It uses bluetooth just to receive an audio stream from your phone....like you're connected to a BT speaker or something....or like you're connected to a hands-free headset.

Can you try testing it as a Bluetooth audio device?

At the same time, you should be able to tap on the case of the Tympan and hear the Tympan's own microphones mixed with the BT audio.

Can you test this sketch on both RevD and RevE and confirm that it behaves like this? On RevE, can you also confirm that it can receive audio from both Android and iOS?

(Again, you do NOT need the TympanRemote app to do any of this. This sketch has nothing to do with the TympanRemote app. This sketch relies on the built-in capabilities of the BT module on the Tympan to talk with phones. So, hopefully, it just works. Hopefully.)

chipaudette commented 3 years ago

02-SDWriting_02_RemoteControlled has been updated for BLE.

@hgeithner-creare Please test. Lights blink slow (1/sec) when not recording. Lights blink fast (10x / sec) when recording. That's a good enough test.

chipaudette commented 3 years ago

02-SoundLevelMeter_2Chan has no bluetooth interaction to the App. So, please remove the comment to "Configure for BLE".

Instead, we should consider dropping it. Does it really add anything when we already have the single-channel SLM example?

chipaudette commented 3 years ago

@hgeithner-creare, now that we have updated the BLE class for RevD, can you retry the single-channel SLM example ("02-SoundLevelMeter"). It works on my RevE.

Here's a test method:

hgeithner-creare commented 3 years ago

@chipaudette I've completed the testing and updated the table above.

chipaudette commented 3 years ago

In responses to the failures that you identified last month, we started separate Issues. So I'm closing this one. Good work, Haley!