MCPcopy Create free account
hub / github.com/BruceDevices/firmware / runAudioControlTest

Function runAudioControlTest

src/modules/ble/BLE_Suite.cpp:4788–4861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4786}
4787
4788void runAudioControlTest(NimBLEAddress target) {
4789 AutoCleanup cleanup([]() { BLEStateManager::deinitBLE(true); });
4790
4791 const int AUDIO_TESTS = 4;
4792 const char *audioTestNames[] = {
4793 "Test AVRCP Service", "Test Media Control", "Test Telephony", "Test All Audio"
4794 };
4795
4796 int selectedTest = 0;
4797 int lastSelected = -1;
4798 bool exitSubmenu = false;
4799
4800 while (!exitSubmenu) {
4801 if (selectedTest != lastSelected) {
4802 tft.fillScreen(bruceConfig.bgColor);
4803 tft.drawRect(5, 5, tftWidth - 10, tftHeight - 10, TFT_WHITE);
4804
4805 tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
4806 tft.setTextSize(2);
4807 tft.setCursor((tftWidth - tft.textWidth("AUDIO CONTROL TEST")) / 2, 15);
4808 tft.print("AUDIO CONTROL TEST");
4809 tft.setTextSize(1);
4810
4811 tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
4812 tft.setCursor(20, 60);
4813 tft.println("Select Audio Test:");
4814
4815 int maxTests = std::min(AUDIO_TESTS, 5);
4816 int testHeight = 35, startY = 90;
4817
4818 for (int i = 0; i < maxTests; i++) {
4819 int yPos = startY + (i * testHeight);
4820 if (yPos + testHeight > tftHeight - 45) break;
4821
4822 String displayName = audioTestNames[i];
4823 if (displayName.length() > 28) displayName = displayName.substring(0, 25) + "...";
4824
4825 if (i == selectedTest) {
4826 tft.fillRoundRect(30, yPos, tftWidth - 60, testHeight - 5, 5, TFT_WHITE);
4827 tft.setTextColor(TFT_BLACK, TFT_WHITE);
4828 tft.setCursor(40, yPos + 10);
4829 tft.print("> ");
4830 } else {
4831 tft.fillRoundRect(30, yPos, tftWidth - 60, testHeight - 5, 5, TFT_DARKGREY);
4832 tft.setTextColor(TFT_WHITE, TFT_DARKGREY);
4833 tft.setCursor(40, yPos + 10);
4834 tft.print(" ");
4835 }
4836 tft.print(displayName);
4837 }
4838
4839 tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
4840 tft.setCursor(20, tftHeight - 35);
4841 tft.print("SEL: Test PREV/NEXT: Navigate ESC: Back");
4842
4843 lastSelected = selectedTest;
4844 }
4845

Callers 1

showTestingSubMenuFunction · 0.85

Calls 12

checkFunction · 0.85
executeAudioTestFunction · 0.85
disableMethod · 0.80
fillScreenMethod · 0.45
drawRectMethod · 0.45
setTextColorMethod · 0.45
setTextSizeMethod · 0.45
setCursorMethod · 0.45
textWidthMethod · 0.45
printMethod · 0.45
printlnMethod · 0.45
fillRoundRectMethod · 0.45

Tested by

no test coverage detected