Add panel test mode to the UI.
This commit is contained in:
parent
d38307d3bc
commit
74f94c5bf5
@ -208,7 +208,7 @@ namespace smx_config
|
||||
DiagnosticMode.AddHandler(ComboBox.SelectionChangedEvent, new RoutedEventHandler(delegate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
for(int pad = 0; pad < 2; ++pad)
|
||||
SMX.SMX.SetTestMode(pad, GetTestMode());
|
||||
SMX.SMX.SetSensorTestMode(pad, GetTestMode());
|
||||
}));
|
||||
|
||||
OnConfigChange onConfigChange;
|
||||
@ -220,13 +220,13 @@ namespace smx_config
|
||||
Loaded += delegate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
for(int pad = 0; pad < 2; ++pad)
|
||||
SMX.SMX.SetTestMode(pad, GetTestMode());
|
||||
SMX.SMX.SetSensorTestMode(pad, GetTestMode());
|
||||
};
|
||||
|
||||
Unloaded += delegate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
for(int pad = 0; pad < 2; ++pad)
|
||||
SMX.SMX.SetTestMode(pad, SMX.SMX.SensorTestMode.Off);
|
||||
SMX.SMX.SetSensorTestMode(pad, SMX.SMX.SensorTestMode.Off);
|
||||
};
|
||||
}
|
||||
|
||||
@ -353,4 +353,19 @@ namespace smx_config
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public class PanelTestModeCheckbox: CheckBox
|
||||
{
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
}
|
||||
|
||||
protected override void OnClick()
|
||||
{
|
||||
base.OnClick();
|
||||
|
||||
SMX.SMX.SetPanelTestMode((bool) IsChecked? SMX.SMX.PanelTestMode.PressureTest:SMX.SMX.PanelTestMode.Off);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ Use if the platform is too sensitive.</clr:String>
|
||||
Text="Some sensors on this panel have incorrect jumpers."
|
||||
/>
|
||||
</DockPanel>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Margin="10,10,0,0"
|
||||
@ -626,7 +626,16 @@ Use if the platform is too sensitive.</clr:String>
|
||||
Margin="10,0,0,0"
|
||||
/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Margin="10,10,0,0"
|
||||
>
|
||||
<controls:PanelTestModeCheckbox
|
||||
x:Name="PanelTestModeCheckbox"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
Content="Panel test mode"
|
||||
/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
|
@ -318,6 +318,8 @@ namespace SMX
|
||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool SMX_GetTestData(int pad, out SMXSensorTestModeData data);
|
||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void SMX_SetPanelTestMode(int mode);
|
||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool SMX_SetLights2(byte[] buf, int lightDataSize);
|
||||
[DllImport("SMX.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool SMX_ReenableAutoLights();
|
||||
@ -459,7 +461,7 @@ namespace SMX
|
||||
Tare = '3',
|
||||
};
|
||||
|
||||
public static void SetTestMode(int pad, SensorTestMode mode)
|
||||
public static void SetSensorTestMode(int pad, SensorTestMode mode)
|
||||
{
|
||||
if(!DLLAvailable()) return;
|
||||
SMX_SetTestMode(pad, (int) mode);
|
||||
@ -475,6 +477,17 @@ namespace SMX
|
||||
return SMX_GetTestData(pad, out data);
|
||||
}
|
||||
|
||||
public enum PanelTestMode {
|
||||
Off = '0',
|
||||
PressureTest = '1',
|
||||
};
|
||||
|
||||
public static void SetPanelTestMode(PanelTestMode mode)
|
||||
{
|
||||
if(!DLLAvailable()) return;
|
||||
SMX_SetPanelTestMode((int) mode);
|
||||
}
|
||||
|
||||
public static void FactoryReset(int pad)
|
||||
{
|
||||
if(!DLLAvailable()) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user