Hi Aaron,
I've attached an example grid below, modified from your provided grid. This example grid has been simplified, but the changes here can be adapted to fit your controller parameters and device context.
One way to accomplish what you're looking for is to attach your existing task to the controller button parameter, and trigger this task onchange and onload:
In the attached panel, I've inserted the param 'params.joy.button.0.mappings.0.value' (Button 1 from your joystick). The task used to change the colours of 'ButtonA' was attached to this parameter. Here, it's given a tasktype of onchange and onload:
<param expand="true" height="100" id="params.joy.button.0.mappings.0.value" left="40" name="params.joy.button.0.mappings.0.value" oid="params.joy.button.0.mappings.0.value" showlabel="false" top="240" widget="text-display" width="240">
<task tasktype="onchange,onload">
...
</task>
With this attached task, whenever the value of the parameter changes (e.g. on a button press), the task is triggered, and changes the colour of the button elements accordingly.
In the example panel, an additional button ('Toggle Controller Button Value') is used to emulate this parameter value change, but in your case you should be able to change the parameter value by pressing the button on the controller.
Then, you can do the same with 'params.joy.button.0.mappings.0.value', attaching its own task to be triggered onchange to change the colour of 'ButtonB'.
Hopefully this helps, please let me know if you have any further questions!
Example Grid:
<abs contexttype="opengear" gpiport="7799" gridsize="20" id="_top" keepalive="true">
<meta>
<params>
<param access="1" constrainttype="INT_CHOICE" name="params.joy.button.0.mappings.0.value" oid="params.joy.button.0.mappings.0.value" precision="0" type="INT16" value="1" widget="toggle">
<constraint key="0">Controller Button 1 Not Pressed</constraint>
<constraint key="1">Controller Button 1 Pressed</constraint>
</param>
</params>
</meta>
<abs height="250" id="ButtonA" left="450" name="Button A" top="520" width="440">
<label height="250" id="BUTTON A" left="0" name="BUTTON A" style="txt-align:center;size:Biggest;" top="0" width="440"/>
</abs>
<param expand="true" height="100" id="params.joy.button.0.mappings.0.value" left="40" name="params.joy.button.0.mappings.0.value" oid="params.joy.button.0.mappings.0.value" showlabel="false" top="240" widget="text-display" width="240">
<task tasktype="onchange,onload">
/*! block id=1134,1133,1135,1136 !*/
switch (params.getValue('params.joy.button.0.mappings.0.value', 0))
{
case 0:
ogscript.setStyle("ButtonA", "bg#green;");
break;
case 1:
ogscript.setStyle("ButtonA", "bg#red;");
break;
}
/*!!
<block id="1134" type="switch" x="358" y="216" w="268" VALUE="ID:1133" STATEMENT="ID:1135" statementtag_STATEMENT="0" STATEMENT_0="ID:1136" statementtag_STATEMENT_0="1" STATEMENT_1="" />
<block id="1133" type="param_getvalue" x="10" y="216" w="318" PARAM="[root, Params for Controller%20Button%20Example%202.grid, Not In Menu, params.joy.button.0.mappings.0.value (params.joy.button.0.mappings.0.value)]" PARAM_DATA="_top&amp;params.joy.button.0.mappings.0.value[0]" />
<block id="1135" type="ogscript_setstyle" x="656" y="306" w="243" ID="ButtonA" STYLE="bg#green;" />
<block id="1136" type="ogscript_setstyle" x="929" y="266" w="243" ID="ButtonA" STYLE="bg#red;" />
!!*/
/*!!<checksum>90fe5fa10ceb42dfbe99e3725b14a948</checksum>!!*/</task>
</param>
<button buttontype="toggle" height="100" left="40" name="Toggle Controller Button Value" top="360" width="240">
<task tasktype="ogscript">
/*! block id=1144,1149,1145,1149,1146,1149 !*/
if (params.getValue('params.joy.button.0.mappings.0.value', 0) == 0)
{
params.setValue('params.joy.button.0.mappings.0.value', 0, 1)
} else {
params.setValue('params.joy.button.0.mappings.0.value', 0, 0)
}
/*!!
<block id="1144" type="if" x="291" y="84" w="268" INPUT1="ID:1149" OPERATION="equals" INPUT2="0" TRUE="ID:1145" FALSE="ID:1146" IGNORE="" />
<block id="1149" type="param__top&amp;params.joy.button.0.mappings.0.value (params.joy.button.0.mappings.0.value)[0]" x="13" y="62" w="243" SET="" />
<block id="1145" type="param_setvalue" x="647" y="157" w="318" PARAM="ID:1149" VALUE="1" />
<block id="1149" type="param__top&amp;params.joy.button.0.mappings.0.value (params.joy.button.0.mappings.0.value)[0]" x="13" y="62" w="243" SET="" />
<block id="1146" type="param_setvalue" x="726" y="315" w="318" PARAM="ID:1149" VALUE="0" />
<block id="1149" type="param__top&amp;params.joy.button.0.mappings.0.value (params.joy.button.0.mappings.0.value)[0]" x="13" y="62" w="243" SET="" />
!!*/
/*!!<checksum>477cf072634e432b17e92b4b290a35aa</checksum>!!*/</task>
</button>
</abs>
------------------------------
Michael Quach
------------------------------