zhunk пре 1 година
родитељ
комит
913e588d71

+ 14 - 14
q6_felgo_iot/CMakeLists.txt.user

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 14.0.1, 2025-04-29T14:04:18. -->
+<!-- Written by QtCreator 14.0.1, 2025-05-19T18:37:29. -->
 <qtcreator>
  <data>
   <variable>EnvironmentId</variable>
@@ -102,24 +102,24 @@
     <value type="int" key="CMake.Configure.BaseEnvironment">2</value>
     <value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
     <valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
-    <value type="QString" key="CMake.Initial.Parameters">-DANDROID_NDK:PATH=F:/Android_Env/android-ndk-r23c
--DQT_HOST_PATH:PATH=%{Qt:QT_HOST_PREFIX}
+    <value type="QString" key="CMake.Initial.Parameters">-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
+-DANDROID_STL:STRING=c++_shared
+-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
+-DCMAKE_BUILD_TYPE:STRING=Release
+-DANDROID_ABI:STRING=arm64-v8a
 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=F:/Android_Env/android-ndk-r23c/build/cmake/android.toolchain.cmake
--DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
 -DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake
--DCMAKE_GENERATOR:STRING=Ninja
--DANDROID_ABI:STRING=arm64-v8a
 -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx}
--DANDROID_NATIVE_API_LEVEL:STRING=23
+-DANDROID_USE_LEGACY_TOOLCHAIN_FILE:BOOL=OFF
 -DANDROID_SDK_ROOT:PATH=F:/Android_Env/android_sdk
--DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
--DCMAKE_FIND_ROOT_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
 -DQT_NO_GLOBAL_APK_TARGET_PART_OF_ALL:BOOL=ON
--DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}
--DCMAKE_BUILD_TYPE:STRING=Release
--DANDROID_USE_LEGACY_TOOLCHAIN_FILE:BOOL=OFF
--DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
--DANDROID_STL:STRING=c++_shared</value>
+-DQT_HOST_PATH:PATH=%{Qt:QT_HOST_PREFIX}
+-DANDROID_NATIVE_API_LEVEL:STRING=23
+-DANDROID_NDK:PATH=F:/Android_Env/android-ndk-r23c
+-DCMAKE_FIND_ROOT_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
+-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX}
+-DCMAKE_GENERATOR:STRING=Ninja
+-DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C}</value>
     <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:\QT_WorkSpace\qt6_iot_all\build-q6_felgo_iot-Qt_6_4_1_android_arm64_v8a_Clang_arm64_v8a-Release</value>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
      <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">

+ 108 - 34
q6_felgo_iot/header/TreeModel.h

@@ -15,8 +15,8 @@ class TreeItem {
 public:
     enum NodeType { Root = 0, Folder, Image };
 
-    explicit TreeItem(NodeType type, const QString &name, const QString &path = "", TreeItem *parent = nullptr)
-        : m_type(type), m_name(name), m_path(path), m_parent(parent) {}
+    explicit TreeItem(NodeType type, const QString &name, const QString &path = "", TreeItem *parent = nullptr,const QDateTime &lastModified = QDateTime())
+        : m_type(type), m_name(name), m_path(path), m_parent(parent),m_lastModified(lastModified.isValid() ? lastModified : QDateTime::currentDateTime()) {}  // 修正初始化 // 修正初始化
 
     ~TreeItem() { qDeleteAll(m_children); }
 
@@ -44,16 +44,34 @@ public:
         }
         return false;
     }
+
     void removeAllChildren() {
         qDeleteAll(m_children);
         m_children.clear();
     }
+
+    QDateTime lastModified() const { return m_lastModified; }
+    // 新增方法
+    int cachedChildCount() const {
+        if (m_cachedChildCount == -1 && m_type == Folder) {
+            QDir dir(m_path);
+            dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+            m_cachedChildCount = dir.entryList().count();
+        }
+        return m_cachedChildCount;
+    }
+
+    int visibleChildCount() const {
+        return m_cachedChildCount;
+    }
 private:
     QList<TreeItem*> m_children;
     NodeType m_type;
     QString m_name;
     QString m_path;
     TreeItem *m_parent;
+    QDateTime m_lastModified; // 已存在
+    mutable int m_cachedChildCount = -1; // 缓存数量,-1 表示未初始化
 };
 
 class TreeModel : public QAbstractItemModel {
@@ -108,6 +126,10 @@ public:
             return item->path();
         case IsFolderRole:
             return item->type() == TreeItem::Folder;
+        case CountRole:
+            return item->cachedChildCount();  // 直接返回子项数量
+        case TimeRole:
+            return item->lastModified();
         default:
             return QVariant();
         }
@@ -118,6 +140,8 @@ public:
         roles[Qt::DisplayRole] = "name";
         roles[PathRole] = "path";
         roles[IsFolderRole] = "isFolder";
+        roles[CountRole] = "count";
+        roles[TimeRole] = "time";
         return roles;
     }
     Q_INVOKABLE void resetModel(); // 暴露给QML调用
@@ -133,69 +157,99 @@ public:
             return;
         }
 
+        //判断是否为根目录的直接子节点
+        bool isRootChild = (parentItem == m_rootItem);
+
+
         // 清空现有子项(修复范围错误)
