tm_get_comms_tm_info.lua 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. --tm id - 398
  2. function tm_get_comms_tm_info(buffer, pinfo, tree, comms_tm_prop, offset)
  3. -- Define ProtoFields for the structure
  4. local f_temp_psu = ProtoField.int16("comms_tm_prop.temp_psu", "Temperature PSU", base.DEC)
  5. local f_temp_mcu = ProtoField.int16("comms_tm_prop.temp_mcu", "Temperature MCU", base.DEC)
  6. local f_temp_fpga = ProtoField.int16("comms_tm_prop.temp_fpga", "Temperature FPGA", base.DEC)
  7. local f_temp_xcvr = ProtoField.int16("comms_tm_prop.temp_xcvr", "Temperature Transceiver", base.DEC)
  8. local f_temp_lna = ProtoField.int16("comms_tm_prop.temp_lna", "Temperature LNA", base.DEC)
  9. local f_temp_pa = ProtoField.int16("comms_tm_prop.temp_pa", "Temperature PA", base.DEC)
  10. local f_volt_vin = ProtoField.uint16("comms_tm_prop.volt_vin", "Voltage Input (Vin)", base.DEC)
  11. local f_volt_3v3 = ProtoField.uint16("comms_tm_prop.volt_3v3", "Voltage 3.3V Rail", base.DEC)
  12. local f_volt_1v8 = ProtoField.uint16("comms_tm_prop.volt_1v8", "Voltage 1.8V Rail", base.DEC)
  13. local f_volt_1v0 = ProtoField.uint16("comms_tm_prop.volt_1v0", "Voltage 1.0V Rail", base.DEC)
  14. local f_volt_pa = ProtoField.uint16("comms_tm_prop.volt_pa", "Voltage PA", base.DEC)
  15. local f_cur_vin = ProtoField.int16("comms_tm_prop.cur_vin", "Current Input (Vin)", base.DEC)
  16. local f_cur_3v3 = ProtoField.int16("comms_tm_prop.cur_3v3", "Current 3.3V Rail", base.DEC)
  17. local f_cur_1v8 = ProtoField.int16("comms_tm_prop.cur_1v8", "Current 1.8V Rail", base.DEC)
  18. local f_cur_1v0 = ProtoField.int16("comms_tm_prop.cur_1v0", "Current 1.0V Rail", base.DEC)
  19. local f_cur_pa = ProtoField.int16("comms_tm_prop.cur_pa", "Current PA", base.DEC)
  20. local f_power_vin = ProtoField.uint16("comms_tm_prop.power_vin", "Power Input (Vin)", base.DEC)
  21. local f_power_3v3 = ProtoField.uint16("comms_tm_prop.power_3v3", "Power 3.3V Rail", base.DEC)
  22. local f_power_1v8 = ProtoField.uint16("comms_tm_prop.power_1v8", "Power 1.8V Rail", base.DEC)
  23. local f_power_1v0 = ProtoField.uint16("comms_tm_prop.power_1v0", "Power 1.0V Rail", base.DEC)
  24. local f_power_pa = ProtoField.uint16("comms_tm_prop.power_pa", "Power PA", base.DEC)
  25. local f_rsvd = ProtoField.uint16("comms_tm_prop.rsvd", "Reserved", base.DEC)
  26. -- Add fields to the protocol
  27. comms_tm_prop.fields = {
  28. f_temp_psu, f_temp_mcu, f_temp_fpga, f_temp_xcvr, f_temp_lna, f_temp_pa,
  29. f_volt_vin, f_volt_3v3, f_volt_1v8, f_volt_1v0, f_volt_pa,
  30. f_cur_vin, f_cur_3v3, f_cur_1v8, f_cur_1v0, f_cur_pa,
  31. f_power_vin, f_power_3v3, f_power_1v8, f_power_1v0, f_power_pa,
  32. f_rsvd
  33. }
  34. -- Add a subtree for the structure
  35. local subtree = tree:add(comms_tm_prop, buffer(), "TM GET COMMS TM INFO")
  36. -- Dissect each field
  37. subtree:add_le(f_temp_psu, buffer(offset, 2)):set_text(string.format("Temperature PSU: %d °C", buffer(offset, 2):le_int()))
  38. offset = offset + 2
  39. subtree:add_le(f_temp_mcu, buffer(offset, 2)):set_text(string.format("Temperature MCU: %d °C", buffer(offset, 2):le_int()))
  40. offset = offset + 2
  41. subtree:add_le(f_temp_fpga, buffer(offset, 2)):set_text(string.format("Temperature FPGA: %d °C", buffer(offset, 2):le_int()))
  42. offset = offset + 2
  43. subtree:add_le(f_temp_xcvr, buffer(offset, 2)):set_text(string.format("Temperature Transceiver: %d °C", buffer(offset, 2):le_int()))
  44. offset = offset + 2
  45. subtree:add_le(f_temp_lna, buffer(offset, 2)):set_text(string.format("Temperature LNA: %d °C", buffer(offset, 2):le_int()))
  46. offset = offset + 2
  47. subtree:add_le(f_temp_pa, buffer(offset, 2)):set_text(string.format("Temperature PA: %d °C", buffer(offset, 2):le_int()))
  48. offset = offset + 2
  49. subtree:add_le(f_volt_vin, buffer(offset, 2)):set_text(string.format("Voltage Vint: %.6f V", buffer(offset, 2):le_uint() / 100))
  50. offset = offset + 2
  51. subtree:add_le(f_volt_3v3, buffer(offset, 2)):set_text(string.format("Voltage vaux: %.6f V", buffer(offset, 2):le_uint() / 100))
  52. offset = offset + 2
  53. subtree:add_le(f_volt_1v8, buffer(offset, 2)):set_text(string.format("Voltage vbram: %.6f V", buffer(offset, 2):le_uint() / 100))
  54. offset = offset + 2
  55. subtree:add_le(f_volt_1v0, buffer(offset, 2)):set_text(string.format("Voltage vpint: %.6f V", buffer(offset, 2):le_uint() / 100))
  56. offset = offset + 2
  57. subtree:add_le(f_volt_pa, buffer(offset, 2)):set_text(string.format("Voltage vpaux: %.6f V", buffer(offset, 2):le_uint() / 100))
  58. offset = offset + 2
  59. subtree:add_le(f_cur_vin, buffer(offset, 2)):set_text(string.format("Current Vin: %.6f A", buffer(offset, 2):le_int() / 100))
  60. offset = offset + 2
  61. subtree:add_le(f_cur_3v3, buffer(offset, 2)):set_text(string.format("Current 3.3V: %.6f A", buffer(offset, 2):le_int() / 100))
  62. offset = offset + 2
  63. subtree:add_le(f_cur_1v8, buffer(offset, 2)):set_text(string.format("Current 1.8V: %.6f A", buffer(offset, 2):le_int() / 100))
  64. offset = offset + 2
  65. subtree:add_le(f_cur_1v0, buffer(offset, 2)):set_text(string.format("Current 1.0V: %.6f A", buffer(offset, 2):le_int() / 100))
  66. offset = offset + 2
  67. subtree:add_le(f_cur_pa, buffer(offset, 2)):set_text(string.format("Current PA: %.6f A", buffer(offset, 2):le_int() / 100))
  68. offset = offset + 2
  69. subtree:add_le(f_power_vin, buffer(offset, 2)):set_text(string.format("Power Vin: %.6f W", buffer(offset, 2):le_uint() / 100))
  70. offset = offset + 2
  71. subtree:add_le(f_power_3v3, buffer(offset, 2)):set_text(string.format("Power 3.3V: %.6f W", buffer(offset, 2):le_uint() / 100))
  72. offset = offset + 2
  73. subtree:add_le(f_power_1v8, buffer(offset, 2)):set_text(string.format("Power 1.8V: %.6f W", buffer(offset, 2):le_uint() / 100))
  74. offset = offset + 2
  75. subtree:add_le(f_power_1v0, buffer(offset, 2)):set_text(string.format("Power 1.0V: %.6f W", buffer(offset, 2):le_uint() / 100))
  76. offset = offset + 2
  77. subtree:add_le(f_power_pa, buffer(offset, 2)):set_text(string.format("Power PA: %.6f W", buffer(offset, 2):le_uint() / 100))
  78. offset = offset + 2
  79. subtree:add_le(f_rsvd, buffer(offset, 2)):set_text(string.format("Reserved : %.6f", buffer(offset, 2):le_uint() / 100) )
  80. offset = offset + 2
  81. end