diff --git a/sdk/SMX.h b/sdk/SMX.h index d5c06c1..968277e 100644 --- a/sdk/SMX.h +++ b/sdk/SMX.h @@ -286,6 +286,9 @@ struct SMXSensorTestModeData // The DIP switch settings on each panel. This is used for diagnostics displays. int iDIPSwitchPerPanel[9]; + + // Bad sensor selection DIP indication for each panel. + bool iBadSensorDIP[9][4]; }; #endif diff --git a/sdk/Windows/SMXDevice.cpp b/sdk/Windows/SMXDevice.cpp index 990d5a5..f3a4a60 100644 --- a/sdk/Windows/SMXDevice.cpp +++ b/sdk/Windows/SMXDevice.cpp @@ -486,7 +486,10 @@ void SMX::SMXDevice::HandleSensorTestDataResponse(const string &sReadBuffer) int16_t sensors[4]; uint8_t dip:4; - uint8_t dummy2:4; + uint8_t bad_sensor_dip_0:1; + uint8_t bad_sensor_dip_1:1; + uint8_t bad_sensor_dip_2:1; + uint8_t bad_sensor_dip_3:1; }; #pragma pack(pop) @@ -496,7 +499,8 @@ void SMX::SMXDevice::HandleSensorTestDataResponse(const string &sReadBuffer) memset(output.sensorLevel, 0, sizeof(output.sensorLevel)); memset(output.bBadSensorInput, 0, sizeof(output.bBadSensorInput)); memset(output.iDIPSwitchPerPanel, 0, sizeof(output.iDIPSwitchPerPanel)); - + memset(output.iBadSensorDIP, 0, sizeof(output.iBadSensorDIP)); + for(int iPanel = 0; iPanel < 9; ++iPanel) { // Decode the response from this panel. @@ -519,6 +523,10 @@ void SMX::SMXDevice::HandleSensorTestDataResponse(const string &sReadBuffer) output.bBadSensorInput[iPanel][2] = pad_data.bad_sensor_2; output.bBadSensorInput[iPanel][3] = pad_data.bad_sensor_3; output.iDIPSwitchPerPanel[iPanel] = pad_data.dip; + output.iBadSensorDIP[iPanel][0] = pad_data.bad_sensor_dip_0; + output.iBadSensorDIP[iPanel][1] = pad_data.bad_sensor_dip_1; + output.iBadSensorDIP[iPanel][2] = pad_data.bad_sensor_dip_2; + output.iBadSensorDIP[iPanel][3] = pad_data.bad_sensor_dip_3; for(int iSensor = 0; iSensor < 4; ++iSensor) output.sensorLevel[iPanel][iSensor] = pad_data.sensors[iSensor]; diff --git a/smx-config/DiagnosticsWidgets.cs b/smx-config/DiagnosticsWidgets.cs index e108f04..df252d1 100644 --- a/smx-config/DiagnosticsWidgets.cs +++ b/smx-config/DiagnosticsWidgets.cs @@ -54,7 +54,8 @@ namespace smx_config Pressed = args.controller[SelectedPad].inputs[PanelIndex]; Warning = !args.controller[SelectedPad].test_data.bHaveDataFromPanel[PanelIndex] || - args.controller[SelectedPad].test_data.AnySensorsOnPanelNotResponding(PanelIndex); + args.controller[SelectedPad].test_data.AnySensorsOnPanelNotResponding(PanelIndex) || + args.controller[SelectedPad].test_data.AnyBadDIPSwitchSettingsOnPanel(PanelIndex); }); onConfigChange.RefreshOnInputChange = true; @@ -146,6 +147,7 @@ namespace smx_config private FrameImage ExpectedDIP; private FrameworkElement NoResponseFromPanel; private FrameworkElement NoResponseFromSensors; + private FrameworkElement BadSensorDIPSwitches; private FrameworkElement P1Diagnostics, P2Diagnostics; private FrameworkElement DIPLabelLeft, DIPLabelRight; @@ -173,6 +175,7 @@ namespace smx_config ExpectedDIP = Template.FindName("ExpectedDIP", this) as FrameImage; NoResponseFromPanel = Template.FindName("NoResponseFromPanel", this) as FrameworkElement; NoResponseFromSensors = Template.FindName("NoResponseFromSensors", this) as FrameworkElement; + BadSensorDIPSwitches = Template.FindName("BadSensorDIPSwitches", this) as FrameworkElement; P1Diagnostics = Template.FindName("P1Diagnostics", this) as FrameworkElement; P2Diagnostics = Template.FindName("P2Diagnostics", this) as FrameworkElement; @@ -250,11 +253,16 @@ namespace smx_config ExpectedDIP.Frame = PanelIndex; // Show or hide the sensor error text. - bool AnySensorsNotResponding = false; + bool AnySensorsNotResponding = false, HaveIncorrectSensorDIP = false; if(args.controller[SelectedPad].test_data.bHaveDataFromPanel[PanelIndex]) + { AnySensorsNotResponding = args.controller[SelectedPad].test_data.AnySensorsOnPanelNotResponding(PanelIndex); - NoResponseFromSensors.Visibility = AnySensorsNotResponding? Visibility.Visible:Visibility.Collapsed; + // Don't show both warnings. + HaveIncorrectSensorDIP = !AnySensorsNotResponding && args.controller[SelectedPad].test_data.AnyBadDIPSwitchSettingsOnPanel(PanelIndex); + } + NoResponseFromSensors.Visibility = AnySensorsNotResponding? Visibility.Visible:Visibility.Collapsed; + BadSensorDIPSwitches.Visibility = HaveIncorrectSensorDIP? Visibility.Visible:Visibility.Collapsed; // Adjust the DIP labels to match the PCB. SMX.SMXConfig config = ActivePad.GetFirstActivePadConfig(args); bool DIPLabelsOnLeft = config.masterVersion < 4; diff --git a/smx-config/MainWindow.xaml b/smx-config/MainWindow.xaml index b5bb2ec..c05e4c2 100644 --- a/smx-config/MainWindow.xaml +++ b/smx-config/MainWindow.xaml @@ -591,6 +591,25 @@ Use if the platform is too sensitive. Text="Some sensors on this panel aren't responding correctly." /> + + + + + + +