microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
35 stars 26 forks source link

Cockpit/red Pitaya drops digital lines above 8 in experiments. #709

Closed iandobbie closed 1 year ago

iandobbie commented 3 years ago

Discovered in issue #708 but the root cause is either cockpit or red pitaya dropping digital lines above 8 but only in experiments. Here is the first few lines of action table in cockpit.... experiment.lastExperiment.table 0.00 2 zPiezo 60.32477613223105 0.00 488 True 0.00 East-Green True 0.10 East-Green False 100.00 488 False 100.00 2 zPiezo 60.32477613223105 100.05 2 zPiezo 61.82477613223105

And from the redpitaya. line 4 is the laser, -1 is the analogue z stage, camera should be 9.

0 4 1 0 -1 2246.0 100000000 4 0 100050000 -1 2301.8477

The camera trigger just inst there. I wonder is somethig is assuming 8 digital lines as the camera is pin 9, whereas the laser is pin 4.

iandobbie commented 3 years ago

Red Pitaya code has....

    digital_diff = digital_state ^ wanted_digital_state
    for line in range(8):
        if (digital_diff >> line) & 0b1:
            action = (wanted_digital_state >> line) & 0b1
            runner_table.append((current_t, line, action))
    digital_state = wanted_digital_state

I think this is the fault.

iandobbie commented 3 years ago

Replacing 8 with 16 in the range function above fixes the issue,

iandobbie commented 3 years ago

Don't know where we should leave this fix but it is required as the issue is very strange. Especially as Chris has labelled the output on the Red Pitaya very strangely.

iandobbie commented 1 year ago

This is completely an issue with the red pitaya code and should be fixed there but is definitely not a cockpit issue so closing this here