pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

Tweaks for handling the DESC field #204

Closed klauer closed 4 years ago

klauer commented 4 years ago

Automatic "middle" truncation of DESC field has been in place for the default description, as follows:

GVL_GMD.fb_EM1K0_GMD_PRT_40.stPump.i_xAlarmOK would become a description of ads:GVL_GMD.fb_EM1K0...stPump.i_xAlarmOK to fit within the 40 character field limit. This PR removes the ads: prefix, which further shortens the displayable characters.

The above was not generically applied to user-specified descriptions. This caused many instances of db parsing failures on IOC boot.

Rather than do as suggested in #196 making this either a warning/error, the DESC field itself is truncated silently, but also included in full-form as a comment in the database file.

Before

record(bi, "EM1K0:GMD:PRT:40:ALARM_OK_RBV") {
  field(DESC, "ads:GVL_GMD.fb_EM1K0...stPump.i_xAlarmOK")
  ...
}

After

record(bi, "EM1K0:GMD:PRT:40:ALARM_OK_RBV") {
  # GVL_GMD.fb_EM1K0_GMD_PRT_40.stPump.i_xAlarmOK
  field(DESC, "GVL_GMD.fb_EM1K0_GMD...stPump.i_xAlarmOK")
  ...
}

Closes #196

klauer commented 4 years ago

cc @slacAWallace

ZLLentz commented 4 years ago

First impression is that this is a good solution for the "I accidentally make my DESC field way too long" problem. I'll review the code during this FEE tailgate.

klauer commented 4 years ago

Thanks, @ZLLentz. Package lint is failing while tests are passing; will merge regardless.