Skip to content

Commit a556fc5

Browse files
authored
Merge pull request #69 from luxonis/release_0_4_0
Release 0.4.0
2 parents 8c49596 + 7cc0ed2 commit a556fc5

File tree

4 files changed

+84
-12
lines changed

4 files changed

+84
-12
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
runs-on: windows-latest
1919
strategy:
2020
matrix:
21-
python-version: [3.5, 3.6, 3.7, 3.8]
21+
python-version: [3.6, 3.7, 3.8, 3.9]
22+
python-architecture: [x64, x86]
2223
steps:
2324
- name: Cache .hunter folder
2425
uses: actions/cache@v2
@@ -32,9 +33,10 @@ jobs:
3233
uses: actions/setup-python@v2
3334
with:
3435
python-version: ${{ matrix.python-version }}
36+
architecture: ${{ matrix.python-architecture }}
3537
- name: Append build hash if not a tagged commit
3638
if: startsWith(github.ref, 'refs/tags/v') != true
37-
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
39+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
3840
- name: Install dependencies
3941
run: |
4042
python -m pip install --upgrade pip
@@ -51,7 +53,7 @@ jobs:
5153
runs-on: macos-latest
5254
strategy:
5355
matrix:
54-
python-version: [3.5, 3.6, 3.7, 3.8]
56+
python-version: [3.6, 3.7, 3.8, 3.9]
5557
steps:
5658
- name: Cache .hunter folder
5759
uses: actions/cache@v2
@@ -67,14 +69,14 @@ jobs:
6769
python-version: ${{ matrix.python-version }}
6870
- name: Append build hash if not a tagged commit
6971
if: startsWith(github.ref, 'refs/tags/v') != true
70-
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
72+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
7173
- name: Install dependencies
7274
run: |
7375
python -m pip install --upgrade pip
7476
brew install libusb
7577
python -m pip install delocate
7678
- name: Set macos deployment target
77-
run: echo '::set-env name=MACOSX_DEPLOYMENT_TARGET::10.9'
79+
run: echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
7880
- name: Building wheels
7981
run: python -m pip wheel . -w ./wheelhouse/
8082
- name: Auditing wheels
@@ -111,10 +113,10 @@ jobs:
111113
run: mkdir -p wheelhouse/audited/
112114
- name: Append build hash if not a tagged commit
113115
if: startsWith(github.ref, 'refs/tags/v') != true
114-
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
116+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
115117
- name: Building a source distribution
116118
run: |
117-
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar,zip
119+
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar
118120
mv dist/* wheelhouse/audited/
119121
- name: Building wheels
120122
run: for PYBIN in /opt/python/cp3*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/; done
@@ -141,7 +143,7 @@ jobs:
141143
submodules: 'recursive'
142144
- name: Append build hash if not a tagged commit
143145
if: startsWith(github.ref, 'refs/tags/v') != true
144-
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
146+
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
145147
- name: Building wheel
146148
run: python3 -m pip wheel . -w ./wheelhouse/
147149
- name: Auditing wheel

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,13 @@ target_link_libraries(${TARGET_NAME}
5353

5454
# Add bindings revision
5555
target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_BINDINGS_REVISION="${PROJECT_VERSION}")
56-
# Add commit hash, default to "dev"
57-
if(NOT DEPTHAI_PYTHON_COMMIT_HASH)
56+
57+
# Add default commit hash (dev) if not build by CI
58+
if(NOT DEFINED ENV{CI} AND NOT DEPTHAI_PYTHON_COMMIT_HASH)
5859
set(DEPTHAI_PYTHON_COMMIT_HASH dev)
5960
endif()
61+
62+
# Add compile definition for bindings
6063
if(DEPTHAI_PYTHON_COMMIT_HASH)
6164
target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_COMMIT_HASH="${DEPTHAI_PYTHON_COMMIT_HASH}")
6265
endif()

src/device_bindings.cpp

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,76 @@ void init_binding_device(pybind11::module& m){
124124
"Returns a vector defining how much the right camera is translated w.r.t left camera."
125125
)
126126

127+
.def(
128+
"is_usb3",
129+
&Device::is_usb3,
130+
"Return true if connected over usb3 or else false."
131+
)
132+
133+
.def(
134+
"get_mx_id",
135+
&Device::get_mx_id,
136+
"Return the Myraid X serial number of the device."
137+
)
138+
139+
.def(
140+
"is_eeprom_loaded",
141+
&Device::is_eeprom_loaded,
142+
"Return true if EEPROM has both intrinsic matrixes."
143+
)
127144

145+
.def(
146+
"is_device_changed",
147+
&Device::is_device_changed,
148+
"Return true if device is swapped while running over watchdog thread."
149+
)
150+
151+
.def(
152+
"reset_device_changed",
153+
&Device::reset_device_changed,
154+
"Sets device_changed var to false to detect the next swap while running over watchdog thread."
155+
)
156+
157+
.def(
158+
"is_rgb_connected",
159+
&Device::is_rgb_connected,
160+
"Returns true if RGB camera is connected."
161+
)
162+
163+
.def(
164+
"is_left_connected",
165+
&Device::is_left_connected,
166+
"Returns true if left stereo camera is connected."
167+
)
128168

129-
;
169+
.def(
170+
"is_right_connected",
171+
&Device::is_right_connected,
172+
"Returns true if right stereo camera is connected."
173+
)
174+
.def(
175+
"write_eeprom_data",
176+
[](Device& device, py::dict config)
177+
{
178+
// str(dict) for string representation uses ['] , but JSON requires ["]
179+
// fast & dirty solution:
180+
std::string str = py::str(config);
181+
boost::replace_all(str, "\'", "\"");
182+
boost::replace_all(str, "None", "null");
183+
boost::replace_all(str, "True", "true");
184+
boost::replace_all(str, "False", "false");
185+
// TODO: make better json serialization
186+
187+
return device.write_eeprom_data(str);
188+
},
189+
"Takes board config and calibration data as input and writes to eeprom",
190+
py::arg("config") = py::dict()
191+
)
192+
.def(
193+
"get_pipeline",
194+
&Device::get_pipeline,
195+
"Returns shared ptr of CNNHostPipeline created using cerate_pipeline."
196+
);
130197

131198

132199
py::enum_<CaptureMetadata::AutofocusMode>(m, "AutofocusMode")

0 commit comments

Comments
 (0)