openlcb / OpenLCB_Java

A git-managed copy of the SVN-based Java prototype implementation of OpenLCB. This implementation operates inside JMRI.
6 stars 9 forks source link

JMRI 5.15.1 and UWT-50 CDI issue #209

Open atanisoft opened 1 year ago

atanisoft commented 1 year ago

UWT-50 CDI is loaded successfully but the field data is not working as expected for Throttle Settings -> Change Buttons -> Button 2 -> Common. JMRI is marking that field as modified since it doesn't recognize the value for the field (0x0008) as valid.

Traffic monitor output for this specific field:

S: 02.01.12.26.0E.3B - 09.00.99.02.01.26 Datagram: (7) 20.41.0.0.0.86.2
R: 09.00.99.02.01.26 - 02.01.12.26.0E.3B DatagramReceivedOK with payload 80
R: 09.00.99.02.01.26 - 02.01.12.26.0E.3B Datagram: (8) 20.51.0.0.0.86.0.8
S: 02.01.12.26.0E.3B - 09.00.99.02.01.26 DatagramReceivedOK with no payload
bobjacobsen commented 1 year ago

I'd like to take a look at this. Could you download the CDI XML file with e.g. the Memory Tool in the latest JMRI version and then attach it here? Thanks.

balazsracz commented 1 year ago

We are aware of this issue, but it's not clear to us what the fix would be.

The CDI has a dropdown (combo box) with a certain discrete set of mapvalues. The standard functions F0 to F28 are not part of this list. This makes the dropdown menu unable to match the field's value (8) to anything in the list.

To make things funnier, we actually have two fields in the CDI pointing to the same memory location. We did this with a negative offset attribute. One field has the drop-down, the other is a pure integer. I don't think this is an essential part of the repro case though, but explains why values that are not found in the map are meaningful to the product.

balazsracz commented 1 year ago

relevant snippet of CDI:

<group replication='9'>
<name>Change Buttons</name>
<description>There are up to nine customizable buttons on the handheld:
- two buttons directly below the knob
- three on the left thumbswitch
- three on the right thumbswitch
- encoder push button (encoder model only)

These buttons are indexed below as follows:
1 dot - left thumbswitch press "in"
2 dot - left below the knob
3 dot - right below the knob
4 dot - right thumbswitch press "in"
5 left thumbswitch up
6 left thumbswitch down
7 right thumbswitch up
8 right thumbswitch down
9 encoder push button</description>
<repname>Button</repname><repname> Thumb In</repname><repname>
Button</repname><repname> Button</repname><repname>    Thumb In
</repname><repname> Thumb Up</repname><repname> Thumb
Dn</repname><repname>    Thumb Up </repname><repname>    Thumb Dn
</repname><repname> Encoder Button</repname>
<int size='2'>
<name>Common Functions</name>
<description>Use this option if you want the selected softkey to operate a
commonly used function with a name, such as Brake or Bell. If there is no
roster information with which to associate a function number to the
selected option, the throttle will automatically override your selection
with the next numerical button that is not already in use.</description>
<map><relation><property>65535</property><value>Automatic</value></relation><relation><property>246</property><value>Air
Compressor</value></relation><relation><property>229</property><value>Bell</value></relation><relation><property>230</property><value>Brake</value></relation><relation><property>231</property><value>Brake
Release</value></relation><relation><property>250</property><value>Coupler
Clank</value></relation><relation><property>251</property><value>Coupler
Open</value></relation><relation><property>243</property><value>Dynamic
Brake</value></relation><relation><property>235</property><value>Headlight</value></relation><relation><property>236</property><value>Horn</value></relation><relation><property>252</property><value>Manual
Notch
Down</value></relation><relation><property>253</property><value>Manual
Notch
Up</value></relation><relation><property>239</property><value>Momentum</value></relation><relation><property>254</property><value>Prime
Mover</value></relation><relation><property>241</property><value>Whistle</value></relation><relation><property>234</property><value>Direction</value></relation><relation><property>242</property><value>Yard
Mode</value></relation><relation><property>244</property><value>Flashlight</value></relation><relation><property>240</property><value>Recall</value></relation><relation><property>255</property><value>Stop</value></relation><relation><property>245</property><value>Unmapped</value></relation></map>
</int>
<group offset='-2'/>
<int size='2'>
<name>F0 - F28</name>
<description>Use this option if you want the selected softkey to always
operate the same numbered funtion every time, such as F0, F1, F2,
etc.</description>
<min>0</min>
<max>28</max>
</int>
</group>
balazsracz commented 1 year ago

CDI.txt full cdi

bobjacobsen commented 1 year ago

There are some DecoderPro decoder definitions that do similar things (if I'm understanding correctly). DP manages this by adding a "Reserved value NN" item to the JComboBox when an unexpected value NN is encountered. That's a transient addition, so doesn't show up if just the listed values are being used.

Would that be a suitable solution here?