firmware-base/cli-ts/ast/Feedback3C.json

13497 lines
703 KiB
JSON

{
"type": "translation_unit",
"children": [
{
"type": "preproc_ifdef",
"children": [
{
"type": "#ifndef",
"text": "#ifndef"
},
{
"type": "identifier",
"text": "FEEDBACK_3C_H"
},
{
"type": "preproc_def",
"children": [
{
"type": "#define",
"text": "#define"
},
{
"type": "identifier",
"text": "FEEDBACK_3C_H"
}
]
},
{
"type": "comment",
"text": "// Relay output mode\r"
},
{
"type": "preproc_def",
"children": [
{
"type": "#define",
"text": "#define"
},
{
"type": "identifier",
"text": "RELAY_MODE_NO"
},
{
"type": "preproc_arg",
"text": "0 // Normally Open: HIGH = ON\r"
}
]
},
{
"type": "preproc_def",
"children": [
{
"type": "#define",
"text": "#define"
},
{
"type": "identifier",
"text": "RELAY_MODE_NC"
},
{
"type": "preproc_arg",
"text": "1 // Normally Closed: LOW = ON\r"
}
]
},
{
"type": "comment",
"text": "// Select the mode for the Feedback3C component\r"
},
{
"type": "preproc_def",
"children": [
{
"type": "#define",
"text": "#define"
},
{
"type": "identifier",
"text": "FEEDBACK_3C_RELAY_MODE"
},
{
"type": "preproc_arg",
"text": "RELAY_MODE_NO\r"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<ArduinoLog.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<App.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<Component.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<enums.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "config.h"
},
{
"type": "\"",
"text": "\""
}
]
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<modbus/Modbus.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "system_lib_string",
"text": "<modbus/ModbusTCP.h>"
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "config-modbus.h"
},
{
"type": "\"",
"text": "\""
}
]
}
]
},
{
"type": "preproc_include",
"children": [
{
"type": "#include",
"text": "#include"
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "ValueWrapper.h"
},
{
"type": "\"",
"text": "\""
}
]
}
]
},
{
"type": "class_specifier",
"children": [
{
"type": "class",
"text": "class"
},
{
"type": "type_identifier",
"text": "Bridge"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "class_specifier",
"children": [
{
"type": "class",
"text": "class"
},
{
"type": "type_identifier",
"text": "Feedback3C"
},
{
"type": "base_class_clause",
"children": [
{
"type": ":",
"text": ":"
},
{
"type": "access_specifier",
"children": [
{
"type": "public",
"text": "public"
}
]
},
{
"type": "type_identifier",
"text": "Component"
}
]
},
{
"type": "field_declaration_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "access_specifier",
"children": [
{
"type": "public",
"text": "public"
}
]
},
{
"type": ":",
"text": ":"
},
{
"type": "field_declaration",
"children": [
{
"type": "storage_class_specifier",
"children": [
{
"type": "static",
"text": "static"
}
]
},
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "field_identifier",
"text": "MAX_LEDS"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "3"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "enum_specifier",
"children": [
{
"type": "enum",
"text": "enum"
},
{
"type": "type_identifier",
"text": "E_MB_Offset"
},
{
"type": "enumerator_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_1"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "1"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_2"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "2"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "3"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_1"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "4"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_2"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "5"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_CMD"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "6"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "7"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COIL_ENABLED"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "8"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COUNT"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "9"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "enum_specifier",
"children": [
{
"type": "enum",
"text": "enum"
},
{
"type": "type_identifier",
"text": "Mode"
},
{
"type": "enumerator_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_MANUAL"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_STARTUP"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "1"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_STANDBY"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "2"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_RUNNING"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "3"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_WAITING"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "4"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_FINISHED"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "5"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_WARNING"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "6"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_HEATING"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "7"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "MODE_ERROR"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "8"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "access_specifier",
"children": [
{
"type": "private",
"text": "private"
}
]
},
{
"type": ":",
"text": ":"
},
{
"type": "field_declaration",
"children": [
{
"type": "type_identifier",
"text": "Mode"
},
{
"type": "field_identifier",
"text": "_currentMode"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "enum_specifier",
"children": [
{
"type": "enum",
"text": "enum"
},
{
"type": "type_identifier",
"text": "LedState"
},
{
"type": "enumerator_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "struct_specifier",
"children": [
{
"type": "struct",
"text": "struct"
},
{
"type": "type_identifier",
"text": "ModeConfig"
},
{
"type": "field_declaration_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "field_declaration",
"children": [
{
"type": "type_identifier",
"text": "LedState"
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "led_states"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MAX_LEDS"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "storage_class_specifier",
"children": [
{
"type": "static",
"text": "static"
}
]
},
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "type_identifier",
"text": "ModeConfig"
},
{
"type": "reference_declarator",
"children": [
{
"type": "&",
"text": "&"
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "getModeConfig"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "Mode"
},
{
"type": "identifier",
"text": "mode"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "storage_class_specifier",
"children": [
{
"type": "static",
"text": "static"
}
]
},
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "type_identifier",
"text": "ModeConfig"
},
{
"type": "init_declarator",
"children": [
{
"type": "array_declarator",
"children": [
{
"type": "identifier",
"text": "configs"
},
{
"type": "[",
"text": "["
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "/* MODE_MANUAL */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_STARTUP */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_STANDBY */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_RUNNING */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_WAITING */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_FINISHED*/"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_ON"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_WARNING */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_HEATING */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "comment",
"text": "/* MODE_ERROR */"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_OFF"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "LedState"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "LED_BLINK"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "configs"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "mode"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "primitive_type",
"text": "uint8_t"
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "getPinState"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "primitive_type",
"text": "bool"
},
{
"type": "identifier",
"text": "led_on"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "preproc_if",
"children": [
{
"type": "#if",
"text": "#if"
},
{
"type": "parenthesized_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "FEEDBACK_3C_RELAY_MODE"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "RELAY_MODE_NO"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "\n",
"text": "\n"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "conditional_expression",
"children": [
{
"type": "identifier",
"text": "led_on"
},
{
"type": "?",
"text": "?"
},
{
"type": "identifier",
"text": "HIGH"
},
{
"type": ":",
"text": ":"
},
{
"type": "identifier",
"text": "LOW"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "preproc_else",
"children": [
{
"type": "#else",
"text": "#else"
},
{
"type": "comment",
"text": "// RELAY_MODE_NC\r"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "conditional_expression",
"children": [
{
"type": "identifier",
"text": "led_on"
},
{
"type": "?",
"text": "?"
},
{
"type": "identifier",
"text": "LOW"
},
{
"type": ":",
"text": ":"
},
{
"type": "identifier",
"text": "HIGH"
}
]
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "#endif",
"text": "#endif"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "field_identifier",
"text": "modbusAddress"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "type_identifier",
"text": "MB_Registers"
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "m_modbus_block"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_COUNT"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "mutable",
"text": "mutable"
}
]
},
{
"type": "type_identifier",
"text": "ModbusBlockView"
},
{
"type": "field_identifier",
"text": "m_modbus_view"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// for blinking\r"
},
{
"type": "field_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "unsigned",
"text": "unsigned"
},
{
"type": "long",
"text": "long"
}
]
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "lastToggleTime"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MAX_LEDS"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "bool"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "leds"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MAX_LEDS"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "ushort"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "ledFrequencies"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MAX_LEDS"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Mode"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "field_identifier",
"text": "mode"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "access_specifier",
"children": [
{
"type": "public",
"text": "public"
}
]
},
{
"type": ":",
"text": ":"
},
{
"type": "function_definition",
"children": [
{
"type": "primitive_type",
"text": "void"
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "setMode"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "Mode"
},
{
"type": "identifier",
"text": "newMode"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "unary_expression",
"children": [
{
"type": "!",
"text": "!"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "enabled"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": "||",
"text": "||"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "newMode"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "_currentMode"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "identifier",
"text": "_currentMode"
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "newMode"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "mode"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "setValueWithoutNotification"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "newMode"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "newMode"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MODE_MANUAL"
}
]
},
{
"type": "||",
"text": "||"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "newMode"
},
{
"type": ">",
"text": ">"
},
{
"type": "identifier",
"text": "MODE_ERROR"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "comment",
"text": "// 1. Get the configuration for the requested mode.\r"
},
{
"type": "declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "type_identifier",
"text": "ModeConfig"
},
{
"type": "init_declarator",
"children": [
{
"type": "reference_declarator",
"children": [
{
"type": "&",
"text": "&"
},
{
"type": "identifier",
"text": "config"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "getModeConfig"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "newMode"
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// Reset all LEDs and frequencies first to ensure a clean state.\r"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "setValueWithoutNotification"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "comment",
"text": "// 2. Iterate through each LED and apply the state from the fetched ModeConfig.\r"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "switch_statement",
"children": [
{
"type": "switch",
"text": "switch"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "subscript_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "config"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "led_states"
}
]
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "LED_OFF"
},
{
"type": ":",
"text": ":"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "false",
"text": "false"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "LED_ON"
},
{
"type": ":",
"text": ":"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "true",
"text": "true"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "LED_BLINK"
},
{
"type": ":",
"text": ":"
},
{
"type": "comment",
"text": "// For blinking, set the initial state and frequency.\r"
},
{
"type": "comment",
"text": "// The loop() function will handle the actual toggling.\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "true",
"text": "true"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// Start with LED on for immediate feedback\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "setValueWithoutNotification"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "1"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// Default 1s blink rate\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "millis"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "array_declarator",
"children": [
{
"type": "field_identifier",
"text": "pins"
},
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MAX_LEDS"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "field_declaration",
"children": [
{
"type": "enum_specifier",
"children": [
{
"type": "enum",
"text": "enum"
},
{
"type": "type_identifier",
"text": "Command"
},
{
"type": "enumerator_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "ALL_OFF"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "ALL_ON"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "1"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "enumerator",
"children": [
{
"type": "identifier",
"text": "ALL_BLINK"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "2"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "function_declarator",
"children": [
{
"type": "identifier",
"text": "Feedback3C"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "Component"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "owner"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "pin0"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "pin1"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "pin2"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "_id"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "_modbusAddress"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "field_initializer_list",
"children": [
{
"type": ":",
"text": ":"
},
{
"type": "field_initializer",
"children": [
{
"type": "field_identifier",
"text": "Component"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "_id"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "Component"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "COMPONENT_DEFAULT"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "owner"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "field_initializer",
"children": [
{
"type": "field_identifier",
"text": "pins"
},
{
"type": "initializer_list",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "identifier",
"text": "pin0"
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "pin1"
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "pin2"
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "field_initializer",
"children": [
{
"type": "field_identifier",
"text": "modbusAddress"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "_modbusAddress"
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "setNetCapability"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "OBJECT_NET_CAPS"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "E_NCAPS_MODBUS"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "identifier",
"text": "_currentMode"
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "MODE_STARTUP"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "template_function",
"children": [
{
"type": "identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "bool"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "this",
"text": "this"
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "id"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "lambda_expression",
"children": [
{
"type": "lambda_capture_specifier",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "this",
"text": "this"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": "abstract_function_declarator",
"children": [
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "trailing_return_type",
"children": [
{
"type": "->",
"text": "->"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "cast_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "parenthesized_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
},
{
"type": "+",
"text": "+"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_COIL"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "slaveId"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "false",
"text": "false"
},
{
"type": ",",
"text": ","
},
{
"type": "true",
"text": "true"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "bool"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "::",
"text": "::"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "ThresholdMode"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "DIFFERENCE"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "lambda_expression",
"children": [
{
"type": "lambda_capture_specifier",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "this",
"text": "this"
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": "abstract_function_declarator",
"children": [
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "primitive_type",
"text": "bool"
},
{
"type": "reference_declarator",
"children": [
{
"type": "&",
"text": "&"
},
{
"type": "identifier",
"text": "newValue"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "primitive_type",
"text": "bool"
},
{
"type": "reference_declarator",
"children": [
{
"type": "&",
"text": "&"
},
{
"type": "identifier",
"text": "oldValue"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "digitalWrite"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "subscript_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "pins"
}
]
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "getPinState"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "newValue"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "template_function",
"children": [
{
"type": "identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "ushort"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "this",
"text": "this"
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "id"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "lambda_expression",
"children": [
{
"type": "lambda_capture_specifier",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "this",
"text": "this"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": "abstract_function_declarator",
"children": [
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "trailing_return_type",
"children": [
{
"type": "->",
"text": "->"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "cast_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "parenthesized_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
},
{
"type": "+",
"text": "+"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "slaveId"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ",",
"text": ","
},
{
"type": "number_literal",
"text": "1"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "ushort"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "::",
"text": "::"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "ThresholdMode"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "DIFFERENCE"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "null",
"children": [
{
"type": "nullptr",
"text": "nullptr"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "identifier",
"text": "mode"
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "template_function",
"children": [
{
"type": "identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Mode"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "this",
"text": "this"
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "id"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "lambda_expression",
"children": [
{
"type": "lambda_capture_specifier",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "this",
"text": "this"
},
{
"type": "]",
"text": "]"
}
]
},
{
"type": "abstract_function_declarator",
"children": [
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "trailing_return_type",
"children": [
{
"type": "->",
"text": "->"
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "cast_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "type_descriptor",
"children": [
{
"type": "primitive_type",
"text": "uint16_t"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "slaveId"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MODE_STARTUP"
},
{
"type": ",",
"text": ","
},
{
"type": "cast_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Mode"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "number_literal",
"text": "1"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "template_type",
"children": [
{
"type": "type_identifier",
"text": "ValueWrapper"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Mode"
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "::",
"text": "::"
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "ThresholdMode"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "DIFFERENCE"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "null",
"children": [
{
"type": "nullptr",
"text": "nullptr"
}
]
},
{
"type": "comment",
"text": "// setMode is called manually after update\r"
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "setMode"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "MODE_STARTUP"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// 3 Coils for LEDs\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_COIL"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 0"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_1"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_1"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_COIL"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 1"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_2"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_2"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_COIL"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 2"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// 3 HRs for Blink Frequency\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 0 Freq"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_1"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_1"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 1 Freq"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_2"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_2"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "LED 2 Freq"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// 1 HR for Command\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_HR_CMD"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_HR_CMD"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_WRITE_ONLY"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Command (0:All Off, 1:All On, 2:All Blink)"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_HOLD_REGISTER"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Mode (0:Manual, 1:Startup, 2:Standby, 3:Running, 4:Waiting, 5:Finished, 6:Warning, 7:Heating, 8:Error)"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_block"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "MB_OFS_COIL_ENABLED"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "INIT_MODBUS_BLOCK_TCP"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "this",
"text": "this"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "modbusAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_OFS_COIL_ENABLED"
},
{
"type": ",",
"text": ","
},
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "E_FN_CODE"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "FN_WRITE_COIL"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "MB_ACCESS_READ_WRITE"
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Enabled"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "string_literal",
"children": [
{
"type": "\"",
"text": "\""
},
{
"type": "string_content",
"text": "Feedback3C"
},
{
"type": "\"",
"text": "\""
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_view"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "data"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "m_modbus_block"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "m_modbus_view"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "count"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "MB_OFS_COUNT"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "setup"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "Component"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "setup"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "pinMode"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "pins"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "OUTPUT"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "digitalWrite"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "pins"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "getPinState"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "loop"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "unary_expression",
"children": [
{
"type": "!",
"text": "!"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "enabled"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "_currentMode"
},
{
"type": "!=",
"text": "!="
},
{
"type": "identifier",
"text": "MODE_MANUAL"
}
]
},
{
"type": "||",
"text": "||"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "number_literal",
"text": "0"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": "||",
"text": "||"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "number_literal",
"text": "1"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": "||",
"text": "||"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "number_literal",
"text": "2"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "false",
"text": "false"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "mode"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "MODE_MANUAL"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "identifier",
"text": "_currentMode"
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "MODE_MANUAL"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "Component"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "loop"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "unsigned",
"text": "unsigned"
},
{
"type": "long",
"text": "long"
}
]
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "currentMillis"
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "millis"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// 3. If a blink frequency is set, toggle the LED state periodically.\r"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ">",
"text": ">"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "currentMillis"
},
{
"type": "-",
"text": "-"
},
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
}
]
},
{
"type": ">=",
"text": ">="
},
{
"type": "binary_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "*",
"text": "*"
},
{
"type": "number_literal",
"text": "1000"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "identifier",
"text": "currentMillis"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "bool"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "newState"
},
{
"type": "=",
"text": "="
},
{
"type": "unary_expression",
"children": [
{
"type": "!",
"text": "!"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "newState"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_write"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "address"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "networkValue"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "=",
"text": "="
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "address"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "modbusAddress"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// Any direct write to an LED coil/freq or a command sets the mode to MANUAL\r"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "setMode"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "MODE_MANUAL"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": ">=",
"text": ">="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
}
]
},
{
"type": "&&",
"text": "&&"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "<=",
"text": "<="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_2"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Coil write\r"
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "index"
},
{
"type": "=",
"text": "="
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "index"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "comment",
"text": "// manual override stops blinking\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "index"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ">",
"text": ">"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": ">=",
"text": ">="
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
}
]
},
{
"type": "&&",
"text": "&&"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "<=",
"text": "<="
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_2"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Freq write\r"
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "index"
},
{
"type": "=",
"text": "="
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "index"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "index"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ">",
"text": ">"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "index"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "millis"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_HR_CMD"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Command write\r"
},
{
"type": "switch_statement",
"children": [
{
"type": "switch",
"text": "switch"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "ALL_OFF"
},
{
"type": ":",
"text": ":"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "false",
"text": "false"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "ALL_ON"
},
{
"type": ":",
"text": ":"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "true",
"text": "true"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "case_statement",
"children": [
{
"type": "case",
"text": "case"
},
{
"type": "identifier",
"text": "ALL_BLINK"
},
{
"type": ":",
"text": ":"
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "identifier",
"text": "MAX_LEDS"
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "==",
"text": "=="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "update"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "number_literal",
"text": "1"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "comment",
"text": "// default 1s\r"
},
{
"type": "expression_statement",
"children": [
{
"type": "assignment_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "lastToggleTime"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "millis"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "break_statement",
"children": [
{
"type": "break",
"text": "break"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "case_statement",
"children": [
{
"type": "default",
"text": "default"
},
{
"type": ":",
"text": ":"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_INVALID_PARAMETER"
},
{
"type": ";",
"text": ";"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ">=",
"text": ">="
},
{
"type": "identifier",
"text": "MODE_MANUAL"
}
]
},
{
"type": "&&",
"text": "&&"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "networkValue"
},
{
"type": "<=",
"text": "<="
},
{
"type": "identifier",
"text": "MODE_ERROR"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "type_identifier",
"text": "Mode"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "newMode"
},
{
"type": "=",
"text": "="
},
{
"type": "cast_expression",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Mode"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "identifier",
"text": "networkValue"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "setMode"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "newMode"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_INVALID_PARAMETER"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_ENABLED"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "conditional_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ">",
"text": ">"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": "?",
"text": "?"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "enable"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ":",
"text": ":"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "disable"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_INVALID_PARAMETER"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_read"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "address"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "=",
"text": "="
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "address"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "modbusAddress"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": ">=",
"text": ">="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
}
]
},
{
"type": "&&",
"text": "&&"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "<=",
"text": "<="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_2"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Coil read\r"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "conditional_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "leds"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "MB_OFS_COIL_LED_0"
}
]
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "?",
"text": "?"
},
{
"type": "number_literal",
"text": "1"
},
{
"type": ":",
"text": ":"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": ">=",
"text": ">="
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
}
]
},
{
"type": "&&",
"text": "&&"
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "<=",
"text": "<="
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_2"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Freq read\r"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "subscript_expression",
"children": [
{
"type": "identifier",
"text": "ledFrequencies"
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "-",
"text": "-"
},
{
"type": "identifier",
"text": "MB_OFS_HR_FREQ_LED_0"
}
]
},
{
"type": "]",
"text": "]"
}
]
}
]
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_HR_CMD"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "comment",
"text": "// Command read - write only\r"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_HR_MODE"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "mode"
},
{
"type": ".",
"text": "."
},
{
"type": "field_identifier",
"text": "get"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
},
{
"type": "else_clause",
"children": [
{
"type": "else",
"text": "else"
},
{
"type": "if_statement",
"children": [
{
"type": "if",
"text": "if"
},
{
"type": "condition_clause",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "offset"
},
{
"type": "==",
"text": "=="
},
{
"type": "identifier",
"text": "MB_OFS_COIL_ENABLED"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "conditional_expression",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "enabled"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": "?",
"text": "?"
},
{
"type": "number_literal",
"text": "1"
},
{
"type": ":",
"text": ":"
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "number_literal",
"text": "0"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_write"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "MB_Registers"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "reg"
}
]
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "parameter_declaration",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "identifier",
"text": "networkValue"
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "mb_tcp_write"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "reg"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "startAddress"
}
]
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "networkValue"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_read"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "MB_Registers"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "reg"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "mb_tcp_read"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "reg"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "startAddress"
}
]
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "primitive_type",
"text": "void"
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_register"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "ModbusTCP"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "manager"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "type_identifier",
"text": "ModbusBlockView"
},
{
"type": "init_declarator",
"children": [
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "blocksView"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "identifier",
"text": "mb_tcp_blocks"
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "declaration",
"children": [
{
"type": "type_identifier",
"text": "Component"
},
{
"type": "init_declarator",
"children": [
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "thiz"
}
]
},
{
"type": "=",
"text": "="
},
{
"type": "call_expression",
"children": [
{
"type": "template_function",
"children": [
{
"type": "identifier",
"text": "const_cast"
},
{
"type": "template_argument_list",
"children": [
{
"type": "<",
"text": "<"
},
{
"type": "type_descriptor",
"children": [
{
"type": "type_identifier",
"text": "Feedback3C"
},
{
"type": "abstract_pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
}
]
}
]
},
{
"type": ">",
"text": ">"
}
]
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "this",
"text": "this"
},
{
"type": ")",
"text": ")"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "for_statement",
"children": [
{
"type": "for",
"text": "for"
},
{
"type": "(",
"text": "("
},
{
"type": "declaration",
"children": [
{
"type": "primitive_type",
"text": "int"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "=",
"text": "="
},
{
"type": "number_literal",
"text": "0"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "binary_expression",
"children": [
{
"type": "identifier",
"text": "i"
},
{
"type": "<",
"text": "<"
},
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "blocksView"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "count"
}
]
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "update_expression",
"children": [
{
"type": "++",
"text": "++"
},
{
"type": "identifier",
"text": "i"
}
]
},
{
"type": ")",
"text": ")"
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "declaration",
"children": [
{
"type": "type_identifier",
"text": "MB_Registers"
},
{
"type": "init_declarator",
"children": [
{
"type": "identifier",
"text": "info"
},
{
"type": "=",
"text": "="
},
{
"type": "subscript_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "blocksView"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "data"
}
]
},
{
"type": "subscript_argument_list",
"children": [
{
"type": "[",
"text": "["
},
{
"type": "identifier",
"text": "i"
},
{
"type": "]",
"text": "]"
}
]
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "field_expression",
"children": [
{
"type": "identifier",
"text": "manager"
},
{
"type": "->",
"text": "->"
},
{
"type": "field_identifier",
"text": "registerModbus"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "thiz"
},
{
"type": ",",
"text": ","
},
{
"type": "identifier",
"text": "info"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "type_identifier",
"text": "ModbusBlockView"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "mb_tcp_blocks"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "type_qualifier",
"children": [
{
"type": "const",
"text": "const"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "pointer_expression",
"children": [
{
"type": "&",
"text": "&"
},
{
"type": "identifier",
"text": "m_modbus_view"
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "function_definition",
"children": [
{
"type": "sized_type_specifier",
"children": [
{
"type": "short",
"text": "short"
}
]
},
{
"type": "function_declarator",
"children": [
{
"type": "field_identifier",
"text": "serial_register"
},
{
"type": "parameter_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "parameter_declaration",
"children": [
{
"type": "type_identifier",
"text": "Bridge"
},
{
"type": "pointer_declarator",
"children": [
{
"type": "*",
"text": "*"
},
{
"type": "identifier",
"text": "bridge"
}
]
}
]
},
{
"type": ")",
"text": ")"
}
]
},
{
"type": "virtual_specifier",
"children": [
{
"type": "override",
"text": "override"
}
]
}
]
},
{
"type": "compound_statement",
"children": [
{
"type": "{",
"text": "{"
},
{
"type": "expression_statement",
"children": [
{
"type": "call_expression",
"children": [
{
"type": "qualified_identifier",
"children": [
{
"type": "namespace_identifier",
"text": "Component"
},
{
"type": "::",
"text": "::"
},
{
"type": "identifier",
"text": "serial_register"
}
]
},
{
"type": "argument_list",
"children": [
{
"type": "(",
"text": "("
},
{
"type": "identifier",
"text": "bridge"
},
{
"type": ")",
"text": ")"
}
]
}
]
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "return_statement",
"children": [
{
"type": "return",
"text": "return"
},
{
"type": "identifier",
"text": "E_OK"
},
{
"type": ";",
"text": ";"
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": "}",
"text": "}"
}
]
}
]
},
{
"type": ";",
"text": ";"
},
{
"type": "#endif",
"text": "#endif"
}
]
}
]
}