456 lines
11 KiB
C
456 lines
11 KiB
C
|
|
#ifndef __CONFIG_H__
|
|
#define __CONFIG_H__
|
|
|
|
#include "afxdef.h"
|
|
//---------------------------------------------------------------
|
|
|
|
#define VER_CODE_M '1','0'
|
|
#define VER_CODE_S '0','1'
|
|
#define VER_CODE_D '0','1'
|
|
|
|
|
|
#define GAUF_PMB1 0x100 // 绘图仪主板
|
|
#define GAUF_EMB1 0x101 // 绣花/布线主板
|
|
#define GAUF_EHA1 0x501 // 平绣机头板
|
|
#define GAUF_EHB1 0x502 // 布线机头板
|
|
|
|
#define CUR_UPFL GAUF_EMB1
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
// 客户定义
|
|
|
|
// 客户代码
|
|
#define CLIENT_NONE 0 // 默认客户
|
|
#define CLIENT_GOA 3 // 再登
|
|
|
|
#define CUR_CLINET CLIENT_GOA
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define CORE_BOARD_BOOT 0 // 启动代码
|
|
#define CORE_BOARD_APP 1 // 应用代码
|
|
|
|
#define CUR_CORE_BOARD CORE_BOARD_APP
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define VERSION_DEBUG 0 // 调试版本
|
|
#define VERSION_RELEASE 1 // 发布版本
|
|
|
|
#define CUR_VERSION VERSION_DEBUG
|
|
|
|
//---------------------------------------------------------------
|
|
// 机器配置
|
|
#define MACH_NONE 0 // 未知机器
|
|
|
|
// 001~099 李劲松
|
|
#define MACH_EMB 1 // 绣花机
|
|
#define MACH_WIRE 2 // 布线机
|
|
|
|
|
|
// 100~149 李富恒
|
|
|
|
|
|
// 150~199 杨梦
|
|
#define MACH_SCANNER 150 // 扫描仪
|
|
#define MACH_PLATECUT 151 // 平板切割机
|
|
|
|
// 200~255 王春刚
|
|
#define MACH_MILLING 201 // 铣切机
|
|
#define MACH_BEDSKIRT 202 // 床笠裙边机
|
|
#define MACH_OPTICAL 203 // 光纤布线机
|
|
|
|
#define MACH_PES 210 // 冲绣缝
|
|
|
|
#if (CUR_CORE_BOARD == CORE_BOARD_APP)
|
|
#define CUR_MACHINE MACH_OPTICAL
|
|
#else
|
|
#define CUR_MACHINE MACH_NONE
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define USE_PASSWORD 0 // 使用分期付款密码
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define USE_IWDOG 0 // 使用看门狗
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#ifndef SYSCLK
|
|
#define SYSCLK 180000000L // 180M
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
// bootloader 大小
|
|
#define STM32_BOOT_SIZE (64*1024)
|
|
|
|
#define VERSION_LEN 48
|
|
#define EX_VER_LEN 32
|
|
|
|
#define NO_BUFF_WHEN_WT 1 // st flash 无缓写入
|
|
|
|
#define APP_SAVE_TO APP_SAVE_NORFLASH // APP升级存放区域
|
|
//#define APP_SAVE_TO APP_SAVE_EXRAM // APP升级存放区域
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
// 通讯端口选择
|
|
#if (1)
|
|
|
|
#define COMM_NONE 0 // 不使用,无效
|
|
|
|
#define COMM_USART1 1 // 串口1, 232
|
|
|
|
#define COMM_USART6 6 // 串口6, 485
|
|
|
|
#define COMM_ETHERNET 10 // 以太网
|
|
#define COMM_CAN 11 // CAN网络
|
|
|
|
#define CONSOLE_PORT COMM_USART1 // 控制台通讯口
|
|
|
|
#define USART6_485OutEn SetEn485OutOff
|
|
#define USART6_485OutDis SetEn485OutOn
|
|
|
|
#define MAX_STBUF1_SIZE (1024+512)
|
|
#define MAX_SRBUF1_SIZE (512) // 控制台通讯串口1收发缓冲区大小设置
|
|
|
|
#define CONTROL_BUS COMM_CAN // 扩展板通讯口
|
|
|
|
#define HCAN hcan1
|
|
|
|
#define OPERATOR_PORT COMM_ETHERNET // 操作箱通讯口
|
|
|
|
#if (CUR_CORE_BOARD == CORE_BOARD_APP)
|
|
#define MODBUS_M
|
|
#endif
|
|
|
|
#endif // 通讯端口选择
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#if (CUR_CORE_BOARD == CORE_BOARD_APP)
|
|
#define STM32_MOTOS_NUM 6 //
|
|
|
|
#define SPEED_TIM TIM8
|
|
|
|
#define MOTO1_TIM TIM9
|
|
|
|
#define MOTO2_TIM TIM10
|
|
|
|
#define MOTO3_TIM TIM11
|
|
|
|
#define MOTO4_TIM TIM12
|
|
|
|
#define MOTO5_TIM TIM13
|
|
|
|
#define MOTO6_TIM TIM14
|
|
|
|
#define MOOT_TIM_PSC 300
|
|
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
// SPI 端口使用定义
|
|
#define SRW_SPI1 // w5500
|
|
#define SRW_SPI2 // 串行FLASH(norflash)
|
|
#define SRW_SPI3 // FRAM
|
|
|
|
#define SERVER_NUM 1 // TCP 服务器个数
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define SERNORFLASHTYPE W25Q256 // norflash型号选择
|
|
|
|
//---------------------------------------------------------------
|
|
// 加密芯片
|
|
#define SMEC_CHIP
|
|
|
|
#define USE_SMEC 0
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#define TRANS_APP_FILE 1
|
|
#define TRANS_DATA_FILE 1
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#if (CUR_MACHINE == MACH_EMB)
|
|
|
|
#define EMB_MC_FLAT 10 // 平绣
|
|
#define EMB_MC_NSTC 11 // 标准型单头帽绣(凸轮换色) normal single Tubular/Cap
|
|
#define EMB_MC_FLOCK 12 // 植绒绣
|
|
#define EMB_MC_FLTIF 13 // 平绣,独立压脚
|
|
|
|
#define EMB_MC_FECC 50 // 平绣+毛巾绣
|
|
#define EMB_MC_CC 51 // 毛巾绣
|
|
#define EMB_MC_FECT 52 // 平绣+缠绕绣
|
|
#define EMB_MC_FECCC 53 // 平绣+毛巾+缠绕
|
|
|
|
#define EMB_MC_QUISN 100 // 绗绣机,单个机头针数等于1,无勾剪扣换
|
|
#define EMB_MC_QUIDN 101 // 绗绣机,单个机头针数等于2,有勾剪扣换,D86剪线
|
|
#define EMB_MC_QUIMN 102 // 绗绣机,单个机头针数大于等于4,有勾剪扣换,D86剪线
|
|
|
|
//-----------------
|
|
#define EMB_MC_TYPE EMB_MC_FLAT // 当前机器选择
|
|
|
|
#define MC_TYPE EMB_MC_TYPE
|
|
|
|
#define ROT_PULSE_PER_CIRCLE (1000) // 旋转电机每圈脉冲数
|
|
|
|
#define TRANS_PKT_LIST_NUM 128
|
|
#define RESV_PKT_LIST_NUM 128 // CAN收发缓冲区大小配置
|
|
|
|
#define COLOR_NODEID_BASE 2
|
|
#define HEAD_NODEID_BASE 11
|
|
|
|
#define RD_HEAD_PARA_NUM 4 // (平绣机头板+毛巾机头板+缠绕机头板+毛巾换色板)
|
|
|
|
//-----------------
|
|
|
|
#if (EMB_MC_TYPE == EMB_MC_NSTC)
|
|
#define MAX_SUPPORT_HEAD 1
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECC)
|
|
#define MAX_SUPPORT_COLOR 2
|
|
#define MAX_SUPPORT_HEAD 60
|
|
#elif (EMB_MC_TYPE == EMB_MC_CC)
|
|
#define MAX_SUPPORT_COLOR 2
|
|
#define MAX_SUPPORT_HEAD 40
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECT)
|
|
#define MAX_SUPPORT_COLOR 1
|
|
#define MAX_SUPPORT_HEAD 48
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECCC)
|
|
#define MAX_SUPPORT_COLOR 2
|
|
#define MAX_SUPPORT_HEAD 40
|
|
#elif (EMB_MC_TYPE == EMB_MC_QUISN)
|
|
#define MAX_SUPPORT_HEAD 132
|
|
#elif (EMB_MC_TYPE == EMB_MC_QUIDN || EMB_MC_TYPE == EMB_MC_QUIMN)
|
|
#define MAX_SUPPORT_HEAD 48
|
|
#else
|
|
#define MAX_SUPPORT_COLOR 1
|
|
#define MAX_SUPPORT_HEAD 32
|
|
#endif
|
|
|
|
//-----------------
|
|
#define TEMP_DATA1_SIZE (4*1024) // 隔头绣数据,4K,1024个色序
|
|
|
|
#define TEMP_DATA2_SIZE (2*1024) // 贴布绣(按色)数据大小,2K,1024个色序
|
|
|
|
#define TEMP_DATA3_SIZE (1024) // 扩展色序大小,1K(扩展512个色序)
|
|
|
|
#define TEMP_DATA4_SIZE (1024) // 毛巾高度数据大小,1k,1024个色序
|
|
|
|
#define DATA_FILE_SIZE3 (48*1024) // 边框刺绣数据文件空间大小,48K
|
|
#define DATA3_BASE_ADDR (EXRAM1_BASE_ADDR+TEMP_DATA1_SIZE+TEMP_DATA2_SIZE+TEMP_DATA3_SIZE+TEMP_DATA4_SIZE)
|
|
|
|
#define EMB_MAX_SIZE (TEMP_DATA1_SIZE+TEMP_DATA2_SIZE+TEMP_DATA3_SIZE+TEMP_DATA4_SIZE+DATA_FILE_SIZE3) // 绣花使用数据空间大小
|
|
#define EXRAM1_DATA_ADDR_BEG (EXRAM1_BASE_ADDR+EMB_MAX_SIZE)
|
|
#define MAX_DATA_EXRAM1_SIZE (EXRAM1_BYTE_SIZE-EMB_MAX_SIZE)
|
|
|
|
#elif (CUR_MACHINE == MACH_WIRE)
|
|
|
|
#define WIRE_MC_WIRE 1 // 布线机
|
|
|
|
|
|
#define WIRE_MC_TYPE WIRE_MC_WIRE
|
|
|
|
|
|
#define ROT_PULSE_PER_CIRCLE (1000) // 旋转电机每圈脉冲数
|
|
|
|
#define MC_TYPE WIRE_MC_TYPE
|
|
|
|
#define MAX_SUPPORT_HEAD 20
|
|
#define MAX_SUPPORT_EXTIO 1
|
|
|
|
#define TRANS_PKT_LIST_NUM 128
|
|
#define RESV_PKT_LIST_NUM 128 // CAN收发缓冲区大小配置
|
|
|
|
#define RD_HEAD_PARA_NUM 4
|
|
|
|
#elif (CUR_MACHINE == MACH_MILLING)
|
|
|
|
#define DEF_MILL 1 // 铣切机
|
|
#define MILL_MC_TYPE DEF_MILL
|
|
|
|
#define MC_TYPE MILL_MC_TYPE
|
|
|
|
#elif (CUR_MACHINE == MACH_BEDSKIRT)
|
|
#define DEF_BEDSKIRT 1 // 床笠裙边机机
|
|
#define BED_MC_TYPE DEF_BEDSKIRT
|
|
|
|
#define MC_TYPE BED_MC_TYPE
|
|
#elif (CUR_MACHINE == MACH_PES)
|
|
#define PES_MC_RHNR 1 // 旋转缝纫机
|
|
|
|
#define PES_MC_DHP 20 // 双头冲孔机
|
|
#define PES_MC_DRHP 21 // 双头旋转冲孔机
|
|
|
|
#define PES_MC_NPES 50 // 普通冲绣缝
|
|
#define PES_MC_APERS 51 // 异形旋转冲绣缝
|
|
#define PES_MC_DPENS 52 // 旋转冲绣缝
|
|
#define PES_MC_HPS 53 // 冲缝
|
|
|
|
|
|
#define PES_MC_TYPE PES_MC_APERS
|
|
#elif(CUR_MACHINE == MACH_SCANNER)
|
|
#define RUANYI 1
|
|
#define LEISAI 2
|
|
#define BUSCTRL_MOTO LEISAI //
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#if (CUR_MACHINE == MACH_PES)
|
|
#if (PES_MC_TYPE == PES_MC_RHNR)
|
|
#define MAX_SUPPORT_SEWHD 1
|
|
#define AUTO_ELEC_CLIP 1
|
|
#elif (PES_MC_TYPE == PES_MC_NPES)
|
|
#define MAX_SUPPORT_SEWHD 1
|
|
#define USE_IOEX 1 // 使用IO扩展板
|
|
#define MAX_SUPPORT_HEAD 2
|
|
#elif (PES_MC_TYPE == PES_MC_APERS)
|
|
#define MAX_SUPPORT_HEAD 1
|
|
#define MAX_SUPPORT_SEWHD 1
|
|
#define USE_IOEX 1 // 使用IO扩展板
|
|
#define AUTO_ELEC_CLIP 1
|
|
#elif (PES_MC_TYPE == PES_MC_DHP)
|
|
#define USE_IOEX 2 // 使用IO扩展板
|
|
#endif
|
|
|
|
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#if (CUR_CORE_BOARD == CORE_BOARD_BOOT)
|
|
|
|
#define VER_TYPE 'G','O','A'
|
|
|
|
#define VER_PROD 'B','O','O','T',' '
|
|
|
|
#define VER_CODE_M '1','0' // 主版本号
|
|
#define VER_CODE_S '0','1' // 子版本号
|
|
#define VER_CODE_D '0','1' // 修正版本号
|
|
|
|
#else
|
|
#if (CUR_MACHINE == MACH_EMB)
|
|
|
|
#define VER_TYPE 'E','M','B'
|
|
|
|
#if (EMB_MC_TYPE == EMB_MC_FLAT)
|
|
#define VER_PROD 'F','L','A','T',' '
|
|
#elif (EMB_MC_TYPE == EMB_MC_NSTC)
|
|
#define VER_PROD 'N','S','T','C',' '
|
|
#elif (EMB_MC_TYPE == EMB_MC_FLOCK)
|
|
#define VER_PROD 'F','L','O','C','K'
|
|
#elif (EMB_MC_TYPE == EMB_MC_FLTIF)
|
|
#define VER_PROD 'F','L','T','I','F'
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECC)
|
|
#define VER_PROD 'F','E','+','C','C'
|
|
#elif (EMB_MC_TYPE == EMB_MC_CC)
|
|
#define VER_PROD 'C','C',' ',' ',' '
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECT)
|
|
#define VER_PROD 'F','E','+','C','T'
|
|
#elif (EMB_MC_TYPE == EMB_MC_FECCC)
|
|
#define VER_PROD 'F','E','C','C','C'
|
|
#elif (EMB_MC_TYPE == EMB_MC_QUISN)
|
|
#define VER_PROD 'Q','U','I','S','N'
|
|
#elif (EMB_MC_TYPE == EMB_MC_QUIDN)
|
|
#define VER_PROD 'Q','U','I','D','N'
|
|
#elif (EMB_MC_TYPE == EMB_MC_QUIMN)
|
|
#define VER_PROD 'Q','U','I','M','N'
|
|
#else
|
|
#define VER_PROD ' ',' ',' ',' ',' '
|
|
#endif
|
|
|
|
|
|
#elif (CUR_MACHINE == MACH_WIRE)
|
|
#define VER_TYPE 'A','S','W'
|
|
#define VER_PROD 'W','I','R','E',' '
|
|
|
|
|
|
#elif (CUR_MACHINE == MACH_MILLING)
|
|
#define VER_TYPE 'G','O','A'
|
|
#define VER_PROD 'M','I','L','L',' '
|
|
|
|
#elif (CUR_MACHINE == MACH_BEDSKIRT)
|
|
#define VER_TYPE 'B','E','D'
|
|
#define VER_PROD 'S','K','I','R','T'
|
|
|
|
|
|
#elif (CUR_MACHINE == MACH_PES)
|
|
#if (EMB_MC_TYPE == PES_MC_RHNR)
|
|
#define VER_TYPE 'S','E','W'
|
|
#define VER_PROD 'R','H','N','R',' '
|
|
#elif (EMB_MC_TYPE == EMB_MC_NPES)
|
|
#define VER_PROD 'N','P','E','S',' '
|
|
#elif (EMB_MC_TYPE == EMB_MC_DHP)
|
|
#define VER_PROD 'D','H','P',' ',' '
|
|
#endif
|
|
#elif (CUR_MACHINE == MACH_SCANNER)
|
|
#define VER_TYPE 'G','O','A'
|
|
#define VER_PROD 'S','C','A','N',' '
|
|
|
|
#elif (CUR_MACHINE == MACH_OPTICAL)
|
|
#define VER_TYPE 'G','O','A'
|
|
#define VER_PROD 'O','P','T','I','C'
|
|
|
|
#else
|
|
|
|
#define VER_TYPE 'G','O','A'
|
|
#define VER_PROD 'C','O','R','E','A'
|
|
|
|
#endif /* CUR_MACHINE */
|
|
#endif /* CUR_CORE_BOARD */
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#ifndef EXRAM1_DATA_ADDR_BEG
|
|
#define EXRAM1_DATA_ADDR_BEG (EXRAM1_BASE_ADDR) // 数据文件使用空间1
|
|
#endif
|
|
|
|
#ifndef MAX_DATA_EXRAM1_SIZE
|
|
#define MAX_DATA_EXRAM1_SIZE (EXRAM1_BYTE_SIZE) // 数据文件使用空间1
|
|
#endif
|
|
|
|
#ifndef EXRAM2_DATA_ADDR_BEG
|
|
#define EXRAM2_DATA_ADDR_BEG (EXRAM2_BASE_ADDR) // 数据文件使用空间2
|
|
#endif
|
|
|
|
#ifndef MAX_DATA_EXRAM2_SIZE
|
|
#define MAX_DATA_EXRAM2_SIZE (EXRAM2_BYTE_SIZE) // 数据文件使用空间2
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
void GetVersionStr(char * str);
|
|
void GetBuildStr(char * str);
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
// 机器类型
|
|
#ifndef MC_TYPE
|
|
#define MC_TYPE 0
|
|
#endif
|
|
|
|
#ifndef VER_TYPE
|
|
#define VER_TYPE 'X','X','X'
|
|
#endif
|
|
#ifndef VER_PROD
|
|
#define VER_PROD 'X','X','X','X','X'
|
|
#endif
|
|
|
|
//---------------------------------------------------------------
|
|
|
|
#include "main.h"
|
|
|
|
#endif
|