diff --git a/sdk/SMX.h b/sdk/SMX.h index 433d42d..d5d6437 100644 --- a/sdk/SMX.h +++ b/sdk/SMX.h @@ -148,6 +148,7 @@ enum SMXConfigFlags { // // The order and packing of this struct corresponds to the configuration packet sent to // the master controller, so it must not be changed. +#pragma pack(push, 1) struct SMXConfig { // These fields are unused and must be left at their existing values. @@ -238,12 +239,21 @@ struct SMXConfig // Packed flags (masterVersion >= 4). 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 // as we add fields, so the ABI doesn't change. Applications should leave // 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"); // The values (except for Off) correspond with the protocol and must not be changed. diff --git a/smx-config/SMX.cs b/smx-config/SMX.cs index c2bbecd..7157b2a 100644 --- a/smx-config/SMX.cs +++ b/smx-config/SMX.cs @@ -85,9 +85,19 @@ namespace SMX } } - // Pad this struct to exactly 250 bytes. - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 166)] + // 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)] + 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; // enabledSensors is a mask of which panels are enabled. Return this as an array