diff --git a/Release/database/XNSim.db b/Release/database/XNSim.db index b86f645..b28d500 100644 Binary files a/Release/database/XNSim.db and b/Release/database/XNSim.db differ diff --git a/XNSimHtml/components/interface-config/variable-form.js b/XNSimHtml/components/interface-config/variable-form.js index ff2b3c4..84b54f9 100644 --- a/XNSimHtml/components/interface-config/variable-form.js +++ b/XNSimHtml/components/interface-config/variable-form.js @@ -179,6 +179,10 @@ class VariableForm extends HTMLElement { e.preventDefault(); const formData = new FormData(form); + const isArray = formData.get('interfaceIsArray') ? 1 : 0; + const arraySize1 = parseInt(formData.get('interfaceArraySize_1')) || 0; + const arraySize2 = parseInt(formData.get('interfaceArraySize_2')) || 0; + const data = { SystemName: 'XNSim', ProductName: formData.get('productName'), @@ -187,9 +191,9 @@ class VariableForm extends HTMLElement { InterfaceName: formData.get('interfaceName'), InterfaceType: formData.get('interfaceType'), InterfaceOption: 1, - InterfaceIsArray: formData.get('interfaceIsArray') ? 1 : 0, - InterfaceArraySize_1: formData.get('interfaceArraySize_1'), - InterfaceArraySize_2: formData.get('interfaceArraySize_2'), + InterfaceIsArray: isArray, + InterfaceArraySize_1: isArray && arraySize1 > 1 ? arraySize1 : 0, + InterfaceArraySize_2: isArray && arraySize1 > 1 ? arraySize2 : 0, InterfaceNotes: formData.get('interfaceNotes') }; diff --git a/XNSimHtml/utils/icd-parser.js b/XNSimHtml/utils/icd-parser.js index 7e97165..f3aef7c 100644 --- a/XNSimHtml/utils/icd-parser.js +++ b/XNSimHtml/utils/icd-parser.js @@ -41,6 +41,22 @@ function parseArrayDimensions(dimensions) { return { isArray: false, arraySize1: 0, arraySize2: 0 }; } +/** + * 处理变量类型替换规则 + * @param {string} type - 原始变量类型 + * @returns {string} 替换后的变量类型 + */ +function processVariableType(type) { + if (!type) return ''; + + const typeMap = { + 'unsigned char': 'char', + 'int': 'long' + }; + + return typeMap[type] || type; +} + /** * 解析单个工作表 * @param {Object} worksheet - Excel工作表对象 @@ -60,7 +76,7 @@ function parseWorksheet(worksheet, structName) { isArray: dimensions.isArray, arraySize1: dimensions.arraySize1, arraySize2: dimensions.arraySize2, - variableType: row['Variable Type'] || '' + variableType: processVariableType(row['Variable Type'] || '') }; }); }