мелкие парвки

- поддержка символа '\' вкладке Wrapper User Code
- исправлены дефайны OFFSET_IN/OUT_ARRAY
- убрана конфигурация портов во время подгрузки конфигурации периферии
- исправлены подписи таблицы (Alias почему-то не записывался)
This commit is contained in:
Razvalyaev 2025-06-15 02:46:01 +03:00
parent d983f2525a
commit df30570d4a
6 changed files with 15 additions and 16 deletions

View File

@ -8,13 +8,13 @@ classdef customtable
tableControl = mask.getDialogControl(table_name); tableControl = mask.getDialogControl(table_name);
tableParameter = mask.getParameter(table_name); tableParameter = mask.getParameter(table_name);
nCols = tableControl.getNumberOfColumns; nCols = tableControl.getNumberOfColumns;
if nCols > 0 % if nCols > 0
for i = 1:nCols % for i = 1:nCols
tableControl.removeColumn(1); % tableControl.removeColumn(1);
end % end
end % end
column = tableControl.addColumn(Name='Title', Type='edit'); % column = tableControl.addColumn(Name='Title', Type='edit');
tableControl.Sortable = 'on'; % tableControl.Sortable = 'on';
column.Name = tableParameter.Alias; column.Name = tableParameter.Alias;
end end

View File

@ -74,6 +74,7 @@ classdef editCode
end end
% Формируем новую секцию с нужным текстом % Формируем новую секцию с нужным текстом
% newText = strrep(newText, '\', '\\'); % экранируем для корректной вставки
replacement = sprintf('%s START\n%s\n%s END', sectionName, newText, sectionName); replacement = sprintf('%s START\n%s\n%s END', sectionName, newText, sectionName);
% Заменяем всю найденную секцию на новую % Заменяем всю найденную секцию на новую

View File

@ -48,7 +48,7 @@ classdef mcuMask
table_names = {'srcTable', 'incTable'}; table_names = {'srcTable', 'incTable'};
for k = 1:numel(table_names) for k = 1:numel(table_names)
table_name = table_names{k}; table_name = table_names{k};
% customtable.format(table_name); customtable.format(table_name);
end end
% запись описания блока % запись описания блока
textDesc = ['Блок для настройки параметров симуляции микроконтроллера. ' newline ... textDesc = ['Блок для настройки параметров симуляции микроконтроллера. ' newline ...
@ -178,6 +178,7 @@ classdef mcuMask
newBody = get_param(block, 'wrapperCode'); newBody = get_param(block, 'wrapperCode');
code = fileread(filename); code = fileread(filename);
code = regexprep(code, '\r\n?', '\n'); code = regexprep(code, '\r\n?', '\n');
newBody = strrep(newBody, '\', '\\');
code = editCode.insertSection(code, section, newBody); code = editCode.insertSection(code, section, newBody);
% else % else
% % Обновляем тело функции % % Обновляем тело функции

View File

@ -190,10 +190,10 @@ classdef mcuPorts
for i = 1:n for i = 1:n
if i == 1 if i == 1
lines{end+1} = '#define OFFSET_ARRAY_1 0'; lines{end+1} = sprintf('#define OFFSET_%s_ARRAY_1 0', upperPrefix);
else else
lines{end+1} = sprintf('#define OFFSET_ARRAY_%d (OFFSET_ARRAY_%d + %s_PORT_%d_WIDTH)', ... lines{end+1} = sprintf('#define OFFSET_%s_ARRAY_%d (OFFSET_%s_ARRAY_%d + %s_PORT_%d_WIDTH)', ...
i, i - 1, upper(portPrefixes{i - 1}), i - 1); upperPrefix, i, upperPrefix, i - 1, upper(portPrefixes{i - 1}), i - 1);
end end
end end
newAuto = strjoin(lines, newline); newAuto = strjoin(lines, newline);
@ -251,7 +251,7 @@ classdef mcuPorts
if i == n if i == n
comma = ''; comma = '';
end end
lines{end+1} = sprintf(' OFFSET_ARRAY_%d%s', i, comma); lines{end+1} = sprintf(' OFFSET_%s_ARRAY_%d%s', upperPrefix, i, comma);
end end
lines{end+1} = '};'; lines{end+1} = '};';
lines{end+1} = ''; lines{end+1} = '';

View File

@ -68,9 +68,6 @@ function res = mexing(compile_mode)
config = periphConfig.update_config(blockPath, config); config = periphConfig.update_config(blockPath, config);
periphConfig.write_config(config); periphConfig.write_config(config);
periphConfig.update(blockPath, config); periphConfig.update(blockPath, config);
% Порты S-Function
mcuPorts.write();
% set_param(gcb, 'consoleOutput', 'Peripheral configuration file loaded. Re-open Block Parameters');
end end
end end

View File

@ -399,7 +399,6 @@ classdef periphConfig
'Container', periphName ... 'Container', periphName ...
); );
param.Alias = def.Def;
param.Evaluate = 'off'; param.Evaluate = 'off';
if def.NewRow if def.NewRow
@ -407,6 +406,7 @@ classdef periphConfig
else else
param.DialogControl.Row = 'current'; param.DialogControl.Row = 'current';
end end
param.Alias = def.Def;
end end