From 033e632e3bba6a69dd68897ccff48824f91ec9f4 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Feb 2025 19:14:59 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=BD=91=E5=8D=A1=E4=B8=8A=E7=94=B5?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E7=AD=89=E5=BE=851=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 23382e84..025930fa 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1521,7 +1521,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c XYLOG(XYLOG_SEVERITY_DEBUG, "Ethernet Power ON"); std::shared_ptr ethernetPowerCtrl = std::make_shared(1); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); SetStaticIp(); std::this_thread::sleep_for(std::chrono::milliseconds(256)); From 7fbffb2930be25a800e779da7fc44912fcc12696 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Feb 2025 19:18:44 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 025930fa..c389b26b 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -2171,6 +2171,10 @@ void visualize(const char* filename, const ncnn::Mat& m) void DrawOutlineText(cv::Ptr ft2, cv::Mat& mat, const std::string& str, cv::Point startPoint, int fontSize, cv::Scalar clr, int thickness) { + if (mat.empty()) + { + return; + } std::vector lines = split(str, "\n"); int lineHeight = 0; cv::Point pt = startPoint; From 52e2b5f0649602de95310a067f6c2cb7452d5fd4 Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Feb 2025 19:38:46 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=A9=BA=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 35 ++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index c389b26b..cf24a6a9 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -2254,6 +2254,12 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr characteristics closeThread.detach(); } + if (rgb.empty()) + { + TakePhotoCb(0, photoInfo, "", takingTime); + return true; + } + CPhoneDevice* pThis = this; std::thread th([pThis, characteristics, result, photoInfo, osds, path, rgb, facing, sensorOrientation, ldr, duration, takingTime]() { @@ -2697,11 +2703,20 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi } cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR); #endif // USING_EXEC_HDRP - bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); - if (res) + + if (rgb.empty()) { - // TakePhotoCb(2, photoInfo, path, takingTime); + pThis->TakePhotoCb(0, photoInfo, path, takingTime); + } + else + { + bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); + if (res) + { + // TakePhotoCb(2, photoInfo, path, takingTime); + } } + }); th.detach(); @@ -3011,11 +3026,19 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi cv::cvtColor(rgb, rgb, cv::COLOR_RGB2BGR); } - bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); - if (res) + if (rgb.empty()) + { + pThis->TakePhotoCb(0, photoInfo, path, takingTime); + } + else { - // TakePhotoCb(2, photoInfo, path, takingTime); + bool res = pThis->PostProcessPhoto(photoInfo, osds, path, cameraInfo, rgb); + if (res) + { + // TakePhotoCb(2, photoInfo, path, takingTime); + } } + }); th.detach(); From 4ca8e83188c607419b9377c640137f3e5547b51f Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Feb 2025 19:40:12 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index cf24a6a9..789a8a0c 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -2256,6 +2256,7 @@ bool CPhoneDevice::onOneCapture(std::shared_ptr characteristics if (rgb.empty()) { + XYLOG(XYLOG_SEVERITY_ERROR, "Empty Mat object CH=%u IMGID=%u", (uint32_t)photoInfo.channel, (uint32_t)photoInfo.photoId); TakePhotoCb(0, photoInfo, "", takingTime); return true; } @@ -2706,6 +2707,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi if (rgb.empty()) { + XYLOG(XYLOG_SEVERITY_ERROR, "Empty Mat object CH=%u IMGID=%u", (uint32_t)photoInfo.channel, (uint32_t)photoInfo.photoId); pThis->TakePhotoCb(0, photoInfo, path, takingTime); } else @@ -3028,6 +3030,7 @@ bool CPhoneDevice::onBurstCapture(std::shared_ptr characteristi if (rgb.empty()) { + XYLOG(XYLOG_SEVERITY_ERROR, "Empty Mat object CH=%u IMGID=%u", (uint32_t)photoInfo.channel, (uint32_t)photoInfo.photoId); pThis->TakePhotoCb(0, photoInfo, path, takingTime); } else From ef8efd48b0d046f490e30aff46b2eb7414ae692b Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 24 Feb 2025 20:05:37 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=BA=95=E5=B1=82=E6=8A=8A=E4=BA=91?= =?UTF-8?q?=E5=8F=B0=E7=94=B5=E5=8E=8B=E7=9A=84=E4=B8=A4=E4=B8=AAGPIO?= =?UTF-8?q?=E8=AE=BE=E5=8F=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/GPIOControl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/cpp/GPIOControl.h b/app/src/main/cpp/GPIOControl.h index a0724d3b..72735849 100644 --- a/app/src/main/cpp/GPIOControl.h +++ b/app/src/main/cpp/GPIOControl.h @@ -61,8 +61,10 @@ #define CMD_SET_SYSTEM_RESET 202 #define CMD_GET_LIGHT_ADC 101 #define CMD_SET_LIGHT_ADC 102 -#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112 -#define CMD_GET_BAT_BUS_VOLTAGE_STATE 117 +// #define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112 +// #define CMD_GET_BAT_BUS_VOLTAGE_STATE 117 +#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 117 +#define CMD_GET_BAT_BUS_VOLTAGE_STATE 112 #define CMD_SET_SPI_MODE 0 // TO BE ADDED #define CMD_SET_SPI_BITS_PER_WORD 0 // TO BE ADDED #define CMD_SET_SPI_MAXSPEEDHZ 0 // TO BE ADDED