-        const int childCount = parentItem->childCount();
-        if (childCount > 0) {
-            beginRemoveRows(index, 0, childCount - 1);
+        if (parentItem->childCount() > 0) {
+            beginRemoveRows(index, 0, parentItem->childCount() - 1);
             parentItem->removeAllChildren(); // 需要实现该函数
             endRemoveRows();
         }
-
-        // 获取文件系统条目
+        // 获取文件系统条目(禁用QDir默认排序)
         QDir dir(parentItem->path());
         dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+        dir.setSorting(QDir::NoSort); // 🚨 禁用所有默认排序
+
+        // 获取条目并按新规则排序
         auto entries = dir.entryInfoList();
 
+        // 仅根目录的子项按时间排序
+        if (isRootChild) {
+            std::sort(entries.begin(), entries.end(), [](const QFileInfo &a, const QFileInfo &b) {
+                if (a.isDir() && b.isDir()) {
+                    return a.lastModified() > b.lastModified(); // 目录按时间排序
+                }
+                return a.fileName() < b.fileName(); // 文件按名称排序
+            });
+        } else {
+            // 非根目录保持默认名称排序
+            std::sort(entries.begin(), entries.end(), [](const QFileInfo &a, const QFileInfo &b) {
+                if (a.isDir() == b.isDir()) {
+                    return a.fileName() < b.fileName();
+                }
+                return a.isDir(); // 目录在前
+            });
+        }
+
         qDebug() << "Loading" << entries.count() << "items from" << dir.absolutePath();
 
-        // 处理空文件夹的情况
-        if (entries.isEmpty()) {
-            beginInsertRows(index, 0, 0);
-            parentItem->appendChild(new TreeItem(TreeItem::Folder, "(空)", "", parentItem));
-            endInsertRows();
-            return;
-        }
 
         // 插入新数据(修复行数范围)
         beginInsertRows(index, 0, entries.count() - 1);
         for (const QFileInfo &entry : entries) {
-            TreeItem::NodeType type = entry.isDir() ? TreeItem::Folder : TreeItem::Image;
 
-            // 过滤非图片文件
-            if (type == TreeItem::Image) {
+            if (!entry.isDir()) {
                 QMimeType mime = mimeDb.mimeTypeForFile(entry);
                 if (!mime.name().startsWith("image/")) continue;
             }
 
             parentItem->appendChild(new TreeItem(
-                type,
+                entry.isDir() ? TreeItem::Folder : TreeItem::Image,
                 entry.fileName(),
                 entry.absoluteFilePath(),
-                parentItem
+                parentItem,
+                entry.lastModified()  // 传递最后修改时间
                 ));
         }
         endInsertRows();
-
+        QVector<int> roles = {CountRole, TimeRole, IsFolderRole};
         // 强制刷新父节点数据
-        emit dataChanged(index, index, {IsFolderRole});
+        emit dataChanged(index, index, roles);
     }
     // TreeModel.h
+    // 新增方法获取目录时间
+    Q_INVOKABLE qint64 getDirectoryTime(const QString &path) const {
+        QFileInfo info(path);
+        return info.lastModified().toMSecsSinceEpoch();
+    }
     Q_INVOKABLE QVariantList getFolderContents(const QString &folderPath) {
         QVariantList contents;
         QDir dir(folderPath);
         dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
 
-        QMimeDatabase mimeDb;
-        for (const QFileInfo &entry : dir.entryInfoList()) {
+        QFileInfoList entries = dir.entryInfoList();
+        std::sort(entries.begin(), entries.end(), [](const QFileInfo &a, const QFileInfo &b) {
+            // 目录优先且按时间排序
+            if(a.isDir() && b.isDir())
+                return a.lastModified() > b.lastModified();
+            if(a.isDir()) return true;
+            if(b.isDir()) return false;
+            // 文件按名称排序
+            return a.fileName() < b.fileName();
+        });
+
+        //QMimeDatabase mimeDb;
+        for (const QFileInfo &entry : entries) {
             QVariantMap item;
             item["name"] = entry.fileName();
             item["path"] = entry.absoluteFilePath();
             item["isFolder"] = entry.isDir();
-
-            if (!entry.isDir()) {
-                QMimeType mime = mimeDb.mimeTypeForFile(entry);
-                item["isImage"] = mime.name().startsWith("image/");
-            }
+            // if (!entry.isDir()) {
+            //     QMimeType mime = mimeDb.mimeTypeForFile(entry);
+            //     item["isImage"] = mime.name().startsWith("image/");
+            // }
 
             contents.append(item);
         }
@@ -204,23 +258,42 @@ public:
 private:
     enum Roles {
         PathRole = Qt::UserRole + 1,
-        IsFolderRole = Qt::UserRole + 2
+        IsFolderRole = Qt::UserRole + 2,
+        CountRole = Qt::UserRole + 3,  //子项数量
+        TimeRole= Qt::UserRole + 4    //最后修改时间
     };
 
     void loadRootFolders() {
+        // 清空原有数据
+        beginResetModel();
+        m_rootItem->removeAllChildren();
+        endResetModel();
+
         QDir picturesDir(m_picturesPath);
         picturesDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
-
-        beginInsertRows(QModelIndex(), 0, picturesDir.count()-1);
-        for (const QFileInfo &dirInfo : picturesDir.entryInfoList()) {
+        picturesDir.setSorting(QDir::NoSort); // 禁用默认排序
+        // 获取并排序目录条目
+        QFileInfoList dirEntries = picturesDir.entryInfoList();
+        std::sort(dirEntries.begin(), dirEntries.end(), [](const QFileInfo& a, const QFileInfo& b) {
+            return a.lastModified() > b.lastModified(); // 降序排列(最新的在前)
+        });
+
+        beginInsertRows(QModelIndex(), 0, dirEntries.size()-1);
+        for (const QFileInfo &dirInfo : dirEntries) {
             m_rootItem->appendChild(new TreeItem(
                 TreeItem::Folder,
                 dirInfo.fileName(),
                 dirInfo.absoluteFilePath(),
-                m_rootItem
+                m_rootItem,
+                dirInfo.lastModified()
                 ));
         }
         endInsertRows();
+        // 调试输出
+        // qDebug() << "Sorted root folders:";
+        // for (const auto& entry : dirEntries) {
+        //     qDebug() << entry.fileName() << entry.lastModified();
+        // }
     }
 
     void populateFolderItems(TreeItem *parentFolder) {
@@ -243,7 +316,8 @@ private:
                 type,
                 entry.fileName(),
                 entry.absoluteFilePath(),
-                parentFolder
+                parentFolder,
+                entry.lastModified()
                 ));
         }
     }

+ 3 - 1
q6_felgo_iot/header/app_curlFunc.h

@@ -25,9 +25,10 @@ public:
     void uploadFileAsync(const QString &localFilePath);
 
 signals:
+    void downloadStart(const QString &tips);
     void progressChanged(double uploadedPercent);  // 进度百分比 (0.0 ~ 100.0)
     void finished(bool success, const QString &error); // 完成信号
-
+    void sglProgress(double val,double timeLeft,double speed);  //进度信号
 private:
     // 静态回调函数(供 CURL 调用)
     static size_t readCallback(char *buffer, size_t size, size_t nitems, void *userdata);
@@ -42,6 +43,7 @@ private:
     QString m_host;
     int m_port;
     QString m_remotePath;
+    QString update_type;
 };
 
 

