Add the PlatformFlags_FSR config flag.
This commit is contained in:
parent
681c7adfef
commit
6d0820f495
@ -141,6 +141,9 @@ enum SMXConfigFlags {
|
||||
// is ignored. If unset, panels will be lit solid using stepColor.
|
||||
// masterVersion >= 4. Previous versions always use stepColor.
|
||||
PlatformFlags_AutoLightingUsePressedAnimations = 1 << 0,
|
||||
|
||||
// If set, panels are using FSRs, otherwise load cells.
|
||||
PlatformFlags_FSR = 1 << 1,
|
||||
};
|
||||
|
||||
// The configuration for a connected controller. This can be retrieved with SMX_GetConfig
|
||||
@ -281,8 +284,7 @@ struct SMXSensorTestModeData
|
||||
int16_t sensorLevel[9][4];
|
||||
bool bBadSensorInput[9][4];
|
||||
|
||||
// The DIP switch settings on each panel. This is used for diagnostics
|
||||
// displays.
|
||||
// The DIP switch settings on each panel. This is used for diagnostics displays.
|
||||
int iDIPSwitchPerPanel[9];
|
||||
};
|
||||
|
||||
|
@ -298,7 +298,7 @@ namespace smx_config
|
||||
value = 0;
|
||||
|
||||
// Scale differently depending on if this is an FSR panel or a load cell panel.
|
||||
bool isFSR = controllerData.config.masterVersion >= 4 && controllerData.test_data.bFSRPerPanel[PanelIndex*4+sensor];
|
||||
bool isFSR = controllerData.config.masterVersion >= 4 && (controllerData.config.configFlags & SMX.SMXConfigFlags.PlatformFlags_FSR) != 0;
|
||||
float maxValue = isFSR? 1023:500;
|
||||
LevelBars[sensor].Value = value / maxValue;
|
||||
LevelBarText[sensor].Content = value;
|
||||
|
@ -49,7 +49,7 @@ namespace smx_config
|
||||
// If AutoLightingUsePressedAnimations isn't set, the panel is using step
|
||||
// coloring instead of pressed animations. All firmwares support this.
|
||||
// Don't confirm exiting for this mode.
|
||||
if((config.configFlags & SMX.SMXConfigFlags.SMXConfigFlags_AutoLightingUsePressedAnimations) == 0)
|
||||
if((config.configFlags & SMX.SMXConfigFlags.AutoLightingUsePressedAnimations) == 0)
|
||||
continue;
|
||||
|
||||
shouldConfirmExit = true;
|
||||
@ -139,9 +139,9 @@ namespace smx_config
|
||||
// If we're in panel colors mode, clear the AutoLightingUsePressedAnimations flag.
|
||||
// Otherwise, set it.
|
||||
if(pressedPanelColors)
|
||||
config.configFlags &= ~SMX.SMXConfigFlags.SMXConfigFlags_AutoLightingUsePressedAnimations;
|
||||
config.configFlags &= ~SMX.SMXConfigFlags.AutoLightingUsePressedAnimations;
|
||||
else
|
||||
config.configFlags |= SMX.SMXConfigFlags.SMXConfigFlags_AutoLightingUsePressedAnimations;
|
||||
config.configFlags |= SMX.SMXConfigFlags.AutoLightingUsePressedAnimations;
|
||||
SMX.SMX.SetConfig(activePad.Item1, config);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ namespace smx_config
|
||||
// If SMXConfigFlags_AutoLightingUsePressedAnimations is set, show the GIF UI.
|
||||
// If it's not set, show the color slider UI.
|
||||
SMX.SMXConfigFlags flags = config.configFlags;
|
||||
bool usePressedAnimations = (flags & SMX.SMXConfigFlags.SMXConfigFlags_AutoLightingUsePressedAnimations) != 0;
|
||||
bool usePressedAnimations = (flags & SMX.SMXConfigFlags.AutoLightingUsePressedAnimations) != 0;
|
||||
ColorPickerGroup.Visibility = usePressedAnimations? Visibility.Collapsed:Visibility.Visible;
|
||||
GIFGroup.Visibility = usePressedAnimations? Visibility.Visible:Visibility.Collapsed;
|
||||
|
||||
|
@ -23,7 +23,8 @@ namespace SMX
|
||||
|
||||
// Bits for SMXConfig::flags.
|
||||
public enum SMXConfigFlags {
|
||||
SMXConfigFlags_AutoLightingUsePressedAnimations = 1 << 0,
|
||||
AutoLightingUsePressedAnimations = 1 << 0,
|
||||
PlatformFlags_FSR = 1 << 1,
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||
@ -85,6 +86,12 @@ namespace SMX
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if the platform is using FSRs, or false for load cells.
|
||||
public bool fsr()
|
||||
{
|
||||
return masterVersion >= 4 && (configFlags & SMXConfigFlags.PlatformFlags_FSR) != 0;
|
||||
}
|
||||
|
||||
// Thresholds when in FSR mode. Note that these are 16-bit thresholds, compared
|
||||
// to the 8-bit load cell thresholds.
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
|
||||
|
@ -141,7 +141,7 @@ namespace smx_config
|
||||
|
||||
private void SetValueToConfig(ref SMX.SMXConfig config)
|
||||
{
|
||||
if(config.masterVersion < 4)
|
||||
if(!config.fsr())
|
||||
{
|
||||
byte lower = (byte) slider.LowerValue;
|
||||
byte upper = (byte) slider.UpperValue;
|
||||
@ -187,7 +187,7 @@ namespace smx_config
|
||||
|
||||
private void GetValueFromConfig(SMX.SMXConfig config, out int lower, out int upper)
|
||||
{
|
||||
if(config.masterVersion < 4)
|
||||
if(!config.fsr())
|
||||
{
|
||||
switch(Type)
|
||||
{
|
||||
@ -251,15 +251,15 @@ namespace smx_config
|
||||
UpdatingUI = true;
|
||||
|
||||
// Set the range for the slider.
|
||||
if(config.masterVersion < 4)
|
||||
if(config.fsr())
|
||||
{
|
||||
// 8-bit load cell thresholds
|
||||
slider.Minimum = 20;
|
||||
slider.Maximum = 200;
|
||||
} else {
|
||||
// 16-bit FSR thresholds
|
||||
slider.Minimum = 5;
|
||||
slider.Maximum = 1023;
|
||||
} else {
|
||||
// 8-bit load cell thresholds
|
||||
slider.Minimum = 20;
|
||||
slider.Maximum = 200;
|
||||
}
|
||||
|
||||
int lower, upper;
|
||||
|
Loading…
x
Reference in New Issue
Block a user