@@ -552,13 +552,13 @@ LfpDisplayOptions::LfpDisplayOptions (LfpDisplayCanvas* canvas_, LfpDisplaySplit
552552 lfpDisplay->setRange (voltageRanges[ContinuousChannel::Type::ADC][selectedVoltageRange[ContinuousChannel::Type::ADC] - 1 ].getFloatValue ()
553553 * rangeGain[ContinuousChannel::Type::ADC],
554554 ContinuousChannel::Type::ADC);
555-
555+
556556 // Handle Auto scaling for AUX channels during initialization
557557 String auxRangeValue = voltageRanges[ContinuousChannel::Type::AUX][selectedVoltageRange[ContinuousChannel::Type::AUX] - 1 ];
558- if (auxRangeValue.equalsIgnoreCase (" Auto" ))
558+ if (auxRangeValue.equalsIgnoreCase (" Auto" ))
559559 {
560560 // Set a default range value for the type (used as fallback)
561- lfpDisplay->setRange (2000 .0f * rangeGain[ContinuousChannel::Type::AUX], ContinuousChannel::Type::AUX);
561+ lfpDisplay->setRange (2000 .0f * rangeGain[ContinuousChannel::Type::AUX], ContinuousChannel::Type::AUX);
562562 // Apply individual auto-scaling to each AUX channel based on their InputRange
563563 lfpDisplay->setAutoRangeForAuxChannels ();
564564 }
@@ -1212,12 +1212,12 @@ void LfpDisplayOptions::comboBoxChanged (ComboBox* cb)
12121212 if (cb->getSelectedId ())
12131213 {
12141214 String selectedText = voltageRanges[selectedChannelType][cb->getSelectedId () - 1 ];
1215-
1215+
12161216 // Check if "Auto" is selected for AUX channels
1217- if (selectedChannelType == ContinuousChannel::Type::AUX && selectedText.equalsIgnoreCase (" Auto" ))
1217+ if (selectedChannelType == ContinuousChannel::Type::AUX && selectedText.equalsIgnoreCase (" Auto" ))
12181218 {
12191219 // Set a default range value for the type (used as fallback)
1220- lfpDisplay->setRange (2000 .0f * rangeGain[selectedChannelType], selectedChannelType);
1220+ lfpDisplay->setRange (2000 .0f * rangeGain[selectedChannelType], selectedChannelType);
12211221 // Apply individual auto-scaling to each AUX channel based on their InputRange
12221222 lfpDisplay->setAutoRangeForAuxChannels ();
12231223 }
@@ -1233,14 +1233,12 @@ void LfpDisplayOptions::comboBoxChanged (ComboBox* cb)
12331233 {
12341234 // Check if we should skip the first item (Auto) when validating range
12351235 int firstRangeIndex = 0 ;
1236- if (selectedChannelType == ContinuousChannel::Type::AUX &&
1237- voltageRanges[selectedChannelType][0 ].equalsIgnoreCase (" Auto" ))
1236+ if (selectedChannelType == ContinuousChannel::Type::AUX && voltageRanges[selectedChannelType][0 ].equalsIgnoreCase (" Auto" ))
12381237 {
12391238 firstRangeIndex = 1 ;
12401239 }
1241-
1242- if (firstRangeIndex < voltageRanges[selectedChannelType].size () &&
1243- vRange < voltageRanges[selectedChannelType][firstRangeIndex].getFloatValue ())
1240+
1241+ if (firstRangeIndex < voltageRanges[selectedChannelType].size () && vRange < voltageRanges[selectedChannelType][firstRangeIndex].getFloatValue ())
12441242 {
12451243 cb->setSelectedId (firstRangeIndex + 1 , dontSendNotification);
12461244 vRange = voltageRanges[selectedChannelType][firstRangeIndex].getFloatValue ();
@@ -1433,7 +1431,7 @@ ContinuousChannel::Type LfpDisplayOptions::getSelectedType()
14331431
14341432bool LfpDisplayOptions::isAuxAutoScaleEnabled ()
14351433{
1436- return selectedVoltageRangeValues[ContinuousChannel::Type::AUX].equalsIgnoreCase (" Auto" );
1434+ return selectedVoltageRangeValues[ContinuousChannel::Type::AUX].equalsIgnoreCase (" Auto" );
14371435}
14381436
14391437void LfpDisplayOptions::setSelectedType (ContinuousChannel::Type type, bool toggleButton)
@@ -1452,7 +1450,11 @@ void LfpDisplayOptions::setSelectedType (ContinuousChannel::Type type, bool togg
14521450 else
14531451 rangeSelection->setText (selectedVoltageRangeValues[selectedChannelType], dontSendNotification);
14541452
1455- rangeSelectionLabel->setText (" Range (" + rangeUnits[type] + " )" , dontSendNotification);
1453+ // If AUX and 'Auto' is selected, do not show units
1454+ if (type == ContinuousChannel::Type::AUX && isAuxAutoScaleEnabled ())
1455+ rangeSelectionLabel->setText (" Range" , dontSendNotification);
1456+ else
1457+ rangeSelectionLabel->setText (" Range (" + rangeUnits[type] + " )" , dontSendNotification);
14561458
14571459 repaint (5 , getHeight () - 55 , 300 , 100 );
14581460
@@ -1587,20 +1589,20 @@ void LfpDisplayOptions::loadParameters (XmlElement* xml)
15871589 selectedVoltageRange[2 ] = voltageRanges[2 ].indexOf (ranges[2 ]) + 1 ;
15881590 rangeSelection->setText (ranges[selectedChannelType]);
15891591 lfpDisplay->setRange (ranges[0 ].getFloatValue () * rangeGain[0 ], ContinuousChannel::Type::ELECTRODE);
1590-
1592+
15911593 // Handle Auto scaling for AUX channels
1592- if (ranges[1 ].equalsIgnoreCase (" Auto" ))
1594+ if (ranges[1 ].equalsIgnoreCase (" Auto" ))
15931595 {
15941596 // Set a default range value for the type (used as fallback)
1595- lfpDisplay->setRange (2000 .0f * rangeGain[ContinuousChannel::Type::AUX], ContinuousChannel::Type::AUX);
1597+ lfpDisplay->setRange (2000 .0f * rangeGain[ContinuousChannel::Type::AUX], ContinuousChannel::Type::AUX);
15961598 // Apply individual auto-scaling to each AUX channel based on their InputRange
15971599 lfpDisplay->setAutoRangeForAuxChannels ();
15981600 }
15991601 else
16001602 {
16011603 lfpDisplay->setRange (ranges[1 ].getFloatValue () * rangeGain[1 ], ContinuousChannel::Type::AUX);
16021604 }
1603-
1605+
16041606 lfpDisplay->setRange (ranges[2 ].getFloatValue () * rangeGain[2 ], ContinuousChannel::Type::ADC);
16051607
16061608 // LOGD(" Set range in ", MS_FROM_START, " milliseconds");
0 commit comments