Add config fields for FSR sensitivity and the platform strip color.

This also sets pack:1 so we don't rely on compiler struct alignment.
master
Glenn Maynard 6 years ago
parent 776baf1aca
commit 1c980f24e0
  1. 14
      sdk/SMX.h
  2. 14
      smx-config/SMX.cs

@ -148,6 +148,7 @@ enum SMXConfigFlags {
// //
// The order and packing of this struct corresponds to the configuration packet sent to // The order and packing of this struct corresponds to the configuration packet sent to
// the master controller, so it must not be changed. // the master controller, so it must not be changed.
#pragma pack(push, 1)
struct SMXConfig struct SMXConfig
{ {
// These fields are unused and must be left at their existing values. // These fields are unused and must be left at their existing values.
@ -238,12 +239,21 @@ struct SMXConfig
// Packed flags (masterVersion >= 4). // Packed flags (masterVersion >= 4).
uint8_t flags = 0; uint8_t flags = 0;
// Thresholds when in FSR mode. Note that these are 16-bit thresholds, compared
// to the 8-bit load cell thresholds.
uint16_t individualPanelFSRLow[9];
uint16_t individualPanelFSRHigh[9];
// The default color to set the platform LED strip to.
uint8_t platformStripColor[3];
// Pad the struct to 250 bytes. This keeps this struct size from changing // Pad the struct to 250 bytes. This keeps this struct size from changing
// as we add fields, so the ABI doesn't change. Applications should leave // as we add fields, so the ABI doesn't change. Applications should leave
// any data in here unchanged when calling SMX_SetConfig. // any data in here unchanged when calling SMX_SetConfig.
uint8_t padding[163]; uint8_t padding[124];
}; };
static_assert(offsetof(SMXConfig, padding) == 87, "Expected 87 bytes"); // includes one padding byte #pragma pack(pop)
static_assert(offsetof(SMXConfig, padding) == 126, "Incorrect padding alignment");
static_assert(sizeof(SMXConfig) == 250, "Expected 250 bytes"); static_assert(sizeof(SMXConfig) == 250, "Expected 250 bytes");
// The values (except for Off) correspond with the protocol and must not be changed. // The values (except for Off) correspond with the protocol and must not be changed.

@ -85,9 +85,19 @@ namespace SMX
} }
} }
// Pad this struct to exactly 250 bytes. // Thresholds when in FSR mode. Note that these are 16-bit thresholds, compared
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 166)] // to the 8-bit load cell thresholds.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
UInt16[] individualPanelFSRLow;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
UInt16[] individualPanelFSRHigh;
// The default color to set the platform LED strip to.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
Byte[] platformStripColor;
// Pad this struct to exactly 250 bytes.
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 124)]
public Byte[] padding; public Byte[] padding;
// enabledSensors is a mask of which panels are enabled. Return this as an array // enabledSensors is a mask of which panels are enabled. Return this as an array

Loading…
Cancel
Save