brunoseivam / retools

EPICS Regular Expression tools for IOCs
MIT License
2 stars 1 forks source link

rePutField #2

Closed nariox closed 2 years ago

nariox commented 2 years ago

This PR adds the ability to set fields with retools. My original goal was to be able to set all PVs under a particular pattern to a value (e.g., set the current of all channels of this power supply to 1mA with rePutField .*CurrentSet VAL 0.001), but with the power of REGEXes, you can write a DESC field or the EGU field quickly.

It can also be handy when setting st.cmd files, as you can write to the local "PowerOn" PV for each device without having to modify each st.cmd (e.g., rePutField .*PowerOn VAL 1)

Sorry, the commits are a bit messy. If you want, I can create a new branch and squash them before sending a PR.

brunoseivam commented 2 years ago

Hi @nariox , thanks for the contribution, this looks great! I just added minor comments. Don't worry about squashing / rebasing.

nariox commented 2 years ago

Hi @brunoseivam , I couldn't see the comments. Thanks for replying so soon, I imagine you are not doing much EPICS stuff anymore, so I appreciate the speed with which you replied.

brunoseivam commented 2 years ago

You can see them in the Github page for the PR: https://github.com/brunoseivam/retools/pull/2, inline with the code

nariox commented 2 years ago

Somehow I still can't see the comments :( But I'm okay with any changes as long as the functionality is kept. By the way, I caught a straggler comment from when I copied test_reAddInfo and changed it to test_rePutField.

nariox commented 2 years ago

Great, thank you for the comments.

I have just realized that the function right now only sets the PV values, but doesn't process them. I might have to dbPutString to dbPutField. I have some other stuff I need to attend to right now, so I'll pause this PR for now, but I will get back to it when I can.

nariox commented 2 years ago

Thanks Bruno, The reason I had delayed the fixes was that I realized that dbPutString didn't process the record, so, for example, I could change the SCAN field, but it would not change the behavior until I sent a dbpf XXXX.PROC 1. Using dbPutField required a bit more work, but I hope the code still makes sense.

I had to add a new check to see if the PV actually possessed said field before trying to dbPutField. Other than that, not much changed. (I am sure glad I didn't have to concatenate those strings in pure C).