- 在普通 RackPick 前写托盘号、格位并置 M850,收到 M851 后清除两位 - 使用 vision/enabled 控制识别,关闭时仍执行拍照到位流程 - 识别成功且 R60 写入确认后写 M852=1,视觉关闭或失败时写 M852=0 - 确认 M852 写入后启动 RackPick,动作结束保留 M852 - 移除旧 850–854 五信号握手,更新配置和协议文档 - 允许未就绪的视觉服务接收测量,扩展超时以覆盖初始化重试 - 保留 PLC 写入失败阻断、暂停发送门控及迟到结果拒绝 - 持久化未完成事务,支持 PLC 暂停后的视觉维护与人工恢复 验证:MinGW 32/64 位编译通过;生产流程47、IPC14、PLC11项测试通过
84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
#ifndef CONFIGMANAGER_H
|
|
#define CONFIGMANAGER_H
|
|
|
|
#include "../db/dbconfig.h"
|
|
#include "../modbus/modbusconfig.h"
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QMap>
|
|
|
|
struct VisionConfig
|
|
{
|
|
bool enabled = false;
|
|
bool contractConfirmed = false;
|
|
bool photoPoseReadyConfirmed = false;
|
|
QString executablePath;
|
|
QString ipcName = "ssp_visionguide_v1";
|
|
int startupTimeoutMs = 15000;
|
|
int initializeTimeoutMs = 60000;
|
|
int requestTimeoutMs = 15000;
|
|
int photoPoseR = 40;
|
|
int graspPoseR = 60;
|
|
bool lowWordFirst = true;
|
|
int photoMoveCoil = 850;
|
|
int photoArrivedCoil = 851;
|
|
int comparisonPickCoil = 852;
|
|
QMap<int, int> trayMap;
|
|
|
|
bool isValid(QString *error = nullptr) const;
|
|
int visionTrayNo(int sspTrayNo) const;
|
|
};
|
|
|
|
struct ProductionConfig
|
|
{
|
|
int loadStep = 1;
|
|
int frontCheckStep = 2;
|
|
int backCheckStep = 3;
|
|
int unloadStep = 4;
|
|
int cycleCompleteStep = 5;
|
|
int okResult = 1;
|
|
int ngResult = 2;
|
|
int errorResult = 3;
|
|
int simulationResult = 1;
|
|
int timeoutWarningMs = 8000;
|
|
int stateTimeoutMs = 10000;
|
|
int maxRecoveryRetries = 1;
|
|
int simulationStepMs = 500;
|
|
bool usePlcErrorCode = false;
|
|
};
|
|
|
|
class ConfigManager
|
|
{
|
|
public:
|
|
static ConfigManager &instance();
|
|
|
|
bool load(const QString &filePath = QString());
|
|
QString filePath() const;
|
|
|
|
DbConfig databaseConfig() const;
|
|
ModbusConfig modbusConfig() const;
|
|
ProductionConfig productionConfig() const;
|
|
VisionConfig visionConfig() const;
|
|
bool simulationMode() const;
|
|
bool productionEnabled() const;
|
|
bool validate(QString *error = nullptr) const;
|
|
|
|
private:
|
|
ConfigManager();
|
|
ConfigManager(const ConfigManager &) = delete;
|
|
ConfigManager &operator=(const ConfigManager &) = delete;
|
|
|
|
QString defaultFilePath() const;
|
|
|
|
QString m_filePath;
|
|
DbConfig m_databaseConfig;
|
|
ModbusConfig m_modbusConfig;
|
|
ProductionConfig m_productionConfig;
|
|
VisionConfig m_visionConfig;
|
|
bool m_simulationMode;
|
|
bool m_productionEnabled;
|
|
};
|
|
|
|
#endif // CONFIGMANAGER_H
|