Skip to content

Commit

Permalink
Add commands to request a specific resolution when connecting to a DA…
Browse files Browse the repository at this point in the history
…Q. Add initial MiniLFM support.

These changes need to be used along with the newest versions of the Miniscope DAQ firmware which now support a range of devices with a single firmware build.
  • Loading branch information
daharoni committed Jul 17, 2020
1 parent 8dd8802 commit a98dbb0
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 0 deletions.
167 changes: 167 additions & 0 deletions deviceConfigs/miniscopes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1035,5 +1035,172 @@
}

]
},
"MiniLFM": {
"qmlFile": "qrc:/Miniscope_V4_BNO.qml",
"sensor": "MT9P031",
"frameRate": "adjustable",
"width": 2592,
"height": 1944,
"headOrientation": false,
"isColor": false,
"controlSettings": {
"gain": {
"displaySpinBoxValues":["Low", "Medium", "High"],
"displayTextValues": [1, 4, 8],
"outputValues":[8,32,96],
"startValue": "Low",
"sendCommand": [
{
"protocol": "I2C",
"addressW": "0xBA",
"regLength": "1",
"reg0": "0x35",
"dataLength": "2",
"data0": "valueH",
"data1": "valueL"
}
]
},
"frameRate": {
"displaySpinBoxValues":["10FPS", "15FPS", "20FPS"],
"displayTextValues": [10, 15, 20],
"outputValues":[2048,1536,1024],
"startValue": "20FPS",
"sendCommand": [
{
"protocol": "I2C",
"addressW": "0xBA",
"regLength": "1",
"reg0": "0x09",
"dataLength": "2",
"data0": "valueH",
"data1": "valueL"
}
]
},
"led0": {
"startValue": 0,
"min": 0,
"max": 100,
"stepSize": 1,
"displayValueScale": -2.55,
"displayValueOffset": -255,
"sendCommand": [
{
"protocol": "I2C",
"addressW": "0b01011000",
"regLength": "1",
"reg0": "0x00",
"dataLength": "2",
"data0": "value",
"data1": "value"
}
]
},
"ewl": {
"startValue": 0,
"min": -127,
"max": 127,
"stepSize": 1,
"displayValueScale": 1,
"displayValueOffset": -127,
"sendCommand": [
{
"protocol": "I2C",
"addressW": "0b11101110",
"regLength": "1",
"reg0": "0x08",
"dataLength": "2",
"data0": "value",
"data1": "0x02"
}
]
}
},
"initialize": [
{
"description": "Speed up i2c bus timer to 50us max",
"protocol": "I2C",
"addressW": "0xC0",
"regLength": "1",
"reg0": "0x22",
"dataLength": "1",
"data0": "0b00000010"
},
{
"description": "Decrease BCC timeout, units in 2ms XX",
"protocol": "I2C",
"addressW": "0xC0",
"regLength": "1",
"reg0": "0x20",
"dataLength": "1",
"data0": "0b00001010"
},
{
"description": "Make sure DES has SER ADDR",
"protocol": "I2C",
"addressW": "0xC0",
"regLength": "1",
"reg0": "0x07",
"dataLength": "1",
"data0": "0xB0"
},
{
"description": "Speed up I2c bus timer to 50u Max",
"protocol": "I2C",
"addressW": "0xB0",
"regLength": "1",
"reg0": "0x0F",
"dataLength": "1",
"data0": "0b00000010"
},
{
"description": "Decrease BCC timeout, units in 2ms",
"protocol": "I2C",
"addressW": "0xB0",
"regLength": "1",
"reg0": "0x1E",
"dataLength": "1",
"data0": "0b00001010"
},
{
"description": "sets allowable i2c addresses to send through serializer",
"protocol": "I2C",
"addressW": "0xC0",
"regLength": "1",
"reg0": "0x08",
"dataLength": "3",
"device0": "MT9P031",
"data0": "0xBA",
"device1": "EWL Driver",
"data1": "0b11101110",
"device2": "Digital Pot",
"data2": "0b10100000"
},
{
"description": "sets sudo allowable i2c addresses to send through serializer",
"protocol": "I2C",
"addressW": "0xC0",
"regLength": "1",
"reg0": "0x10",
"dataLength": "3",
"device0": "MT9P031",
"data0": "0xBA",
"device1": "EWL Driver",
"data1": "0b11101110",
"device2": "Digital Pot Sudo",
"data2": "0b01011000"
},
{
"description": "Enable EWL Driver",
"protocol": "I2C",
"addressW": "0b11101110",
"regLength": "1",
"reg0": "0x03",
"dataLength": "1",
"data0": "0x03"
}
]
}
}
4 changes: 4 additions & 0 deletions source/videostreamocv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ int VideoStreamOCV::connect2Camera(int cameraID) {
m_connectionType = "OTHER";
}
}
if (connectionState != 0) {
cam->set(cv::CAP_PROP_FRAME_WIDTH, m_expectedWidth);
cam->set(cv::CAP_PROP_FRAME_HEIGHT, m_expectedHeight);
}
// qDebug() << "Camera capture backend is" << QString::fromStdString (cam->getBackendName());
return connectionState;

Expand Down
54 changes: 54 additions & 0 deletions userConfigs/UserConfigExample_MiniLFM.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"researcherName": "Dr_Miniscope",
"dataDirectory": "C:/Users/DBAharoni/Documents/Data",
"reserved terms for directoryStructure": ["time", "date"],
"directoryStructure": [
"researcherName",
"experimentName",
"animalID",
"date",
"time"
],
"animalName": "testMouse",
"animalID": "ID42",
"experimentName": "Linear Track Test",
"test": "TEST",
"recordLengthinSeconds": 0,
"experiment_Not_Implemented": {
"type": "linearTrack",
"units": "cm",
"trackLength": 200
},
"behaviorTracker_Not_Implemented": {
"type": "HSV",
"hue": [0, 1],
"saturation": [0, 1],
"value": [0, 1]
},
"devices": {
"miniscopes": [
{
"deviceName": "Miniscope",
"deviceType": "MiniLFM",
"imageRegistration": "Off",
"headOrientation": {
"enable": false,
"filterBadData": true
},
"streamHeadOrientation_OLD": false,
"deviceID": 1,
"showSaturation": true,
"compressionOptions": ["MJPG","MJ2C","XVID","FFV1"],
"compression": "FFV1",
"framesPerFile": 1000,
"windowScale": 0.75,
"windowX": 800,
"windowY": 100,
"gain": "Low",
"ewl": 50,
"led0": 10,
"frameRate": "10FPS"
}
]
}
}

0 comments on commit a98dbb0

Please sign in to comment.