@@ -337,9 +337,9 @@ void menuAttachedDevices()
337337 case DEVICE_PRESSURE_MS5837:
338338 SerialPrintf3 (" %s MS5837 (BAR30 / BAR02) Pressure Sensor %s\r\n " , strDeviceMenu, strAddress);
339339 break ;
340- // case DEVICE_QWIIC_BUTTON:
341- // SerialPrintf3("%s Qwiic Button %s\r\n", strDeviceMenu, strAddress);
342- // break;
340+ case DEVICE_QWIIC_BUTTON:
341+ SerialPrintf3 (" %s Qwiic Button %s\r\n " , strDeviceMenu, strAddress);
342+ break ;
343343 case DEVICE_BIO_SENSOR_HUB:
344344 SerialPrintf3 (" %s Bio Sensor Pulse Oximeter %s\r\n " , strDeviceMenu, strAddress);
345345 break ;
@@ -2513,73 +2513,73 @@ void menuConfigure_MS5837(void *configPtr)
25132513 }
25142514}
25152515
2516- // void menuConfigure_QWIIC_BUTTON(void *configPtr)
2517- // {
2518- // struct_QWIIC_BUTTON *sensorSetting = (struct_QWIIC_BUTTON*)configPtr;
2519- //
2520- // while (1)
2521- // {
2522- // SerialPrintln(F(""));
2523- // SerialPrintln(F("Menu: Configure Qwiic Button"));
2524- //
2525- // SerialPrint(F("1) Sensor Logging: "));
2526- // if (sensorSetting->log == true) SerialPrintln(F("Enabled"));
2527- // else SerialPrintln(F("Disabled"));
2528- //
2529- // if (sensorSetting->log == true)
2530- // {
2531- // SerialPrint(F("2) Log Button Presses: "));
2532- // if (sensorSetting->logPressed == true) SerialPrintln(F("Enabled"));
2533- // else SerialPrintln(F("Disabled"));
2534- //
2535- // SerialPrint(F("3) Log Button Clicks: "));
2536- // if (sensorSetting->logClicked == true) SerialPrintln(F("Enabled"));
2537- // else SerialPrintln(F("Disabled"));
2538- //
2539- // SerialPrint(F("4) Toggle LED on each click (and log the LED state): "));
2540- // if (sensorSetting->toggleLEDOnClick == true) SerialPrintln(F("Enabled"));
2541- // else SerialPrintln(F("Disabled"));
2542- //
2543- // SerialPrintf2("5) LED Brightness: %d\r\n", sensorSetting->ledBrightness);
2544- // }
2545- // SerialPrintln(F("x) Exit"));
2546- //
2547- // int incoming = getNumber(menuTimeout); //Timeout after x seconds
2548- //
2549- // if (incoming == 1)
2550- // sensorSetting->log ^= 1;
2551- // else if (sensorSetting->log == true)
2552- // {
2553- // if (incoming == 2)
2554- // sensorSetting->logPressed ^= 1;
2555- // else if (incoming == 3)
2556- // sensorSetting->logClicked ^= 1;
2557- // else if (incoming == 4)
2558- // sensorSetting->toggleLEDOnClick ^= 1;
2559- // else if (incoming == 5)
2560- // {
2561- // SerialPrint(F("Enter the LED brightness (0 to 255): "));
2562- // int bright = getNumber(menuTimeout); //x second timeout
2563- // if (bright < 0 || bright > 255)
2564- // SerialPrintln(F("Error: Out of range"));
2565- // else
2566- // sensorSetting->ledBrightness = bright;
2567- // }
2568- // else if (incoming == STATUS_PRESSED_X)
2569- // break;
2570- // else if (incoming == STATUS_GETNUMBER_TIMEOUT)
2571- // break;
2572- // else
2573- // printUnknown(incoming);
2574- // }
2575- // else if (incoming == STATUS_PRESSED_X)
2576- // break;
2577- // else if (incoming == STATUS_GETNUMBER_TIMEOUT)
2578- // break;
2579- // else
2580- // printUnknown(incoming);
2581- // }
2582- // }
2516+ void menuConfigure_QWIIC_BUTTON (void *configPtr)
2517+ {
2518+ struct_QWIIC_BUTTON *sensorSetting = (struct_QWIIC_BUTTON*)configPtr;
2519+
2520+ while (1 )
2521+ {
2522+ SerialPrintln (F (" " ));
2523+ SerialPrintln (F (" Menu: Configure Qwiic Button" ));
2524+
2525+ SerialPrint (F (" 1) Sensor Logging: " ));
2526+ if (sensorSetting->log == true ) SerialPrintln (F (" Enabled" ));
2527+ else SerialPrintln (F (" Disabled" ));
2528+
2529+ if (sensorSetting->log == true )
2530+ {
2531+ SerialPrint (F (" 2) Log Button Presses: " ));
2532+ if (sensorSetting->logPressed == true ) SerialPrintln (F (" Enabled" ));
2533+ else SerialPrintln (F (" Disabled" ));
2534+
2535+ SerialPrint (F (" 3) Log Button Clicks: " ));
2536+ if (sensorSetting->logClicked == true ) SerialPrintln (F (" Enabled" ));
2537+ else SerialPrintln (F (" Disabled" ));
2538+
2539+ SerialPrint (F (" 4) Toggle LED on each click (and log the LED state): " ));
2540+ if (sensorSetting->toggleLEDOnClick == true ) SerialPrintln (F (" Enabled" ));
2541+ else SerialPrintln (F (" Disabled" ));
2542+
2543+ SerialPrintf2 (" 5) LED Brightness: %d\r\n " , sensorSetting->ledBrightness );
2544+ }
2545+ SerialPrintln (F (" x) Exit" ));
2546+
2547+ int incoming = getNumber (menuTimeout); // Timeout after x seconds
2548+
2549+ if (incoming == 1 )
2550+ sensorSetting->log ^= 1 ;
2551+ else if (sensorSetting->log == true )
2552+ {
2553+ if (incoming == 2 )
2554+ sensorSetting->logPressed ^= 1 ;
2555+ else if (incoming == 3 )
2556+ sensorSetting->logClicked ^= 1 ;
2557+ else if (incoming == 4 )
2558+ sensorSetting->toggleLEDOnClick ^= 1 ;
2559+ else if (incoming == 5 )
2560+ {
2561+ SerialPrint (F (" Enter the LED brightness (0 to 255): " ));
2562+ int bright = getNumber (menuTimeout); // x second timeout
2563+ if (bright < 0 || bright > 255 )
2564+ SerialPrintln (F (" Error: Out of range" ));
2565+ else
2566+ sensorSetting->ledBrightness = bright;
2567+ }
2568+ else if (incoming == STATUS_PRESSED_X)
2569+ break ;
2570+ else if (incoming == STATUS_GETNUMBER_TIMEOUT)
2571+ break ;
2572+ else
2573+ printUnknown (incoming);
2574+ }
2575+ else if (incoming == STATUS_PRESSED_X)
2576+ break ;
2577+ else if (incoming == STATUS_GETNUMBER_TIMEOUT)
2578+ break ;
2579+ else
2580+ printUnknown (incoming);
2581+ }
2582+ }
25832583
25842584void menuConfigure_BIO_SENSOR_HUB (void *configPtr)
25852585{
0 commit comments