Skip to content

Commit

Permalink
Fix some cosmetics errors and improve the new sysclk constannt behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
cavearr committed Nov 10, 2023
1 parent 9d7e781 commit d69bf6b
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions app/scripts/services/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,32 @@ angular.module('icestudio')

for (var i in graph.blocks) {
var block = graph.blocks[i];

var boardClkfreq = common.selectedBoard.info.SysClkMhz;
boardClkfreq = (boardClkfreq == undefined) ? 12 : boardClkfreq; // (default) boardClkfreq = 12 Mhz, if no sysClkMhz set in info.js of current board



// if no sysClkMhz is defined , no replacement is done, in this way the user is alerted because this empty parameter blocks
// needs a value and the user should filled depending the board clock.

let boardClkfreq = (typeof common.selectedBoard.info.SysClkMhz !== 'undefined' &&
common.selectedBoard.info.SysClkMhz.length !== false &&
common.selectedBoard.info.SysClkMhz.length > 0
) ? common.selectedBoard.info.SysClkMhz.length : false;


if (block.type === blocks.BASIC_CONSTANT) {
if (block.data.value==="SysClkMhz") {
params.push({
name: utils.digestId(block.id),
value: boardClkfreq
});
}else{
params.push({
name: utils.digestId(block.id),
value: block.data.value
});
}
if (boardClkfreq && block.data.value === "SysClkMhz") {
params.push({
name: utils.digestId(block.id),
value: boardClkfreq
});

} else {
params.push({
name: utils.digestId(block.id),
value: block.data.value
});

}

} else if (block.type === blocks.BASIC_MEMORY) {
let name = utils.digestId(block.id);

Expand Down

0 comments on commit d69bf6b

Please sign in to comment.