Skip to content

Commit

Permalink
add sort init messagesJson before init microavia#67
Browse files Browse the repository at this point in the history
  • Loading branch information
meded7 committed Apr 3, 2023
1 parent 64aa539 commit 47c7cb8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions port/js/src/messgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,17 @@ export function initializeMessages(messagesJson, headerSchema) {
HEADER_STRUCT: headerSchema ? new Struct(headerSchema) : HEADER_STRUCT
};

for (let m in getKeysWithSortById(messagesJson)) {
for (let m of getKeysWithSortById(messagesJson)) {

let name = m.trim(),
msg = "MSG_" + name.toUpperCase(),
id = messagesJson[m].id;
let name = m.trim(),
messageObj = messagesJson[m],
msg = "MSG_" + name.toUpperCase(),
id = messageObj.id;

if (!res.__id__[id]) {
let msg_struct = new Struct(messagesJson[m], res);
if (!res.__id__[id]) {
let msg_struct = new Struct(messageObj, res);

res.__id__[id] = msg_struct;
res.__id__[id] = msg_struct;
res.__name__[id] = m.trim();
res[msg] = msg_struct;
res[name] = msg_struct;
Expand Down

0 comments on commit 47c7cb8

Please sign in to comment.