Skip to content

Commit a374506

Browse files
committed
-RotaryEncoderModule: Fixed GUI on r2025 dark mode
-FlexIOConfigGUI: Added channel labels, fixed layout on r2025a
1 parent 1c2a447 commit a374506

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Functions/Internal Functions/Settings Menu/FlexIOConfigGUI.m

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,43 @@
3535
error('Error: Flex I/O configuration requires State Machine r2+ or newer.');
3636
end
3737
dropMenuHeight = 35;
38+
dropMenuYpos = 140;
3839
if verLessThan('matlab', '25.1')
3940
dropMenuHeight = 15;
41+
dropMenuYpos = 160;
4042
end
4143
% Set background color to match UI theme
4244
bgColor = [.8 .8 .8];
4345
if IsMATLAB_DarkMode
4446
bgColor = [0.15 0.15 0.15];
4547
end
46-
BpodSystem.GUIHandles.FlexConfigFig = figure('Position',[600 400 500 200],'name','Flex I/O Config.',...
48+
BpodSystem.GUIHandles.FlexConfigFig = figure('Position',[600 400 500 260],'name','Flex I/O Config.',...
4749
'numbertitle','off', 'MenuBar', 'none', 'Resize', 'off');
4850
fontName = 'Courier New';
4951
ha = axes('units','normalized', 'position',[0 0 1 1]);
5052
uistack(ha,'bottom');
5153
bg = imread('InputChannelConfig2.bmp');
5254
image(bg); axis off;
5355
channelTypeStrings = {'Digital In', 'Digital Out', 'Analog In', 'Analog Out', 'Disabled'};
54-
BpodSystem.GUIHandles.FlexConfig1 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [35 120 100 dropMenuHeight],...
56+
% BpodSystem.GUIHandles.FlexConfig1Label = uicontrol('Style', 'text', 'String', 'Ch1', 'Position', [35 150 100 25],...
57+
% 'BackgroundColor', bgColor, 'FontSize', 12);
58+
BpodSystem.GUIHandles.FlexConfig1 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [35 dropMenuYpos 100 dropMenuHeight],...
5559
'Callback', @UpdateFlexConfig,'TooltipString', 'Select Channel Type', 'BackgroundColor', bgColor, 'FontSize', 12,...
5660
'Value', BpodSystem.HW.FlexIO_ChannelTypes(1)+1);
57-
BpodSystem.GUIHandles.FlexConfig2 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [145 120 100 dropMenuHeight],...
61+
BpodSystem.GUIHandles.FlexConfig2 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [145 dropMenuYpos 100 dropMenuHeight],...
5862
'Callback', @UpdateFlexConfig,'TooltipString', 'Select Channel Type', 'BackgroundColor', bgColor, 'FontSize', 12,...
5963
'Value', BpodSystem.HW.FlexIO_ChannelTypes(2)+1);
60-
BpodSystem.GUIHandles.FlexConfig3 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [255 120 100 dropMenuHeight],...
64+
BpodSystem.GUIHandles.FlexConfig3 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [255 dropMenuYpos 100 dropMenuHeight],...
6165
'Callback', @UpdateFlexConfig,'TooltipString', 'Select Channel Type', 'BackgroundColor', bgColor, 'FontSize', 12,...
6266
'Value', BpodSystem.HW.FlexIO_ChannelTypes(3)+1);
63-
BpodSystem.GUIHandles.FlexConfig4 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [365 120 100 dropMenuHeight],...
67+
BpodSystem.GUIHandles.FlexConfig4 = uicontrol('Style', 'popupmenu', 'String', channelTypeStrings, 'Position', [365 dropMenuYpos 100 dropMenuHeight],...
6468
'Callback', @UpdateFlexConfig,'TooltipString', 'Select Channel Type', 'BackgroundColor', bgColor, 'FontSize', 12,...
6569
'Value', BpodSystem.HW.FlexIO_ChannelTypes(4)+1);
66-
text(130, 25, 'Flex I/O Config', 'FontName', fontName, 'FontSize', 16, 'Color', [0.8 0.8 0.8]);
70+
text(130, 20, 'Flex I/O Config', 'FontName', fontName, 'FontSize', 16, 'Color', [0.8 0.8 0.8]);
71+
text(55, 40, 'Ch1', 'FontName', fontName, 'FontSize', 12, 'Color', [0.8 0.8 0.8]);
72+
text(145, 40, 'Ch2', 'FontName', fontName, 'FontSize', 12, 'Color', [0.8 0.8 0.8]);
73+
text(232, 40, 'Ch3', 'FontName', fontName, 'FontSize', 12, 'Color', [0.8 0.8 0.8]);
74+
text(320, 40, 'Ch4', 'FontName', fontName, 'FontSize', 12, 'Color', [0.8 0.8 0.8]);
6775

6876
function UpdateFlexConfig(~,~)
6977
global BpodSystem % Import the global BpodSystem object

Functions/Modules/RotaryEncoder/RotaryEncoderModule.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,12 @@ function streamUI(obj)
583583
error('Error: The Rotary Encoder Module is logging to microSD. Turn off logging with stopLogging() to enable USB streaming.')
584584
end
585585
if obj.uiStreaming == 0
586+
% Set background color to match UI theme
587+
bgColor = [.8 .8 .8];
588+
if IsMATLAB_DarkMode
589+
bgColor = [0.2 0.2 0.2];
590+
end
586591
obj.uiStreaming = 1;
587-
bgColor = [0.8 0.8 0.8];
588592
thresholdColors = {[0 0 1], [1 0 0], [0 1 0], [1 1 0], [0 1 1],...
589593
[1 0 1], [0.5 0 0], [0 0.5 0]};
590594
obj.displayPositions = nan(1,obj.nDisplaySamples);
@@ -606,13 +610,13 @@ function streamUI(obj)
606610
set(gca, 'ytick', [-180 0 180], 'ylim', [-180 180]);
607611
end
608612
xData = nan(1,obj.nDisplaySamples); yData = nan(1,obj.nDisplaySamples);
613+
obj.gui.OscopeDataLine = line([xData,xData],[yData,yData]);
609614
obj.gui.StartLine = line([0,obj.maxDisplayTime],[0,0], 'Color', [.5 .5 .5]);
610615
nThresholds = length(obj.thresholds);
611616
obj.gui.ThreshLine = cell(1,nThresholds);
612617
for i = 1:nThresholds
613618
obj.gui.ThreshLine{i} = line([0,obj.maxDisplayTime],[NaN NaN], 'Color', thresholdColors{i}, 'LineStyle', ':');
614619
end
615-
obj.gui.OscopeDataLine = line([xData,xData],[yData,yData]);
616620
yPos = 445;
617621
uicontrol('Style', 'text', 'Position', [600 yPos 170 30], 'String', 'Threshold Events', 'FontSize', 14,...
618622
'FontWeight', 'bold', 'BackgroundColor', bgColor); yPos = yPos - 30;

0 commit comments

Comments
 (0)