Hello all,
I'm writing my own protocol scripts (Decoder + Value to Text) and I would like to plot a string on the waveform. How can I do that?
My Value2Text function looks as follows:
function Value2Text(flag, value){
switch(flag) {
case 0:
return "X"; // Don't care, unknown or invalid
case 2:
return "b" + value.toString(2); // Binary value
case 10:
return value; // Decimal value
case 16:
return "0x" + value.toString(16).toUpperCase(); // Hex value
default:
return ??; // String
}
}
I'm missing how to manage the default case, where I would like to pass a string. An example in the decoder:
rgValue[sample] = "Read";
rgFlag[sample] = 5;
Thanks
S