{ descr: "Numeric HMI UI Controller", vars: { params: { ui_timeout: { descr: "Timeouts if no Button in this period", val: 500000, unit: "ms", }, }, input: { }, private: { }, output: { value: { type: "uint64_t", descr: "Value", val: 123, }, old: { descr: "Old Value", val: 0, }, v_ref: { descr: "REF Value", val: 1234, }, v_ctrl: { descr: "CTRL Value", val: 1, }, v_disp: { descr: "DISP Value", val: 1, }, v_unit: { descr: "UNIT Value", val: 1, }, v_oper: { descr: "OPER Value", val: 1, }, }, timers: { run_time: { descr: "Elapsed from start", }, last_button: { descr: "Elapsed from latest rx", }, }, }, funcs: { is_buttons_silent: "( last_button > ui_timeout )", oper_push: "start_push || reset_push || stop_push", is_changed: "( value != old )", menu_push: 'event == 16', set_push: "is_changed && event == 17", set_push_nch: "! is_changed && event == 17", plus_push: 'event == 18', minus_push: 'event == 19', start_push: 'event == 20', reset_push: 'event == 21', stop_push: 'event == 22', }, transitions: { start: { sources : ["INIT"], when: true, descr: "Auto Start", color: "Tan", target: "IDLE", set: { last_button: 0, }, }, to_ref: { sources : ["M_ERROR"], descr: "to Ref", when: "menu_push", color: "Orchid", target: "M_REF", set: { // value: "value_1", }, }, to_fault: { sources : ["IDLE"], descr: "to Fault", when: "menu_push", color: "Orchid", target: "M_FAULT", set: { // value: "value_1", }, }, to_error: { sources : ["M_FAULT"], descr: "to Error", when: "menu_push", color: "Orchid", target: "M_ERROR", set: { // value: "value_1", }, }, to_ctrl: { sources : ["M_REF"], descr: "to Ctrl", when: "menu_push", color: "PaleGreen", target: "M_CTRL", set: { // value: 222, }, }, to_disp: { sources : ["M_CTRL"], descr: "to Disp", when: "menu_push", color: "OrangeRed", target: "M_DISP", set: { // value: 333, }, }, to_unit: { sources : ["M_DISP"], descr: "to Unit", when: "menu_push", color: "MediumTurquoise", target: "M_UNIT", set: { // value: 444, }, }, to_oper: { sources : ["M_UNIT"], when: "menu_push", descr: "to Oper", color: "MediumOrchid", target: "M_OPER", set: { }, }, to_idle: { sources : ["M_OPER"], descr: "return to Idle", when: "menu_push", color: "LightSalmon", target: "IDLE", set: { // value: 444, }, }, setter: { sources : ["M_REF","M_CTRL","M_DISP","M_UNIT","M_OPER"], color: "red", descr: "Set Modified Value", when: "set_push", target: "IDLE", set: { last_button: 0, }, }, nochg: { sources : ["M_REF","M_CTRL","M_DISP","M_UNIT","M_OPER"], color: "LemonChiffon", descr: "Not Modified Value", when: "set_push_nch", target: "IDLE", set: { last_button: 0, }, }, operate: { sources : ["*"], color: "olive", descr: "Some Operation", when: "oper_push", target: "IDLE", set: { last_button: 0, }, }, tout: { sources : ["*"], color: "dodgerblue", when: "is_buttons_silent", descr: "Button Timeout", target: "IDLE", set: { last_button: 0, }, }, }, events: { B_MENU: { descr: "MENU BUTTON", ui_label: "MENU", id: 16, color: "green", args: { }, }, B_SET: { descr: "SET BUTTON", ui_label: "SET", id: 17, color: "red", args: { }, }, B_PLUS: { descr: "PLUS BUTTON", ui_label: "+", id: 18, color: "lightblue", args: { }, }, B_MINUS: { descr: "MINUS BUTTON", ui_label: "-", id: 19, color: "pink", args: { }, }, B_START: { descr: "START BUTTON", ui_label: "START", id: 20, color: "olive", args: { }, }, B_RESET: { descr: "RESET BUTTON", ui_label: "RESET", id: 21, color: "olive", args: { }, }, B_STOP: { descr: "STOP BUTTON", ui_label: "STOP", id: 22, color: "olive", args: { }, }, }, states: { INIT: { descr: "Initial State", color: "Tan", on_exit: { run_time: 1, event: 0 } }, IDLE: { descr: "Idle State", color: "lightgray", on_entry: { value: 0, old: 0, } }, M_REF: { descr: "Modify Reference", color: "Aquamarine", on_entry: { last_button: 1, } }, M_FAULT: { descr: "Show Faults", color: "Red", on_entry: { last_button: 1, } }, M_ERROR: { descr: "Show Errors", color: "Orange", on_entry: { last_button: 1, } }, M_CTRL: { descr: "Modify Control", color: "FireBrick", on_entry: { last_button: 1, } }, M_DISP: { descr: "Modify Display", color: "DeepPink", on_entry: { last_button: 1, } }, M_UNIT: { descr: "Modify Units", color: "GoldenRod", on_entry: { last_button: 1, } }, M_OPER: { descr: "Modify Operation", color: "Gold", on_entry: { last_button: 1, } }, }, }