+ 156 - 65
q6_felgo_iot/header/cameramanager.h

@@ -38,6 +38,15 @@
 //USBCamera:   https://blog.csdn.net/hanshiying007/article/details/124118486
 #define CameraType  2   //0-QCamera  , 1-OPENCV,    2-libuvc
 
+#define movY_f "f55"    //多图移动,正向
+#define movY_b "b55"    //多图移动,反向
+
+#define focux_f "f4"    //单步对焦,正向
+#define focus_b "b4"    //单步对焦,反向
+
+#define m_foucus_step_max 5
+#define focus_step_max 30
+
 //性能提升
 //https://blog.csdn.net/u012915226/article/details/115733359
 //https://blog.csdn.net/u012915226/article/details/121745861?spm=1001.2014.3001.5501
@@ -51,7 +60,6 @@
 namespace Qt6QCamera {
 
 
-
 // 定义一个包含信号的发送类
 class SenderCustom : public QObject {
     Q_OBJECT
@@ -240,91 +248,177 @@ signals:
     void signal_wait_upload(const QString &path);
 public slots:
 
+
     void onMovDone(){
         if(!camera_sw()){
             ERROR("Camera error!");
             setCameraSw(false);
             return;
         }
-
+        m_qulityString  = m_opencvfunc.Tenengrad(m_frame);
+        LOG("onMovDone:{}",m_qulityString.toStdString());
+        emit serial_data(m_json.ImageFunc(m_qulityString.toDouble()));
+        emit qulityStringChanged();
+#if 0
         m_qulityString = m_opencvfunc.Tenengrad(m_frame);
-
-        //m_qulityString = m_opencvfunc.Laplacian(m_frame);
         emit qulityStringChanged();
         LOG("onMovDone...{}",m_qulityString.toStdString());
-        #if 1
-        if(image_qulity_num < MAX_STEP){
-            image_qulity_num ++;
-            emit serial_data(m_json.MotorMove("movy","b4","1"));
-            qDebug() << image_qulity_num << " m_qulityString:" << m_qulityString << " size:" <<image_qulity.size();
-            image_qulity.append(m_qulityString.toDouble());
-            if(image_qulity_num==MAX_STEP){
-                max_image_qulity = *std::max_element(image_qulity.begin(), image_qulity.end());
+        if(param::ptlist.size()>0)
+        {
+            if(image_qulity_num<m_foucus_step_max){
+                image_qulity.append(m_qulityString.toDouble());
+                image_qulity_num++;
+                emit serial_data(m_json.MotorMove("movy","f4","1"));
+                if(image_qulity_num==m_foucus_step_max){
+                    max_image_qulity = *std::max_element(image_qulity.begin(), image_qulity.end());
+                }
+            }
+            LOG("max_image_qulity:{}@{}",image_qulity_num,max_image_qulity);
+            if(image_qulity_num>=m_foucus_step_max){
+                //如果当前清晰度大于最大清晰度
+                if(m_qulityString.toDouble() > max_image_qulity)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+                if(max_image_qulity<200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<5.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+                if(max_image_qulity>200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<20.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+
+                if(max_image_qulity>600.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<50.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+                if(image_qulity_num==m_foucus_step_max*2+5)
+                {
+                    image_qulity_num = 0;
+                    image_qulity.clear();
+                    emit serial_data(m_json.MotorMove("movy","b4","1"));
+                    return;
+                }
+                image_qulity_num++;
+                //如果当前清晰度小于最大清晰度,反向运动寻找清晰位置 f4
+                if(image_qulity_num>m_foucus_step_max&&max_image_qulity-m_qulityString.toDouble()>3.0){
+                    emit serial_data(m_json.MotorMove("movy","b4","1"));
+                }
             }
         }
-        LOG("max_image_qulity:{} <> m_qulityString:{}",max_image_qulity,m_qulityString.toStdString());
-        if(image_qulity_num >= MAX_STEP){
-            //如果当前清晰度大于最大清晰度
-            if(m_qulityString.toDouble() > max_image_qulity)
-            {
-                image_qulity.clear();
-                image_qulity_num = 0;
-                param::camera_tc = 1;
-                return;
+        //m_qulityString = m_opencvfunc.Laplacian(m_frame);
+        else{
+            #if 1
+            if(image_qulity_num < MAX_STEP){
+                image_qulity_num ++;
+                emit serial_data(m_json.MotorMove("movy","b4","1"));
+                qDebug() << image_qulity_num << " m_qulityString:" << m_qulityString << " size:" <<image_qulity.size();
+                image_qulity.append(m_qulityString.toDouble());
+                if(image_qulity_num==MAX_STEP){
+                    max_image_qulity = *std::max_element(image_qulity.begin(), image_qulity.end());
+                    image_qulity.clear();   //清除缓存
+                }
             }
+
             //如果最大清晰度约等于当前清晰度或小于当前清晰度,继续往前
             if(image_qulity_num==MAX_STEP&&max_image_qulity-m_qulityString.toDouble()<=2.0){
+                LOG("清晰度无明显变化,继续遍历!");
                 image_qulity_num=0;
                 image_qulity.clear();
                 emit serial_data(m_json.MotorMove("movy","b4","1"));
                 return;
             }
-
-            if(image_qulity_num>MAX_STEP&&max_image_qulity-m_qulityString.toDouble()<=3.0){
-                image_qulity.clear();
-                image_qulity_num = 0;
-                param::camera_tc = 1;
-                return;
-            }
-
-            image_qulity_num++;
-
-            if(max_image_qulity<200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<5.0)
-            {
-                image_qulity.clear();
-                image_qulity_num = 0;
-                param::camera_tc = 1;
-                return;
-            }
-            if(max_image_qulity>200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<20.0)
+            // 计算索引位置
+            //size_t max_index = std::distance(image_qulity.begin(), max_image_qulity);
+
+            LOG("max_image_qulity:{} <> m_qulityString:{}",max_image_qulity,m_qulityString.toStdString());
+            if(image_qulity_num >= MAX_STEP){
+                image_qulity.append(m_qulityString.toDouble());
+                //如果当前清晰度大于最大清晰度
+                if(m_qulityString.toDouble() > max_image_qulity)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+
+                if(image_qulity_num>MAX_STEP&&max_image_qulity-m_qulityString.toDouble()<=3.0){
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+
+                image_qulity_num++;
+
+                if(max_image_qulity<200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<5.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+                if(max_image_qulity>200.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<20.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+
+                if(max_image_qulity>600.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<50.0)
+                {
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                }
+#if 0
+            //如果最新清晰度小于上一个清晰度,表示已超过最大清晰度位置
+            if(image_qulity.last()-image_qulity[image_qulity.size()-2] < -2.0)
             {
-                image_qulity.clear();
-                image_qulity_num = 0;
-                param::camera_tc = 1;
-                return;
+                //
+                emit serial_data(m_json.MotorMove("movy","b4","1"));
+                QTimer::singleShot(500,[this](){
+                    LOG("500ms!");
+                    image_qulity.clear();
+                    image_qulity_num = 0;
+                    param::camera_tc = 1;
+                    return;
+                });
             }
+#endif
 
-            if(max_image_qulity>600.0&&max_image_qulity-m_qulityString.toDouble()>0.0&&max_image_qulity-m_qulityString.toDouble()<50.0)
-            {
-                image_qulity.clear();
-                image_qulity_num = 0;
-                param::camera_tc = 1;
-                return;
+                if(image_qulity_num==MAX_STEP*2+10)
+                {
+                    image_qulity_num = 0;
+                    image_qulity.clear();
+                    emit serial_data(m_json.MotorMove("movy","f4","1"));
+                    return;
+                }
+                //如果当前清晰度小于最大清晰度,反向运动寻找清晰位置 f4
+                if(image_qulity_num>MAX_STEP&&max_image_qulity-m_qulityString.toDouble()>3.0){
+                    emit serial_data(m_json.MotorMove("movy","f4","1"));
+                }
             }
-            if(image_qulity_num==MAX_STEP*2+5)
-            {
-                image_qulity_num = 0;
-                image_qulity.clear();
-                emit serial_data(m_json.MotorMove("movy","f4","1"));
-                return;
-            }
-            //如果当前清晰度小于最大清晰度,反向运动寻找清晰位置 f4
-            if(max_image_qulity>MAX_STEP&&max_image_qulity-m_qulityString.toDouble()>3.0){
-                emit serial_data(m_json.MotorMove("movy","f4","1"));
-            }
-        }
 
-        #endif
+            #endif
+        }
+#endif
     }
     void parseFrame(const cv::Mat& frame);
     void upload_handle(void);
@@ -436,9 +530,6 @@ private:
 
     int requestPermission(int vid, int pid);
 
-
-
-
     static inline QImage  cvMatToQImage( const cv::Mat &inMat )
     {
         switch ( inMat.type() )

+ 1 - 0
q6_felgo_iot/header/mserial.h

@@ -83,6 +83,7 @@ signals:
 
     void signal_movy();
     void timeout_mov_stop();
+
 public slots:
     void sendData(const QByteArray &data);
     void mqtttoserial(const QByteArray &data);

+ 0 - 215
q6_felgo_iot/qml/pages/AutoFocus.qml

@@ -1,215 +0,0 @@
-import QtQuick
-import Felgo
-import QtMultimedia
-import QtQuick.Controls
-import "../common"
-import "../controls"
-
-import Frames 0.1
-
-AppPage {
-    objectName: "autoFocus_Page"
-    navigationBarHidden: true
-    property var videoFormats
-    property alias camera: camera
-    property alias imageCapture: imageCapture
-
-
-    function autotake(sw){
-        if(sw)
-        {
-            console.log("autotakestart")
-            frames.camera_sw = true
-            //frames.auto_clicked = true  //开始对焦
-            auto_timer.start()  //启动对焦定时器
-            console.log("相机已打开")
-            photoTimer.interval=300*1000
-            photoTimer.start()
-
-        }else{
-            console.log("autotakestop")
-            frames.camera_sw = false
-            console.log("相机已关闭")
-        }
-    }
-
-
-    Frames {
-        objectName: "Frames"
-        id: frames
-        videoSink: output.videoSink
-        onVideoSinkChanged: {
-
-            console.log("onVideoSinkChanged")
-            photoTimer.start()  //两秒后关闭相机,因为相机加载的慢,否则关不住
-        }
-        onCameraStaChanged: function(sta_cam) {
-                if(sta_cam)
-                {
-                    camera.active = sta_cam
-                    //camera.start()
-                    output.visible= sta_cam
-                    photoTimer.interval=300*1000
-                    photoTimer.start()
-
-                }else{
-                    camera.active = sta_cam
-                    //camera.stop()
-                    output.visible= sta_cam
-                }
-
-
-
-//             var maxframerate = camera.videoFormats.maxFrameRate
-//             var minframerate = camera.videoFormats.minFrameRate
-//             console.log("最大帧率:",maxframerate,"最小帧率:",minframerate)
-//             var pix = camera.cameraFormat.pixelFormat
-//             console.log("视频格式:",pix)
-//             var resolution = camera.cameraFormat.resolution
-//             console.log("视频宽度:",resolution.width,"视频高度:",resolution.height)
-//             videoFormats = camera.cameraDevice.videoFormats
-//             var camera_s = videoFormats[0]
-//             for(var i= 0;i<videoFormats.leghth;i++){
-//                 var format = videoFormats[i]
-//                 console.log("Resolution: " + format.resolution.width + "x" + format.resolution.height);
-////                    if(format.resolution.width>videoFormats.resolution.width){
-////                        videoFormats = format
-////                    }
-//             }
-            console.log("相机状态改变",sta_cam)
-        }
-    }
-
-    MediaDevices {
-        id: mediaDevices
-
-    }
-
-    Camera {
-        id: camera
-        //cameraFormat:
-        active: false
-
-        whiteBalanceMode: Camera.WhiteBalanceAuto
-        //colorTemperature: 5600
-        zoomFactor: maximumZoomFactor
-
-    }
-
-    CaptureSession {
-        camera: camera
-        videoOutput: output
-        imageCapture : ImageCapture {
-                     id: imageCapture
-                     onImageSaved: {
-                         console.log("Image saved. Request ID:", requestId, "Path:", path);
-                     }
-
-                     onImageCaptured: {
-                         console.log("Image saved. Request ID:");
-                         imageCapture.captureToFile(appdir+"1.jpg")
-                     }
-        }
-    }
-
-
-    Timer {
-        id: photoTimer
-        interval: 2000 // 设置点击频率限制的时间间隔(以毫秒为单位)
-        running: false // 初始状态下定时器停止
-        repeat: false // 设置为false,以便只执行一次
-        onTriggered: {
-            // 定时器触发后,设置按钮可用
-            camera.active = false
-            camera.stop()
-            output.visible = false
-            frames.camera_sw = false
-        }
-    }
-
-    Timer {
-        id: auto_timer
-        interval: 1000 // 设置点击频率限制的时间间隔(以毫秒为单位)
-        running: false // 初始状态下定时器停止
-        repeat: false // 设置为false,以便只执行一次
-        onTriggered: {
-            // 定时器触发后,开始对焦
-            frames.auto_clicked = true
-        }
-    }
-
-    Rectangle {
-        id: rec_cam
-        height: parent.height
-        width: parent.width
-        border.color: "gray"
-        radius: 5
-
-
-        AppButton {
-          id: normButton
-          //anchors.horizontalCenter: parent.horizontalCenter
-          anchors.centerIn: parent
-          anchors.fill: parent
-          text: "打开相机"
-          flat: true    //边框是否可视
-          onClicked: {
-            //normButton.enabled = false
-            if(camera.active){
-                text = "相机已关闭"
-                output.visible = false
-                frames.camera_sw = false
-
-            }
-            else{
-                text = "打开相机"
-                output.visible = true
-                frames.camera_sw = true
-            }
-            // 启动定时器,设置按钮可用
-            //clickTimer.start()
-          }
-          AppImage{
-              anchors.centerIn: parent
-              source: "../../assets/photoico.svg"
-          }
-        }
-
-        VideoOutput
-        {
-            id: output
-            anchors.fill: parent
-            smooth: true    // 启用平滑播放
-            //fillMode: VideoOutput.Stretch
-//            transform: [ Scale { origin.x: 300; origin.y: 300;
-//                    xScale: frames.xScale; yScale: frames.yScale },
-//                Rotation { origin.x: 300; origin.y: 300;
-//                    angle: frames.angle } ]
-            Component.onCompleted: {
-                console.log("output onCompleted")
-            }
-        }
-
-        Row {
-
-            AppText {
-              id: photoclarity_text
-              width: parent.width
-              text: frames.fpsString
-              color:  "red"
-            }
-            AppText {
-              id: photoclarity2_text
-              anchors.top:  photoclarity_text.bottom
-              width: parent.width
-              text: frames.qulityString
-              color:  "red"
-            }
-        }
-
-
-    }
-
-}
-
-

+ 51 - 8
q6_felgo_iot/qml/pages/LocalNotificationPage.qml

@@ -11,6 +11,7 @@ AppPage {
     backgroundColor: Qt.rgba(0,0,0, 0.75) // page background is translucent, we can see other items beneath the page
     useSafeArea: false // do not consider safe area insets of screen
 
+
     Connections{
         target: ymodem
         onDownloadStart: {
@@ -63,6 +64,32 @@ AppPage {
 
     }
 
+    Connections{
+        target:curl_picture
+        onProgressChanged:{
+            console.log("更新进度条:",uploadedPercent)
+            progressBar.value = uploadedPercent
+            process_text.text = uploadedPercent.toFixed(2) + "%";
+
+        }
+        onDownloadStart:function(tips){
+            notificationPage.visible = true
+            notificationtext.text = tips
+        }
+        onFinished :function(success,error){
+            //notificationPage.visible = false
+            if(success){
+                notificationtext.color = "green"
+            }else{
+                notificationtext.text += error
+                notificationtext.color = "red"
+            }
+
+
+        }
+    }
+
+
     // login form background
     Rectangle {
         id: loginForm
@@ -80,6 +107,7 @@ AppPage {
         columnSpacing: dp(20)
         rowSpacing: dp(10)
         columns: 2
+        width: Math.min(parent.width * 0.9, dp(400)) // 限制最大宽度
 
         // headline
         AppText {
@@ -89,6 +117,11 @@ AppPage {
             Layout.columnSpan: 2
             Layout.alignment: Qt.AlignHCenter
             text: "通知"
+            Layout.preferredWidth: parent.width * 0.8  // 设置最大宽度
+            Layout.maximumWidth: dp(300)                // 限制最大宽度
+            wrapMode: Text.Wrap                        // 关键换行属性
+            horizontalAlignment: Text.AlignHCenter     // 保持居中
+            height: implicitHeight                      // 自动高度
         }
 
         AppText {
@@ -99,25 +132,35 @@ AppPage {
             text: ""
         }
 
+        // 进度条行(占满第一列)
         ProgressBar {
-          id: progressBar
-          implicitWidth: dp(300)
+            id: progressBar
+            Layout.fillWidth: true  // 关键属性:填充可用宽度
+            Layout.columnSpan: 1    // 占第一列
 
-          from: 0.0000
-          to: 100.0000
-          value: 0.0
+            from: 0.0000
+            to: 100.0000
+            value: 0.0
+
+            // 根据父布局动态计算宽度
+            implicitWidth: content.width - closeButton.width - content.columnSpacing
         }
 
+        // 按钮行(第二列)
         AppButton {
-            Layout.topMargin: dp(5)
+            id: closeButton
+            Layout.columnSpan: 1     // 占第二列
+            Layout.alignment: Qt.AlignRight
             text: qsTr("关闭")
             flat: false
-            Layout.alignment: Qt.AlignHCenter
+
+            // 固定按钮宽度
+            implicitWidth: dp(80)
+
             onClicked: {
                 progressBar.value = 0.0;
                 notificationPage.visible = false;
             }
         }
-
     }
 }

+ 16 - 6
q6_felgo_iot/qml/pages/LoginPage.qml

@@ -52,12 +52,12 @@ AppPage {
                 fontSize: 30
             }
 
-            Rectangle {
-                anchors.top: apptext_title.bottom
-                width: parent.width
-                height: 0.5
-                color: app.fontColor
-            }
+            // Rectangle {
+            //     anchors.top: apptext_title.bottom
+            //     width: parent.width
+            //     height: 0.5
+            //     color: app.fontColor
+            // }
 
             AppText{
                 id: text_logintime
@@ -84,6 +84,16 @@ AppPage {
                 logic.login(txtPassword.text)
                 logintimeout = 300
             }
+            // MouseArea {
+            //     anchors.fill: parent
+            //     onClicked: {
+            //         console.log("AppPage clicked!")
+            //         // 在这里添加处理点击事件的逻辑
+            //         //设置屏幕亮度为?
+            //         serial.setLightness(128)
+            //         logintimeout = 300
+            //     }
+            // }
         }
 //        AppImage {
 //            anchors.fill: parent

+ 7 - 4
q6_felgo_iot/qml/pages/PhotostitcherPage.qml

@@ -237,7 +237,8 @@ AppPage {
                     // }
 
                     Rectangle {
-                        anchors.fill: parent
+                        width: parent.width
+                        height: parent.height
                         //color: mouseArea.containsMouse ? "#f0f0f0" : "transparent"
 
                         Row {
@@ -280,9 +281,9 @@ AppPage {
                             // 名称
                             Text {
                                 text:{
-                                    if(model.isFloder){
-                                       const count = treeModel.rowCount(treeView.index(row, column))
-                                    return (count > 0 ? ` (${count})` : " (空)")
+                                    if(model.isFolder){
+                                       //const count = treeModel.rowCount(treeView.index(row, column))
+                                       return model.name + " (" + model.count + ")"
                                     }
                                     return model.name
                                 }
@@ -300,6 +301,7 @@ AppPage {
             }
         }
     }
+    // PhotoArchivePage.qml
 
     function loadFolderContents(folderPath) {
         imageListModel.clear()
@@ -320,6 +322,7 @@ AppPage {
         }
     }
 
+
     function loadRootDirectory() {
         if(isLoading) return
 

+ 7 - 0
q6_felgo_iot/qml/pages/TestPage.qml

@@ -52,6 +52,13 @@ AppPage {
             console.log("onVideoSinkChanged")
             photoTimer.start()  //两秒后关闭相机,因为相机加载的慢,否则关不住
         }
+
+        onQulityStringChanged: {
+            loginpage.logintimeout = 600;   //拍照刷新熄屏计时
+            photoTimer.interval = 600*1000
+            photoTimer.restart()
+        }
+
         onCameraStaChanged: function(sta_cam) {
             if(sta_cam){
                 //camera.active = sta_cam

+ 17 - 13
q6_felgo_iot/src/TreeModel.cpp

@@ -6,32 +6,35 @@
 #include <QDir>
 
 void TreeModel::resetModel() {
-    // 1. 通知所有关联视图模型即将重置
     beginResetModel();
 
     try {
-        // 2. 清理旧数据(完整内存释放)
+        // 安全删除旧数据
         if (m_rootItem) {
-            // 确保TreeItem析构函数正确删除子节点
             delete m_rootItem;
-            m_rootItem = nullptr; // 避免野指针
+            m_rootItem = nullptr;
         }
 
-        // 3. 初始化新根节点
         m_rootItem = new TreeItem(TreeItem::Root, "Root", "", nullptr);
 
-        // 4. 重新加载初始数据
         QDir picturesDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
         if (!picturesDir.exists()) {
             qWarning() << "Pictures directory does not exist:" << picturesDir.absolutePath();
             throw std::runtime_error("Pictures directory not found");
         }
 
-        // 加载一级目录
+        // 关键修改1:获取目录时添加排序规则
         picturesDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
-        const auto dirList = picturesDir.entryInfoList();
+        picturesDir.setSorting(QDir::NoSort);  // 禁用默认排序
+        QFileInfoList dirList = picturesDir.entryInfoList();
+
+        // 使用稳定排序算法
+        std::stable_sort(dirList.begin(), dirList.end(),
+                         [](const QFileInfo& a, const QFileInfo& b) {
+                             // 按最后修改时间降序排列
+                             return a.lastModified() > b.lastModified();
+                         });
 
-        // 5. 通知视图即将插入行
         beginInsertRows(QModelIndex(), 0, dirList.count() - 1);
 
         for (const QFileInfo &dirInfo : dirList) {
@@ -39,23 +42,24 @@ void TreeModel::resetModel() {
                 TreeItem::Folder,
                 dirInfo.fileName(),
                 dirInfo.absoluteFilePath(),
-                m_rootItem
+                m_rootItem,
+                dirInfo.lastModified()  // 携带时间戳
                 );
             m_rootItem->appendChild(newItem);
         }
 
-        // 6. 完成插入操作
         endInsertRows();
 
     } catch (const std::exception &e) {
         qCritical() << "Model reset failed:" << e.what();
-        // 异常时恢复空模型状态
         if (m_rootItem) {
             delete m_rootItem;
             m_rootItem = new TreeItem(TreeItem::Root, "Root", "", nullptr);
         }
     }
 
-    // 7. 通知视图重置完成
     endResetModel();
+
+    // 关键修改3:主动触发排序信号
+    emit layoutChanged({}, QAbstractItemModel::VerticalSortHint);
 }

+ 3 - 0
q6_felgo_iot/src/app_curlFunc.cpp

@@ -44,6 +44,7 @@ void CurlFtpUploader::performUpload(const QString &localFilePath) {
         curl_easy_cleanup(curl);
         return;
     }
+    emit downloadStart(localFilePath);
 
     // 构建 FTP URL(示例:ftp://user:pass@host:port/remote/path/filename)
     QString url = QString("ftp://%1/%2/%3")
@@ -100,5 +101,7 @@ int CurlFtpUploader::progressCallback(void *clientp, curl_off_t dltotal, curl_of
         double percent = (static_cast<double>(ulnow) / ultotal) * 100.0;
         emit uploader->progressChanged(percent);
     }
+    // 计算剩余时间
+    double remainingTime = 0.0;
     return 0;
 }

+ 56 - 47
q6_felgo_iot/src/cameramanager.cpp

@@ -576,6 +576,13 @@ Frames::setCameraSw(bool stat_cam)
                      // break;
                      return ;
                  }else{
+                     //创建归档路径
+                     QDateTime currentDateTime = QDateTime::currentDateTime();
+                     QString currentDateTimeString = currentDateTime.toString("yyyyMMddhhmmss");
+                     picture_path_floader = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+                     picture_path_floader = picture_path_floader + "/" + currentDateTimeString;
+                     createFolder(picture_path_floader);
+
                      m_fps_timer->setRunning(true);
                      m_1s->start();
                      emit startGrabbing(true);
@@ -780,100 +787,114 @@ Frames::handleGrab(bool sta_cam){
                                     param::ptlist.append(pic_name);
 
 
-                                    /*z4x6*/
-                                    if(z_step==4&&x_step==6)
-                                    {
+
+                                    /*z3x7*/
+                                    if(z_step==3&&x_step==7){
                                         emit stopGrabbing(false);
                                     }
-                                    if(z_step<=3&&x_step==6){
+
+                                    if(z_step<=2&&x_step==7){
+                                        z_step++;
+                                        emit serial_data(m_json.MotorMove("movz","f55","50"));
+                                    }
+
+
+                                    /*z3x6*/
+                                    if(z_step==3&&x_step==6)
+                                    {
+                                        //emit stopGrabbing(false);
+                                        x_step++;
+                                        z_step = 0;
+                                        emit serial_data(m_json.MotorMove("movx","f55","50"));
+                                    }
+                                    if(z_step<=2&&x_step==6){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","b55","50"));
                                     }
 
-                                    /*z4x5*/
-                                    if(z_step==4&&x_step==5)
+                                    /*z3x5*/
+                                    if(z_step==3&&x_step==5)
                                     {
                                         //emit stopGrabbing(false);
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","b55","50"));
                                     }
-                                    if(z_step<=3&&x_step==5){
+                                    if(z_step<=2&&x_step==5){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","f55","50"));
                                     }
 
-                                    /*z4x4*/
-                                    if(z_step==4&&x_step==4)
+                                    /*z3x4*/
+                                    if(z_step==3&&x_step==4)
                                     {
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","f55","50"));
                                     }
-                                    if(z_step<=3&&x_step==4){
+                                    if(z_step<=2&&x_step==4){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","b55","50"));
                                     }
 
-                                    /*z4x3*/
-                                    if(z_step==4&&x_step==3)
+                                    /*z3x3*/
+                                    if(z_step==3&&x_step==3)
                                     {
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","f55","50"));
                                     }
-                                    if(z_step<=3&&x_step==3){
+                                    if(z_step<=2&&x_step==3){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","f55","50"));
                                     }
                                     /**/
 
-
-                                    /*z4x2*/
-                                    if(z_step==4&&x_step==2)
+                                    /*z3x2*/
+                                    if(z_step==3&&x_step==2)
                                     {
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","f55","50"));
                                     }
-                                    if(z_step<=3&&x_step==2){
+                                    if(z_step<=2&&x_step==2){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","b55","50"));
                                     }
                                     /**/
 
-                                    /*z4x1*/
-                                    if(z_step==4&&x_step==1)
+                                    /*z3x1*/
+                                    if(z_step==3&&x_step==1)
                                     {
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","f55","50"));
                                     }
 
-                                    if(z_step<=3&&x_step==1){
+                                    if(z_step<=2&&x_step==1){
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","f55","50"));
                                     }
 
-                                    /*z4x0*/
-                                    if(z_step==4&&x_step==0)
+                                    /*z3x0*/
+                                    if(z_step==3&&x_step==0)
                                     {
                                         x_step++;
                                         z_step = 0;
                                         emit serial_data(m_json.MotorMove("movx","f55","50"));
                                     }
-                                    if(z_step<=3&&x_step==0)
+                                    if(z_step<=2&&x_step==0)
                                     {
                                         z_step++;
                                         emit serial_data(m_json.MotorMove("movz","b55","50"));
                                     }
                                 }
-                            }else if(param::camera_tc==-1)
+                            }
+                            else if(param::camera_tc==-1)
                             {
                                 emit stopGrabbing(false);
                                 break;
                             }
-
                             #else
                             emit uvcframeAvailable(m_frame);
                             #endif
@@ -1433,12 +1454,9 @@ Frames::update_qulstr(QString q_str)
 void
 Frames::saveImage()
 {
-    //创建归档路径
-    QDateTime currentDateTime = QDateTime::currentDateTime();
-    QString currentDateTimeString = currentDateTime.toString("yyyyMMddhhmmss");
-    picture_path_floader = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-    picture_path_floader = picture_path_floader + "/" + currentDateTimeString;
-    createFolder(picture_path_floader);
+    image_qulity_num = 0;
+    image_qulity.clear();
+
     //停止清晰度发送,关闭定时器m1s
     LOG("saveImage start!");
     #ifdef focus_board
@@ -1451,6 +1469,8 @@ Frames::saveImage()
     cv::cvtColor(m_frame,image_gray,cv::COLOR_RGBA2GRAY);
     double grayvalue = cv::mean(image_gray)[0];
     m_qulityString = m_opencvfunc.Tenengrad(m_frame);
+    image_qulity.append(m_qulityString.toDouble());
+    emit serial_data(m_json.ImageFunc(m_qulityString.toDouble()));
     emit qulityStringChanged();
     LOG("image_gray:{}",grayvalue);
     LOG("Tenengrad:{}",m_qulityString.toStdString());
@@ -1460,17 +1480,12 @@ Frames::saveImage()
         emit signal_photoerr();
         return;
     }
-
-    image_qulity_num = 0;
-    image_qulity.clear();
-
-
-    if(max_image_qulity < 1.0){
-        emit serial_data(m_json.MotorMove("movy","b50","1"));
-    }
-
+    // if(param::ptlist.empty()){
+    //     emit serial_data(m_json.MotorMove("movy","f20","1"));
+    // }else{
+    //     emit serial_data(m_json.MotorMove("movy","f4","1"));
+    // }
     #endif
-
 }
 
 void Frames::ImageCallBackEx(unsigned char * pData, MV_FRAME_OUT_INFO_EX* pFrameInfo, void* pUser)
@@ -1536,12 +1551,6 @@ Frames::captureImage(){
         }
     }else if(param::camera_type.contains("uvc")||param::camera_type.contains("hikrobot")){
         setCameraSw(true);
-
-        QDateTime currentDateTime = QDateTime::currentDateTime();
-        QString currentDateTimeString = currentDateTime.toString("yyyyMMddhhmmss");
-        picture_path_floader = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
-        picture_path_floader = picture_path_floader + "/" + currentDateTimeString;
-        createFolder(picture_path_floader);
         // 延时一段时间后触发拍照
         QTimer::singleShot(10000, [](){
             LOG("立即拍照!");

+ 6 - 5
q6_felgo_iot/src/main.cpp

@@ -286,11 +286,11 @@ int main(int argc, char *argv[])
     uploader_ftp.setFtpParams("bzy_user", "YFkj@6O2O", "8.136.98.49", 21, remotepath);
 
 
-    // 连接信号
-    QObject::connect(&uploader_ftp, &CurlFtpUploader::progressChanged,
-                     [](double percent) {
-        LOG("上传进度:{}%",percent);
-    });
+    // // 连接信号
+    // QObject::connect(&uploader_ftp, &CurlFtpUploader::progressChanged,
+    //                  [](double percent) {
+    //     LOG("上传进度:{}%",percent);
+    // });
 
     //创建并打开SQLite数据库
     QString db_config = "config.db";
@@ -456,6 +456,7 @@ int main(int argc, char *argv[])
     engine.rootContext()->setContextProperty("mqtt", &mqttHandler);
     engine.rootContext()->setContextProperty("curl", &curlHandler);
     engine.rootContext()->setContextProperty("ymodem",&m_ymodem);
+    engine.rootContext()->setContextProperty("curl_picture",&uploader_ftp);
 
     serialThread.start();
 

+ 5 - 1
q6_felgo_iot/src/mserial.cpp

@@ -318,6 +318,7 @@ SerialThread::processJsonData(QByteArray &jsonData)
                             param::camera_tc = 0;
                             emit dataUpload(jsonData);
                         }
+                        //收到主板的拍照指令
                         else if(statusValue.toString().contains("start")&&typeValue.toString().contains("autofocus")){
                             param::ptlist_res.clear();
                             param::ptlist.clear();      //对焦拍照前清除图片路径
@@ -329,6 +330,8 @@ SerialThread::processJsonData(QByteArray &jsonData)
                             emit dataUpload(jsonData);
                         }else if(statusValue.toString().contains("auto_focus")){
                             emit autoFocusDone();
+                            emit timeout_mov_stop();
+                            param::camera_tc = 1;
                         }else{
                             emit dataUpload(jsonData);
                         }
@@ -347,7 +350,8 @@ SerialThread::processJsonData(QByteArray &jsonData)
             }else if(value_cmd=="takephoto")
             {
                 emit timeout_mov_stop();
-                param::camera_tc = 1;
+                //param::camera_tc = 1;
+                emit takephotodone();
             }
         }
         //emit jsonReceived(jsonObject);