PunchHMI/machine/error.cpp
huahaiyan b9438b59c4 20240219
1、修改配置文件名称;
2、修改花样文件夹路径,并删除fcg文件;
3、合并任晴的代码;
2024-02-19 11:33:47 +08:00

122 lines
8.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "error.h"
#include "comm/protocol.h"
#include <QObject>
#define CASE_OP(cd, str) \
{\
case cd:\
errinfo = str;\
break;\
}
QString getErrStr(u32 code)
{
QString errinfo;
errinfo.clear();
QString errorCode;
errorCode.clear();
switch (code)
{
//通用的错误代码
CASE_OP(ERR_NONE, QObject::tr("")); // 没有错误
CASE_OP(ERR_NO_AIR, QObject::tr("Insufficient air pressure")); // 气压不足
CASE_OP(ERR_NOT_SAFE, QObject::tr("safe area error")); // 安全区域介入
CASE_OP(ERR_EXPIRATION, QObject::tr("Expiration of use (Please contact the manufacturer)")); // 使用时限已到 (请联系厂家)
CASE_OP(ERR_DRIVER, QObject::tr("Driver alarm")); // 驱动器报警
CASE_OP(ERR_FILL_DATA, QObject::tr("Fill data error")); // 填充数据错误
CASE_OP(ERR_NOT_ALLOWED, QObject::tr("Not allowed to work")); // 不允许工作状态
CASE_OP(ERR_CTRL_ERR, QObject::tr("Control error")); // 控制错误
CASE_OP(ERR_FPGA_ERR, QObject::tr("Motion control chip version error")); // 运动控制芯片版本错误
CASE_OP(ERR_BUTTON_NOUP, QObject::tr("Waiting for button to lift timeout")); // 等待按钮抬起超时
CASE_OP(ERR_FPGA_RESET, QObject::tr("FPGA Reset")); // FPGA复位
CASE_OP(ERR_NO_READY, QObject::tr("Peripheral Device not ready")); // 外设未就绪
CASE_OP(ERR_NO_SEND_ERR, QObject::tr("Transmission data error")); // 传输数据错误
CASE_OP(ERR_EDTION_ERR, QObject::tr("Program version error")); // 程序版本错误
CASE_OP(ERR_WORK_DONE, QObject::tr("Complete output")); // 完成产量
CASE_OP(ERR_LMT_POSITIVE, QObject::tr("Positive limit")); // 正向限位
CASE_OP(ERR_LMT_NEGATIVE, QObject::tr("Negative limit")); // 反向限位
CASE_OP(ERR_RUN_ALM, QObject::tr("Motion alarm")); // 运动报警
CASE_OP(ERR_RUN_LIMIT, QObject::tr("Motion limit")); // 运动限位
CASE_OP(ERR_RUN_EMS, QObject::tr("Emergency stop")); // 运动急停
CASE_OP(ERR_MV_PARA, QObject::tr("Motion parameters error")); // 运动参数错误
CASE_OP(ERR_MC_PARA, QObject::tr("Machine parameters error")); // 机器参数错误
CASE_OP(ERR_IN_PARA, QObject::tr("Input parameters error")); // 输入参数错误
CASE_OP(ERR_NOT_WORKSTA, QObject::tr("Not in work status error")); // 不能工作状态
CASE_OP(ERR_NOT_MOVESTA, QObject::tr("Prohibited frame moving state")); // 禁止移框状态
CASE_OP(ERR_MTZ_RIGHT, QObject::tr("Zero success")); // 归零成功
CASE_OP(ERR_MTZ_ERROR, QObject::tr("Return to zero error")); // 归零错误
CASE_OP(ERR_COOR_SYSTM, QObject::tr("XYCoordinate system error (Please reset to zero again)")); // XY坐标系统错误请重新归零
CASE_OP(ERR_OUT_RANGE, QObject::tr("Target position out of bounds")); // 目标位置越界
CASE_OP(ERR_X_LIT_POSI, QObject::tr("X Positive limit")); // X正向限位
CASE_OP(ERR_X_LIT_NEGA, QObject::tr("X Negative limit")); // X反向限位
CASE_OP(ERR_Y_LIT_POSI, QObject::tr("Y Positive limit")); // Y正向限位
CASE_OP(ERR_Y_LIT_NEGA, QObject::tr("Y Negative limit")); // Y反向限位
CASE_OP(ERR_MC_MANUAL, QObject::tr("Machine is in manual state")); // 机器处于手动状态
CASE_OP(ERR_KEY_SW_OFF, QObject::tr("Machine key off")); // 机器钥匙开关关闭
CASE_OP(ERR_LIGHTCURTAINS1, QObject::tr("Light curtain 1 intervention")); // 光幕1介入
CASE_OP(ERR_LIGHTCURTAINS2, QObject::tr("Light curtain 2 intervention")); // 光幕2介入
CASE_OP(ERR_NO_DATA, QObject::tr("None data")); // 无数据
CASE_OP(ERR_DATA_ERROR, QObject::tr("Data error")); // 数据错误
CASE_OP(ERR_GRAPH_OUT_RANGE, QObject::tr("Graphics out of range")); // 图形超出范围
CASE_OP(ERR_MS_NOT_ZERO, QObject::tr("Spindle is not in zero position")); // 主轴不在零位
CASE_OP(ERR_CUTTER_NOT_POS, QObject::tr("Scissors are not in position")); // 剪刀不在回位
CASE_OP(ERR_UPER_TBREAK, QObject::tr("Thread is broken"));// 断线
CASE_OP(ERR_BOBBIN_TBREAK, QObject::tr("Bottom thread disconnected")); // 底线断线
CASE_OP(ERR_TRANS_TIMEOUT, QObject::tr("Execution command timed out")); // 执行命令超时
CASE_OP(ERR_LIFT_TIMEOUT, QObject::tr("Cutting down lifting timeout (please check lifting sensor)")); // 裁切下升降超时(请检查升降传感器)
CASE_OP(ERR_NODE_ERR, QObject::tr("Node error")); // 节点错误
CASE_OP(ERR_BUS_ERR, QObject::tr("Bus Error (Please check the communication connection)")); // 总线错误(请检查通讯连接)
CASE_OP(ERR_CAN_TIMEOUT, QObject::tr("CAN communication timeout")); // CAN通讯超时
CASE_OP(ERR_CHANGE_BOBBIN, QObject::tr("Change the bobbin")); // 更换梭芯
CASE_OP(ERR_CHANGE_BOBBIN_A, QObject::tr("Replace bobbin A")); // 更换梭芯A
CASE_OP(ERR_CHANGE_BOBBIN_B, QObject::tr("Replace bobbin B")); // 更换梭芯B
CASE_OP(ERR_CHANGE_BOBBIN_STA, QObject::tr("The machine is in the state of replacing the bobbin")); // 机器处于更换梭芯状态
CASE_OP(ERR_AIR_POWER, QObject::tr("Insufficient air pressure")); // 气压不足
CASE_OP(ERR_MC_AUTO, QObject::tr("Machine is in auto state")); // 机器处于自动状态
CASE_OP(ERR_INSTALLMENT_OK, QObject::tr("Password set finished")); // 密码设置成功
CASE_OP(ERR_INSTALLMENT_FAIL, QObject::tr("Password set failed")); // 密码设置失败
CASE_OP(ERR_READ_HEAD_PARA, QObject::tr("Error reading headboard parameters")); // 读取机头板参数错误
CASE_OP(ERR_CHANGE_PNHPIN1, QObject::tr("Replace punch 1")); // 更换冲头1
CASE_OP(ERR_CHANGE_PNHPIN2, QObject::tr("Replace punch 2")); // 更换冲头2
CASE_OP(ERR_CHANGE_PNHPIN3, QObject::tr("Replace punch 3")); // 更换冲头3
CASE_OP(ERR_CHANGE_PNHPIN4, QObject::tr("Replace punch 4")); // 更换冲头4
CASE_OP(ERR_CHANGE_PNHPIN5, QObject::tr("Replace punch 5")); // 更换冲头5
CASE_OP(ERR_CHANGE_PNHPIN6, QObject::tr("Replace punch 6")); // 更换冲头6
CASE_OP(ERR_MT_DRIVER_R, QObject::tr("Rotating driver alarm")); // 旋转驱动器报警
CASE_OP(ERR_MT_DRIVER_R2, QObject::tr("Rotation 2 driver alarm")); // 旋转2驱动器报警
//通用的状态信息
CASE_OP(STA_NORMAL_STOP, QObject::tr("Normal stop")); // 正常停止
CASE_OP(STA_MTZ_SUCCESS, QObject::tr("Find zero success")); // 归零成功
CASE_OP(STA_WORK_PAUSE, QObject::tr("work pause")); // 工作暂停
CASE_OP(STA_WORK_OVER, QObject::tr("End of work")); // 工作结束
CASE_OP(STA_WORK_FINISH, QObject::tr("Work done")); // 工作完成
CASE_OP(STA_WORK_DONE, QObject::tr("Complete production")); // 完成产量
CASE_OP(STA_EXEC_SUCCESS, QObject::tr("Execute success")); // 执行成功
CASE_OP(STA_EXEC_FAILED, QObject::tr("Execute false")); // 执行失败
CASE_OP(STA_WAIT_FILE, QObject::tr("wait file")); // 等待文件
CASE_OP(STA_CHANGE_BOBBIN, QObject::tr("change the bobbin")); // 更换梭芯
CASE_OP(STA_PROCESS_FINISH, QObject::tr("Execute finish")); // 执行完成
CASE_OP(STA_PROCESS_RUNNING, QObject::tr("Execute runnibng")); // 执行过程中
CASE_OP(STA_AUTO_SOFTLIMIT, QObject::tr("Automatic soft limit setting completed")); // 自动定软限位完成
default:
//errorCode.sprintf("CODE 0x%x", code);
//errinfo.append(QObject::tr("Undefined error,") + errorCode);
break;
}
return errinfo;
}
QString getPromptStr(u32 code)
{
QString errinfo;
switch (code)
{
CASE_OP(ERR_NO_MATERIEL, QObject::tr("Please feed")); // 请上料
}
return errinfo;
}