JaneliaSciComp / G4_Display_Tools

Collection of tools for the G4 LED arena displays.
Creative Commons Attribution 4.0 International
2 stars 2 forks source link

Bug fixes and Unit test for Panel_com #60

Closed floesche closed 2 years ago

floesche commented 2 years ago

These commits fix some potential bugs in:

dec2char: there was an edge case problem, where function would accept dec2char(256, 1) and produce 255 (or less obvious dec2char(65536, 2) would produce 255 255), but dec2char(257, 1) would throw an error. Now all numbers out of range throw errors. Not that this was relevant in a practical sense, but now the number of characters is limited by the actual computation that MATLAB can do. Finally, the return values are cast to uint8 (as specified in the documentation before). Finally, I remove the duplicated source code. There is a unit test (dec2charTest.m) that now tests the function.

connectHost does not wait 15 seconds after starting G4 Host.exe, but instead waits until the application is running. This improves the overall startup speed on most machines.

I added a PanelComFunctionalTest.m Unit test, that runs through some of the commands. I had used this to generate some of the error reports. The results of two test runs are stored as csv files.

MATLAB>=2017 wouldn't allow the compilation of the pnet.c code via MEX. A small change (as suggested in https://www.mathworks.com/matlabcentral/fileexchange/345-tcp-udp-ip-toolbox-2-0-6?tab=reviews#reviews_1968183 enabled this, at least on my machine.

I had some small changes (logic tests, documentation) in my backlog and included here.

The change to dec2char might be too big for a Friday afternoon rollout and might need some more testing, although the documented interface had not changed. Other than that the changes should be pretty low-risk for a running system.