From 3bc9c87db0778a2e6661e6b5267709e54c15cd02 Mon Sep 17 00:00:00 2001 From: lovebird Date: Tue, 1 Oct 2024 14:20:45 +0200 Subject: [PATCH] Updating - extrusion/lydia-print-head-v1 --- extrusion/lydia-print-head-v1/.gitignore | 104 + extrusion/lydia-print-head-v1/LICENSE | 24 + extrusion/lydia-print-head-v1/License.txt | 199 + extrusion/lydia-print-head-v1/README-2023.md | 164 + extrusion/lydia-print-head-v1/README.md | 160 + extrusion/lydia-print-head-v1/config.yaml | 12 + .../lydia-print-head-v1/firmware/.gitignore | 5 + .../lydia-print-head-v1/firmware/.travis.yml | 67 + .../firmware/.vscode/extensions.json | 7 + .../lydia-print-head-v1/firmware/License.md | 660 ++ .../lydia-print-head-v1/firmware/README.md | 37 + .../firmware/components.md | 92 + ...o_HMI_Modbus_TCP_IP_and_RTU_iX_example.zip | 3 + .../firmware/documentation/control_pid.md | 71 + .../firmware/documentation/control_vfd.md | 107 + .../firmware/documentation/modbus_tcp.md | 25 + .../firmware/documentation/setPID100.jpg | 3 + .../firmware/documentation/setPID100_TCP.jpg | 3 + .../firmware/firmware/.gitignore | 5 + .../firmware/firmware/Addon.cpp | 49 + .../firmware/firmware/Addon.h | 69 + .../firmware/firmware/ModbusBridge.cpp | 408 ++ .../firmware/firmware/ModbusBridge.h | 172 + .../firmware/firmware/ModbusRtu.h | 1524 ++++ .../firmware/firmware/Mudbus.cpp | 238 + .../firmware/firmware/Mudbus.h | 96 + .../firmware/firmware/OmronE5.h | 332 + .../firmware/firmware/OmronPID.cpp | 603 ++ .../firmware/firmware/OmronPID.h | 179 + .../firmware/firmware/OmronVFD.cpp | 122 + .../firmware/firmware/OmronVFD.h | 150 + .../firmware/firmware/OmronVFDModbus.cpp | 371 + .../firmware/firmware/Readme.md | 5 + .../firmware/firmware/TimerOne.cpp | 54 + .../firmware/firmware/TimerOne.h | 485 ++ .../firmware/firmware/VFD.h | 110 + .../firmware/firmware/Version.h | 7 + .../firmware/firmware/addons/Auto-Reverse.h | 35 + .../firmware/firmware/addons/CartridgeFull.h | 45 + .../firmware/firmware/addons/DipSwitch.h | 51 + .../firmware/addons/DirectionSwitch.h | 33 + .../firmware/addons/EnclosureSensor.h | 43 + .../firmware/firmware/addons/MotorIdle.h | 32 + .../firmware/firmware/addons/MotorLoad.h | 145 + .../firmware/firmware/addons/MotorSpeed.h | 41 + .../firmware/addons/MotorTemperature.h | 40 + .../firmware/addons/OperationModeSwitch.h | 148 + .../firmware/firmware/addons/Power.h | 140 + .../firmware/firmware/addons/Reset.h | 30 + .../firmware/firmware/addons/Status.h | 64 + .../firmware/addons/TemperatureSensor.h | 42 + .../firmware/firmware/app.cpp | 307 + .../firmware/firmware/app.h | 126 + .../firmware/firmware/app_addons.cpp | 238 + .../firmware/firmware/app_extruding.cpp | 19 + .../firmware/firmware/bridge.cpp | 121 + .../firmware/firmware/bridge.h | 81 + .../firmware/firmware/common/macros.h | 98 + .../firmware/firmware/common/ppmath.h | 14 + .../firmware/firmware/common/ppmath_motor.cpp | 17 + .../firmware/firmware/common/ppmath_motor.h | 18 + .../firmware/firmware/common/timer.h | 136 + .../firmware/firmware/components/3pos.h | 81 + .../firmware/components/CurrentSensor.h | 39 + .../firmware/firmware/components/IRSensor.cpp | 96 + .../firmware/firmware/components/IRSensor.h | 42 + .../firmware/firmware/components/OmronE5.h | 360 + .../firmware/firmware/components/OmronMX2.h | 86 + .../firmware/components/PhotoElectricSensor.h | 89 + .../firmware/components/Proximity_Sensor.h | 39 + .../firmware/components/StatusLight.h | 67 + .../firmware/components/TemperatureSensor.h | 42 + .../firmware/firmware/config.h | 134 + .../firmware/config/known_16bit_timers.h | 153 + .../firmware/firmware/config_adv.h | 115 + .../firmware/firmware/config_validator.h | 21 + .../firmware/firmware/constants.h | 129 + .../firmware/firmware/docs/protocol.md | 76 + .../firmware/firmware/enums.h | 183 + .../firmware/firmware/features.h | 113 + .../firmware/firmware/firmware.ino | 11 + .../firmware/firmware/package.json | 26 + .../firmware/firmware/ppmath_statistics.cpp | 93 + .../firmware/firmware/ppmath_statistics.h | 112 + .../firmware/firmware/serial.cpp | 127 + .../firmware/firmware/serial.h | 47 + .../firmware/firmware/types.h | 11 + .../firmware/firmware/user_config.h | 4 + .../firmware/firmware/util/crc16.h | 88 + .../firmware/firmware/util/word.h | 64 + .../firmware/firmware/version.js | 32 + .../firmware/node/.gitignore | 42 + .../firmware/node/.npmignore | 5 + .../lydia-print-head-v1/firmware/node/LICENSE | 674 ++ .../firmware/node/README.md | 35 + .../firmware/node/build/_cli.js | 16 + .../firmware/node/build/_cli.js.map | 1 + .../node/build/commands/pid/program.js | 66 + .../node/build/commands/pid/program.js.map | 1 + .../firmware/node/build/format.js | 22 + .../firmware/node/build/format.js.map | 1 + .../firmware/node/build/formatter.js | 22 + .../firmware/node/build/formatter.js.map | 1 + .../firmware/node/build/index.js | 19 + .../firmware/node/build/index.js.map | 1 + .../firmware/node/build/lib/common/enums.js | 59 + .../node/build/lib/common/enums.js.map | 1 + .../node/build/lib/common/primitives.js | 190 + .../node/build/lib/common/primitives.js.map | 1 + .../firmware/node/build/lib/common/strings.js | 437 ++ .../node/build/lib/common/strings.js.map | 1 + .../firmware/node/build/lib/common/types.js | 14 + .../node/build/lib/common/types.js.map | 1 + .../firmware/node/build/lib/net/sheets.js | 82 + .../firmware/node/build/lib/net/sheets.js.map | 1 + .../firmware/node/build/log.js | 21 + .../firmware/node/build/log.js.map | 1 + .../firmware/node/build/main.js | 19 + .../firmware/node/build/main.js.map | 1 + .../firmware/node/build/paths.js | 14 + .../firmware/node/build/paths.js.map | 1 + .../firmware/node/build/types.js | 18 + .../firmware/node/build/types.js.map | 1 + .../firmware/node/package-lock.json | 6157 +++++++++++++++++ .../firmware/node/package.json | 83 + .../firmware/node/src/_cli.ts | 13 + .../firmware/node/src/argv.ts | 55 + .../firmware/node/src/commands/clean.ts | 15 + .../firmware/node/src/commands/index.ts | 0 .../firmware/node/src/commands/pid/program.ts | 81 + .../firmware/node/src/commands/tests.ts | 36 + .../firmware/node/src/commands/watch.ts | 79 + .../firmware/node/src/constants.ts | 2 + .../firmware/node/src/format.ts | 19 + .../firmware/node/src/formatter.ts | 18 + .../firmware/node/src/index.ts | 6 + .../firmware/node/src/lib/common/array.ts | 15 + .../firmware/node/src/lib/common/ci.ts | 360 + .../firmware/node/src/lib/common/enums.ts | 55 + .../firmware/node/src/lib/common/platform.ts | 12 + .../node/src/lib/common/primitives.ts | 247 + .../firmware/node/src/lib/common/readme.md | 6 + .../firmware/node/src/lib/common/strings.ts | 487 ++ .../firmware/node/src/lib/common/types.ts | 35 + .../firmware/node/src/lib/common/ve.ts | 14 + .../firmware/node/src/lib/content/front.ts | 57 + .../firmware/node/src/lib/content/html.ts | 26 + .../firmware/node/src/lib/content/md.ts | 54 + .../firmware/node/src/lib/content/tables.ts | 76 + .../firmware/node/src/lib/fs/index.ts | 88 + .../firmware/node/src/lib/git/log.ts | 39 + .../firmware/node/src/lib/index.ts | 9 + .../firmware/node/src/lib/lang/README.md | 48 + .../firmware/node/src/lib/net/crawler.ts | 172 + .../firmware/node/src/lib/net/github.ts | 10 + .../firmware/node/src/lib/net/sheets.ts | 77 + .../firmware/node/src/lib/process/index.ts | 136 + .../firmware/node/src/log.ts | 18 + .../firmware/node/src/main.ts | 17 + .../node/src/os/context_menu/register_cli.ts | 106 + .../firmware/node/src/output.ts | 27 + .../firmware/node/src/paths.ts | 19 + .../firmware/node/src/types.ts | 124 + .../firmware/node/tsconfig.json | 29 + .../firmware/node/tslint.json | 101 + .../firmware/platformio.ini | 20 + .../lydia-print-head-v1/firmware/setup.md | 41 + .../firmware/test/mtest/ModbusRtu.h | 1485 ++++ .../firmware/test/mtest/mtest.ino | 190 + .../firmware/test/mtest2/ModbusRtu.h | 1504 ++++ .../firmware/test/mtest2/OmronE5.h | 332 + .../firmware/test/mtest2/PriUint64.h | 96 + .../firmware/test/mtest2/macros.h | 98 + .../firmware/test/mtest2/mtest2.ino | 218 + .../firmware/test/mtestmaster/mtestmaster.ino | 99 + .../firmware/test/mtestom/ModbusMaster.cpp | 932 +++ .../firmware/test/mtestom/ModbusMaster.h | 278 + .../firmware/test/mtestom/ModbusRtu.h | 1449 ++++ .../firmware/test/mtestom/OmronMx2.cpp | 1647 +++++ .../firmware/test/mtestom/OmronMx2.h | 497 ++ .../firmware/test/mtestom/mtestom.ino | 23 + .../firmware/test/mtestom/util/crc16.h | 88 + .../firmware/test/mtestom/util/word.h | 64 + .../firmware/test/next/next.ino | 151 + .../firmware/test/tcp/Mudbus.cpp | 236 + .../firmware/test/tcp/Mudbus.h | 96 + .../firmware/test/tcp/Mudbus/Keywords.txt | 25 + .../test/tcp/Mudbus/examples/Light/Light.pde | 77 + .../test/tcp/Mudbus/examples/Mb/Mb.pde | 49 + .../test/tcp/Mudbus/examples/Temp/Temp.pde | 63 + .../test/tcp/Mudbus/examples/Touch/Touch.pde | 65 + .../firmware/test/tcp/tcp.ino | 57 + .../firmware/test/test_RS485/DemoRS485.ino | 65 + .../test_RS485_protocol/RS485_protocol.cpp | 200 + .../test/test_RS485_protocol/RS485_protocol.h | 16 + .../firmware/tools/MbPoll_v9.4.0_cracked.exe | 3 + .../firmware/tools/MbSlave_v7.3.0_cracked.exe | 3 + .../media/gallery/IMG_20201219_152926.jpg | 3 + .../media/gallery/abb-irb-6600_1.jpg | 3 + .../media/gallery/abbstudio.png | 3 + .../media/gallery/perspective.JPG | 3 + .../media/gallery/preview.jpg | 3 + .../media/gallery/preview.jpg.jpg | 3 + extrusion/lydia-print-head-v1/parts.xlsx | Bin 0 -> 10640 bytes .../renderings/perspective.jpg | 3 + .../renderings/printhead_work_in_progress.jpg | 3 + .../renderings/proto-2.jpg | 3 + .../renderings/underneath.jpg | 3 + .../lydia-print-head-v1/research/Readme.md | 4 + .../at_200_3cm/at_100_warmstart_OmronE5.xlsx | Bin 0 -> 20840 bytes .../at_100_warmstart_OmronE5_150_to_200.xlsx | Bin 0 -> 15084 bytes .../research/at_200_3cm/at_e5.md | 46 + .../at_200_6cm/at_100_warmstart_OmronE5.xlsx | Bin 0 -> 60248 bytes .../research/at_200_6cm/at_e5.md | 27 + extrusion/lydia-print-head-v1/specs.xlsx | Bin 0 -> 5526 bytes .../vendor/plastichub/new.xls | Bin 0 -> 1380 bytes 216 files changed, 32337 insertions(+) create mode 100644 extrusion/lydia-print-head-v1/.gitignore create mode 100644 extrusion/lydia-print-head-v1/LICENSE create mode 100644 extrusion/lydia-print-head-v1/License.txt create mode 100644 extrusion/lydia-print-head-v1/README-2023.md create mode 100644 extrusion/lydia-print-head-v1/README.md create mode 100644 extrusion/lydia-print-head-v1/config.yaml create mode 100644 extrusion/lydia-print-head-v1/firmware/.gitignore create mode 100644 extrusion/lydia-print-head-v1/firmware/.travis.yml create mode 100644 extrusion/lydia-print-head-v1/firmware/.vscode/extensions.json create mode 100644 extrusion/lydia-print-head-v1/firmware/License.md create mode 100644 extrusion/lydia-print-head-v1/firmware/README.md create mode 100644 extrusion/lydia-print-head-v1/firmware/components.md create mode 100644 extrusion/lydia-print-head-v1/firmware/controllino/Controllino_HMI_Modbus_TCP_IP_and_RTU_iX_example.zip create mode 100644 extrusion/lydia-print-head-v1/firmware/documentation/control_pid.md create mode 100644 extrusion/lydia-print-head-v1/firmware/documentation/control_vfd.md create mode 100644 extrusion/lydia-print-head-v1/firmware/documentation/modbus_tcp.md create mode 100644 extrusion/lydia-print-head-v1/firmware/documentation/setPID100.jpg create mode 100644 extrusion/lydia-print-head-v1/firmware/documentation/setPID100_TCP.jpg create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/.gitignore create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Addon.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Addon.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/ModbusRtu.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronE5.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/OmronVFDModbus.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Readme.md create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/VFD.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/Version.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/Auto-Reverse.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/CartridgeFull.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/DipSwitch.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/DirectionSwitch.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/EnclosureSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorIdle.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorLoad.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorSpeed.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorTemperature.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/OperationModeSwitch.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/Power.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/Reset.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/Status.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/addons/TemperatureSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/app.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/app.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/app_addons.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/app_extruding.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/bridge.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/bridge.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/common/macros.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/common/timer.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/3pos.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/CurrentSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/OmronE5.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/OmronMX2.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/PhotoElectricSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/Proximity_Sensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/StatusLight.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/components/TemperatureSensor.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/config.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/config/known_16bit_timers.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/config_adv.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/config_validator.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/constants.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/docs/protocol.md create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/enums.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/features.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/firmware.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/package.json create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/serial.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/serial.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/types.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/user_config.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/util/crc16.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/util/word.h create mode 100644 extrusion/lydia-print-head-v1/firmware/firmware/version.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/.gitignore create mode 100644 extrusion/lydia-print-head-v1/firmware/node/.npmignore create mode 100644 extrusion/lydia-print-head-v1/firmware/node/LICENSE create mode 100644 extrusion/lydia-print-head-v1/firmware/node/README.md create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/_cli.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/_cli.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/format.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/format.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/formatter.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/formatter.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/index.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/index.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/log.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/log.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/main.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/main.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/paths.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/paths.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/types.js create mode 100644 extrusion/lydia-print-head-v1/firmware/node/build/types.js.map create mode 100644 extrusion/lydia-print-head-v1/firmware/node/package-lock.json create mode 100644 extrusion/lydia-print-head-v1/firmware/node/package.json create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/_cli.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/argv.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/commands/clean.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/commands/index.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/commands/pid/program.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/commands/tests.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/commands/watch.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/constants.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/format.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/formatter.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/index.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/array.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ci.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/enums.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/platform.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/primitives.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/readme.md create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/strings.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/types.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ve.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/content/front.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/content/html.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/content/md.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/content/tables.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/fs/index.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/git/log.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/index.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/lang/README.md create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/net/crawler.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/net/github.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/net/sheets.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/lib/process/index.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/log.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/main.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/os/context_menu/register_cli.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/output.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/paths.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/src/types.ts create mode 100644 extrusion/lydia-print-head-v1/firmware/node/tsconfig.json create mode 100644 extrusion/lydia-print-head-v1/firmware/node/tslint.json create mode 100644 extrusion/lydia-print-head-v1/firmware/platformio.ini create mode 100644 extrusion/lydia-print-head-v1/firmware/setup.md create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest/ModbusRtu.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest/mtest.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest2/ModbusRtu.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest2/OmronE5.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest2/PriUint64.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest2/macros.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtest2/mtest2.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestmaster/mtestmaster.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusRtu.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/mtestom.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/util/crc16.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/mtestom/util/word.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/next/next.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.h create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/Keywords.txt create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Light/Light.pde create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Mb/Mb.pde create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Temp/Temp.pde create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Touch/Touch.pde create mode 100644 extrusion/lydia-print-head-v1/firmware/test/tcp/tcp.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/test_RS485/DemoRS485.ino create mode 100644 extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.cpp create mode 100644 extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.h create mode 100644 extrusion/lydia-print-head-v1/firmware/tools/MbPoll_v9.4.0_cracked.exe create mode 100644 extrusion/lydia-print-head-v1/firmware/tools/MbSlave_v7.3.0_cracked.exe create mode 100644 extrusion/lydia-print-head-v1/media/gallery/IMG_20201219_152926.jpg create mode 100644 extrusion/lydia-print-head-v1/media/gallery/abb-irb-6600_1.jpg create mode 100644 extrusion/lydia-print-head-v1/media/gallery/abbstudio.png create mode 100644 extrusion/lydia-print-head-v1/media/gallery/perspective.JPG create mode 100644 extrusion/lydia-print-head-v1/media/gallery/preview.jpg create mode 100644 extrusion/lydia-print-head-v1/media/gallery/preview.jpg.jpg create mode 100644 extrusion/lydia-print-head-v1/parts.xlsx create mode 100644 extrusion/lydia-print-head-v1/renderings/perspective.jpg create mode 100644 extrusion/lydia-print-head-v1/renderings/printhead_work_in_progress.jpg create mode 100644 extrusion/lydia-print-head-v1/renderings/proto-2.jpg create mode 100644 extrusion/lydia-print-head-v1/renderings/underneath.jpg create mode 100644 extrusion/lydia-print-head-v1/research/Readme.md create mode 100644 extrusion/lydia-print-head-v1/research/at_200_3cm/at_100_warmstart_OmronE5.xlsx create mode 100644 extrusion/lydia-print-head-v1/research/at_200_3cm/at_100_warmstart_OmronE5_150_to_200.xlsx create mode 100644 extrusion/lydia-print-head-v1/research/at_200_3cm/at_e5.md create mode 100644 extrusion/lydia-print-head-v1/research/at_200_6cm/at_100_warmstart_OmronE5.xlsx create mode 100644 extrusion/lydia-print-head-v1/research/at_200_6cm/at_e5.md create mode 100644 extrusion/lydia-print-head-v1/specs.xlsx create mode 100644 extrusion/lydia-print-head-v1/vendor/plastichub/new.xls diff --git a/extrusion/lydia-print-head-v1/.gitignore b/extrusion/lydia-print-head-v1/.gitignore new file mode 100644 index 0000000..6704566 --- /dev/null +++ b/extrusion/lydia-print-head-v1/.gitignore @@ -0,0 +1,104 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port diff --git a/extrusion/lydia-print-head-v1/LICENSE b/extrusion/lydia-print-head-v1/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/extrusion/lydia-print-head-v1/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/extrusion/lydia-print-head-v1/License.txt b/extrusion/lydia-print-head-v1/License.txt new file mode 100644 index 0000000..4cb8437 --- /dev/null +++ b/extrusion/lydia-print-head-v1/License.txt @@ -0,0 +1,199 @@ +CERN Open Hardware Licence Version 2 - Permissive + + +Preamble + +CERN has developed this licence to promote collaboration among +hardware designers and to provide a legal tool which supports the +freedom to use, study, modify, share and distribute hardware designs +and products based on those designs. Version 2 of the CERN Open +Hardware Licence comes in three variants: this licence, CERN-OHL-P +(permissive); and two reciprocal licences: CERN-OHL-W (weakly +reciprocal) and CERN-OHL-S (strongly reciprocal). + +The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in +unmodified form only. + +Use of this Licence does not imply any endorsement by CERN of any +Licensor or their designs nor does it imply any involvement by CERN in +their development. + + +1 Definitions + + 1.1 'Licence' means this CERN-OHL-P. + + 1.2 'Source' means information such as design materials or digital + code which can be applied to Make or test a Product or to + prepare a Product for use, Conveyance or sale, regardless of its + medium or how it is expressed. It may include Notices. + + 1.3 'Covered Source' means Source that is explicitly made available + under this Licence. + + 1.4 'Product' means any device, component, work or physical object, + whether in finished or intermediate form, arising from the use, + application or processing of Covered Source. + + 1.5 'Make' means to create or configure something, whether by + manufacture, assembly, compiling, loading or applying Covered + Source or another Product or otherwise. + + 1.6 'Notice' means copyright, acknowledgement and trademark notices, + references to the location of any Notices, modification notices + (subsection 3.3(b)) and all notices that refer to this Licence + and to the disclaimer of warranties that are included in the + Covered Source. + + 1.7 'Licensee' or 'You' means any person exercising rights under + this Licence. + + 1.8 'Licensor' means a person who creates Source or modifies Covered + Source and subsequently Conveys the resulting Covered Source + under the terms and conditions of this Licence. A person may be + a Licensee and a Licensor at the same time. + + 1.9 'Convey' means to communicate to the public or distribute. + + +2 Applicability + + 2.1 This Licence governs the use, copying, modification, Conveying + of Covered Source and Products, and the Making of Products. By + exercising any right granted under this Licence, You irrevocably + accept these terms and conditions. + + 2.2 This Licence is granted by the Licensor directly to You, and + shall apply worldwide and without limitation in time. + + 2.3 You shall not attempt to restrict by contract or otherwise the + rights granted under this Licence to other Licensees. + + 2.4 This Licence is not intended to restrict fair use, fair dealing, + or any other similar right. + + +3 Copying, Modifying and Conveying Covered Source + + 3.1 You may copy and Convey verbatim copies of Covered Source, in + any medium, provided You retain all Notices. + + 3.2 You may modify Covered Source, other than Notices. + + You may only delete Notices if they are no longer applicable to + the corresponding Covered Source as modified by You and You may + add additional Notices applicable to Your modifications. + + 3.3 You may Convey modified Covered Source (with the effect that You + shall also become a Licensor) provided that You: + + a) retain Notices as required in subsection 3.2; and + + b) add a Notice to the modified Covered Source stating that You + have modified it, with the date and brief description of how + You have modified it. + + 3.4 You may Convey Covered Source or modified Covered Source under + licence terms which differ from the terms of this Licence + provided that: + + a) You comply at all times with subsection 3.3; and + + b) You provide a copy of this Licence to anyone to whom You + Convey Covered Source or modified Covered Source. + + +4 Making and Conveying Products + +You may Make Products, and/or Convey them, provided that You ensure +that the recipient of the Product has access to any Notices applicable +to the Product. + + +5 DISCLAIMER AND LIABILITY + + 5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products + are provided 'as is' and any express or implied warranties, + including, but not limited to, implied warranties of + merchantability, of satisfactory quality, non-infringement of + third party rights, and fitness for a particular purpose or use + are disclaimed in respect of any Source or Product to the + maximum extent permitted by law. The Licensor makes no + representation that any Source or Product does not or will not + infringe any patent, copyright, trade secret or other + proprietary right. The entire risk as to the use, quality, and + performance of any Source or Product shall be with You and not + the Licensor. This disclaimer of warranty is an essential part + of this Licence and a condition for the grant of any rights + granted under this Licence. + + 5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to + the maximum extent permitted by law, have no liability for + direct, indirect, special, incidental, consequential, exemplary, + punitive or other damages of any character including, without + limitation, procurement of substitute goods or services, loss of + use, data or profits, or business interruption, however caused + and on any theory of contract, warranty, tort (including + negligence), product liability or otherwise, arising in any way + in relation to the Covered Source, modified Covered Source + and/or the Making or Conveyance of a Product, even if advised of + the possibility of such damages, and You shall hold the + Licensor(s) free and harmless from any liability, costs, + damages, fees and expenses, including claims by third parties, + in relation to such use. + + +6 Patents + + 6.1 Subject to the terms and conditions of this Licence, each + Licensor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable (except as + stated in this section 6, or where terminated by the Licensor + for cause) patent license to Make, have Made, use, offer to + sell, sell, import, and otherwise transfer the Covered Source + and Products, where such licence applies only to those patent + claims licensable by such Licensor that are necessarily + infringed by exercising rights under the Covered Source as + Conveyed by that Licensor. + + 6.2 If You institute patent litigation against any entity (including + a cross-claim or counterclaim in a lawsuit) alleging that the + Covered Source or a Product constitutes direct or contributory + patent infringement, or You seek any declaration that a patent + licensed to You under this Licence is invalid or unenforceable + then any rights granted to You under this Licence shall + terminate as of the date such process is initiated. + + +7 General + + 7.1 If any provisions of this Licence are or subsequently become + invalid or unenforceable for any reason, the remaining + provisions shall remain effective. + + 7.2 You shall not use any of the name (including acronyms and + abbreviations), image, or logo by which the Licensor or CERN is + known, except where needed to comply with section 3, or where + the use is otherwise allowed by law. Any such permitted use + shall be factual and shall not be made so as to suggest any kind + of endorsement or implication of involvement by the Licensor or + its personnel. + + 7.3 CERN may publish updated versions and variants of this Licence + which it considers to be in the spirit of this version, but may + differ in detail to address new problems or concerns. New + versions will be published with a unique version number and a + variant identifier specifying the variant. If the Licensor has + specified that a given variant applies to the Covered Source + without specifying a version, You may treat that Covered Source + as being released under any version of the CERN-OHL with that + variant. If no variant is specified, the Covered Source shall be + treated as being released under CERN-OHL-S. The Licensor may + also specify that the Covered Source is subject to a specific + version of the CERN-OHL or any later version in which case You + may apply this or any later version of CERN-OHL with the same + variant identifier published by CERN. + + 7.4 This Licence shall not be enforceable except by a Licensor + acting as such, and third party beneficiary rights are + specifically excluded. diff --git a/extrusion/lydia-print-head-v1/README-2023.md b/extrusion/lydia-print-head-v1/README-2023.md new file mode 100644 index 0000000..e1c81e0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/README-2023.md @@ -0,0 +1,164 @@ +# Robot driven print systems + +***brief*** this is part of our work of PP OpenSource contributions, please check our [library](https://library.precious-plastic.org/) or our [main page](https://plastic-hub.com/products/) for more. + +The print head is a modification of [Lydia-v4](https://plastic-hub.com/products/lydia-v4.html) and aims at a generic solution for most of it´s components. + +**Status** : Confirmed & in progress, ETA Mid. of October + +## Todos + +* [x] Motor selection +* [ ] Firmware updates + + [x] Check TCP stack memory/CPU footprint on the ControllinoMega +* [x] Sensors / Audio, LED feedback (status, etc... ) +* [-] Support [RAPID - ABB robots, but uses customer spec](https://library.e.abb.com/public/688894b98123f87bc1257cc50044e809/Technical%20reference%20manual_RAPID_3HAC16581-1_revJ_en.pdf) + +### Todos Frederike@3dtreehouse + +* [x] Gantry mount plate, we need the size and locations of the mount holes. We'd need a test rig here. +* [x] Location and size of the cabinet, what on the control panel (controls & plugs) ? +* [x] We have to know how we share power source & ground among all digital circuits. Currently we're mostly at 24V and we need another source for 12V (fans, etc...) +* [x] Clarify RAPID ethernet connectivity +- [x] local setup / updates ? +- [x] screw tip / max. barrel length / screw mod +- [x] Fan control + +## Components + +### VFD + +* [x] [OMRON MX2 VFD](https://industrial.omron.es/es/products/3G3MX2-A2022-E) [BOM](https://es.wiautomation.com/omron/variadores-motores-proteccion-de-circuitos/3G3MX2A2022E?SubmitCurrency=1&id_currency=1&gclid=Cj0KCQjwy8f6BRC7ARIsAPIXOjgnGbRSd_DaX-o59wjtIBqI2mGllXWWOvjhSC1sPQgOTmGMvc7toncaAqejEALw_wcB) +* [ ] [3G3MX2-A2015-E](https://es.wiautomation.com/omron/variadores-motores-proteccion-de-circuitos/3G3MX2A2015E?utm_source=shopping_free&utm_medium=organic&utm_content=ES105728&gclid=Cj0KCQjwgYSTBhDKARIsAB8KuksIYzB6ATQnPv1r7SiF5Z1-2ySXLYHNzPDPoK95TaC2jr17-ueXM_8aAtZiEALw_wcB) + +### I/O Breakout + +- [x] Controllino - Mega as already mentioned a few times, adds 280 Euro +- [-] Arduino - Portena - Machine Control (https://www.arduino.cc/pro/hardware/product/portenta-machine-control) + + +### PID Controller + +* [x] ModBus capable PID controllers (3x) : [Omron - E5DC-B](https://industrial.omron.eu/en/products/E5DC-QX2ASM-002) - Din - Rail Module [WiAutomation - Out of stock](https://es.wiautomation.com/omron/plc-sistemas/E5DCQX2ASM002?SubmitCurrency=1&id_currency=1&gclid=Cj0KCQjwy8f6BRC7ARIsAPIXOjgWMeg-P2iN7wysDExpeHJHtEHAv06B2pKTz3DQlKjn67Al2K7YvvMaAs4IEALw_wcB) +* [x] ModBus capable PID controllers (2x) : [E5DC-CX2DBM-000 OMRON](https://industrial.omron.eu/en/products/E5DC-QX2ASM-002) - Din - Rail Module [WiAutomation](https://es.wiautomation.com/omron/productos-generales/E5DCCX2DBM000) + +### Motor + +* [ ] Motor [Cidepa](https://www.cidepa-sincron.com/en/25/cfm-parallel-shafts-gearboxes) - CFM-37.3 1/35 1 | 750W | 1.2SF + +### Noah OS Variant + +* [x] [PLC/Proxy for Aux, Sensors, Relays, etc... - CP1L-EM40DT1-D](http://www.ia.omron.com/products/family/1916/lineup.html), works well with [Omron NB NB3Q-TW01B](https://es.wiautomation.com/omron/hmi-pc-industriales/NB3QTW01B?SubmitCurrency=1&id_currency=1&gclid=CjwKCAjwh7H7BRBBEiwAPXjadt5G-53T-xJ8v5VmzdF5wUu8uHT1us-fzXU5913IwC3Kbz4cDg3jnBoC7g0QAvD_BwE) + +### Specs + +- Voltage : 220V|380V +- [ ] Max. 120Kg, first rev. might be around 60KG +- [ ] Controller cable length around 20 meter +- [ ] PID : +/- 5 degc tolerance, alarm/cooling outputs + +### Gantry Mount + +- [ ] : run static tests +* the tool flange is on p30, ([see also ATI Toolchanger - YuTu](https://www.youtube.com/watch?v=kDP-oofDn4w&feature=youtu.be)) +* [Why ATI Manual Tool Changers?](https://www.youtube.com/watch?v=N2Pr0tAsYkU&ab_channel=ATIIndustrialAutomation) +* [x] we need a laser cut barrel shield which holds the insulation material +* [x] on the barrel tip, we need some mounting possibilties for fans which are a little heavy as well +- [ ] ATI mount ([see ATI Tool changers @ 3dcentral](https://www.3dcontentcentral.com/syndication/supplier/ATI%20Industrial%20Automation/147.aspx)) + +### Firmware + +(https://www.controllino.biz/product/controllino-mega/) which gives us Ethernet and RS485. The board has been proven reliable and robust (ideal for prototyping). +- [-] VFD and PID control is mapped to Serial communication which might accept G-Code +- [x] VFD will be Omron-M2X series since we can use existing code. The VFD also supports Modbus (rather difficult) +- [ ] Internal registers/coils (custom PlasticHub Firmware) to Modbus rep + +![](./assets/lydia-print-head-logical.jpg) + +**[Diagram source](https://app.diagrams.net/#G1L7Prviy9U-2gpcZHm8Z5dj39gxDHd_V_)** + +### PID Controller + +* [x] We should go for [Omron E5-C](https://assets.omron.com/m/6f7cd0d93654a7a4/original/E5_C-Temperature-Controller-to-NB-Screen-Template-Tech-Guide.pdf) series which come with Modbus (consider EMI and cable length to the main controller) +* [x] Each PID will be exposed on the internal ModBus mapping +* There is currently a [custom PID controller](https://gitlab.com/plastichub/pid-controller) in development but as mentioned, it's unlikely that it sees the light before November. However, I can imagine we use sub-routines as they're avaiable + + +![](./assets/E5DC-B.jpg) + +### Barrel + +- [-] OD should be standard to EU heatbands +- [ ] Between Nozzel and barrel we might have some adaptery to exchange different screw tips, up to 10 cm +- [x] should have a mount near the nozzle +- [x] Barrel - motor flange should have some redunancy to enable different barrels + +---- + +### Hopper interface and Hopper + +* [x] should have a thread interface + +## Todos + +* [x] Investigate Omron - PID feedback to enable more control via M/G codes (purge, ...) +* [x] Investigate GCode to ROS mapping +* [x] Investigate screw tip machining, if lucky we get away with 4 axis +* [-] Test different VFD/PID checksum/parity settings with larger EMI around + +# References + +## ROS (cancelled) + +* [ROS - Github](https://github.com/ros-industrial) +* [ROS - GBRL - Github](https://github.com/openautomation/ROS-GRBL/wiki/GRBLtron) +* [ROS - Matlab|SimuLnk](https://www.mathworks.com/help/ros/ug/get-started-with-ros-in-simulink.html) +* [ROS Modbus - Wiki](http://wiki.ros.org/modbus) +* [ROS Modbus - PLC - Github](https://github.com/sonyccd/ros_plc_modbus) + +## ProfiBus + +* [Instructables Arduino](https://www.instructables.com/Profibus-DP-Communication-Between-Arduino-and-PLC/) +* [Arduino Forum](https://forum.arduino.cc/index.php?topic=458492.0) +- [Specs - PDF](https://forum.arduino.cc/index.php?topic=458492.0) + +## Related Projects + +* [Project Noah](https://gitlab.com/plastichub/noah) + +### Cable robotics + +- [The Cable-robot Analysis and Simulation Platform for Research (CASPR)](https://github.com/darwinlau/CASPR) +- [CUHK C3 Robotics Laboratory - Youtube](https://www.youtube.com/channel/UCxadDa3g1fUarP4ldAECtLQ) + +### Rapid - ABB + +* [Language specs and docs](./vendor/abb/2CSG445026D0201-ANR-LAN-Modbus-TCP-Protocol.pdf) +* [ABB - AC_800M - Protocols](./vendor/abb/3BSE035982-511_en_AC_800M_5.1_Feature_Pack_Communication_Protocols.pdf) + +### ABB 6600 + + + +- [ABB - IRC - 5 - Controller](https://new.abb.com/products/robotics/controllers/irc5) +- [ABB - IRC - 5 Manuals](./vendor/abb/IRC5_Operating manual_Trouble shooting_3HAC020738-001_revK_en.pdf) +- [ABB - IRC - Datasheet](./vendor/abb/IRC5-Industrial-Robot-Controller-data sheet.PDF) +- [ABB irb 6600 175-2.8](https://library.e.abb.com/public/560fa420555c2d8ac1257b4b0052112c/3HAC023933-001_rev1_en.pdf) +- [ABB irb 6600 175 - 2.8 - Local](./vendor/abb/IRB_6600_R_US 02_05.pdf) +- [ABB 660 - Specs](./vendor/abb/ABB-IR-6600-3HAC14064-1_revH_en_library.pdf) +- [ABB Robotstudio Downloads](https://new.abb.com/products/robotics/robotstudio/downloads) + +## Project links + +* [Project Slack channel](https://pporgworkspace.slack.com/archives/C01A8G36MRP) +* [Firmware](https://gitlab.com/plastichub/medusa/firmware) + + +## Follow ups + +- [ ] calc. energy overhead, per printed kg of plastic +- [ ] calc. min. invest to print obvious products +- [ ] investigate possible OS verticals +- [ ] develop generic system & functional design for v2.0 candidats, for 6D robots but also cable driven 3D systems +- [ ] check displacement options for segmented prints, (cheap floor track system?) +- [ ] check material remove options (see ATIish tool changers [YT](https://www.youtube.com/watch?v=EvsgCZyQuq0&ab_channel=ATIIndustrialAutomation)) diff --git a/extrusion/lydia-print-head-v1/README.md b/extrusion/lydia-print-head-v1/README.md new file mode 100644 index 0000000..bda7812 --- /dev/null +++ b/extrusion/lydia-print-head-v1/README.md @@ -0,0 +1,160 @@ +# Robot driven print systems + +***brief*** this is part of our work of PP OpenSource contributions, please check our [library](https://library.precious-plastic.org/) or our [main page](https://plastic-hub.com/products/) for more. + +The print head is a modification of [Lydia-v4](https://plastic-hub.com/products/lydia-v4.html) and aims at a generic solution for most of it´s components. + +**Status** : Confirmed & in progress, ETA Mid. of October + +## Todos + +* [x] Motor selection +* [ ] Firmware updates + + [x] Check TCP stack memory/CPU footprint on the ControllinoMega +* [x] Sensors / Audio, LED feedback (status, etc... ) +* [ ] Support [RAPID - ABB robots, but uses customer spec](https://library.e.abb.com/public/688894b98123f87bc1257cc50044e809/Technical%20reference%20manual_RAPID_3HAC16581-1_revJ_en.pdf) + +### Todos Frederike@3dtreehouse + +monday memo: + +* [ ] Gantry mount plate, we need the size and locations of the mount holes. We'd need a test rig here. +* [ ] Location and size of the cabinet, what on the control panel (controls & plugs) ? +* [x] We have to know how we share power source & ground among all digital circuits. Currently we're mostly at 24V and we need another source for 12V (fans, etc...) +* [ ] Clarify RAPID ethernet connectivity +- [ ] local setup / updates ? +- [ ] screw tip / max. barrel length / screw mod +- [ ] Fan control + +## Components + +* [x] [OMRON MX2 VFD](https://industrial.omron.es/es/products/3G3MX2-A2022-E) [BOM](https://es.wiautomation.com/omron/variadores-motores-proteccion-de-circuitos/3G3MX2A2022E?SubmitCurrency=1&id_currency=1&gclid=Cj0KCQjwy8f6BRC7ARIsAPIXOjgnGbRSd_DaX-o59wjtIBqI2mGllXWWOvjhSC1sPQgOTmGMvc7toncaAqejEALw_wcB) +* [ ] [3G3MX2-A2015-E](https://es.wiautomation.com/omron/variadores-motores-proteccion-de-circuitos/3G3MX2A2015E?utm_source=shopping_free&utm_medium=organic&utm_content=ES105728&gclid=Cj0KCQjwgYSTBhDKARIsAB8KuksIYzB6ATQnPv1r7SiF5Z1-2ySXLYHNzPDPoK95TaC2jr17-ueXM_8aAtZiEALw_wcB) +* [x] Controllino - Mega as already mentioned a few times, adds 280 Euro +* [x] a better motor and gearbox - MotoVario +* [ ] custom firmware development +* [x] ModBus capable PID controllers (3x) : [Omron - E5DC-B](https://industrial.omron.eu/en/products/E5DC-QX2ASM-002) - Din - Rail Module [BOM](https://es.wiautomation.com/omron/plc-sistemas/E5DCQX2ASM002?SubmitCurrency=1&id_currency=1&gclid=Cj0KCQjwy8f6BRC7ARIsAPIXOjgWMeg-P2iN7wysDExpeHJHtEHAv06B2pKTz3DQlKjn67Al2K7YvvMaAs4IEALw_wcB) +* [Hopper - Linear Solenoid](https://uk.farnell.com/guardian-electric/t12x19-c-24d/solenoid-pull-operation-24vdc/dp/1608128?gclid=EAIaIQobChMIn4Xa8LPz6wIVEuntCh2SvwcDEAkYASABEgK3uvD_BwE&gross_price=true&mckv=s7TWt3nIG_dc%7Cpcrid%7C459864482330%7Cplid%7C%7Ckword%7C%7Cmatch%7C%7Cslid%7C%7Cproduct%7C1608128%7Cpgrid%7C114464711464%7Cptaid%7Cpla-323868377918%7C&CMP=KNC-GUK-SHOPPING-SMEC-Whoops-Newstructure-31Aug2020) +* [ ] Motor [Cidepa](https://www.cidepa-sincron.com/en/25/cfm-parallel-shafts-gearboxes) - CFM-37.3 1/35 1 | 750W | 1.2SF + + +### Noah OS Variant + +* [x] [PLC/Proxy for Aux, Sensors, Relays, etc... - CP1L-EM40DT1-D](http://www.ia.omron.com/products/family/1916/lineup.html), works well with [Omron NB NB3Q-TW01B](https://es.wiautomation.com/omron/hmi-pc-industriales/NB3QTW01B?SubmitCurrency=1&id_currency=1&gclid=CjwKCAjwh7H7BRBBEiwAPXjadt5G-53T-xJ8v5VmzdF5wUu8uHT1us-fzXU5913IwC3Kbz4cDg3jnBoC7g0QAvD_BwE) + +### Specs + +- Voltage : 220V|380V +- [ ] Max. 120Kg, first rev. might be around 60KG +- [ ] Controller cable length around 20 meter +- [ ] PID : +/- 5 degc tolerance, alarm/cooling outputs + +### Gantry Mount + +- [ ] : run static tests +* the tool flange is on p30, ([see also ATI Toolchanger - YuTu](https://www.youtube.com/watch?v=kDP-oofDn4w&feature=youtu.be)) +* [Why ATI Manual Tool Changers?](https://www.youtube.com/watch?v=N2Pr0tAsYkU&ab_channel=ATIIndustrialAutomation) +* [x] we need a laser cut barrel shield which holds the insulation material +* [x] on the barrel tip, we need some mounting possibilties for fans which are a little heavy as well +- [ ] ATI mount ([see ATI Tool changers @ 3dcentral](https://www.3dcontentcentral.com/syndication/supplier/ATI%20Industrial%20Automation/147.aspx)) + +### Firmware + +(https://www.controllino.biz/product/controllino-mega/) which gives us Ethernet and RS485. The board has been proven reliable and robust (ideal for prototyping). +- [-] VFD and PID control is mapped to Serial communication which might accept G-Code +- [x] VFD will be Omron-M2X series since we can use existing code. The VFD also supports Modbus (rather difficult) +- [ ] Internal registers/coils (custom PlasticHub Firmware) to Modbus rep + +![](./assets/lydia-print-head-logical.jpg) + +**[Diagram source](https://app.diagrams.net/#G1L7Prviy9U-2gpcZHm8Z5dj39gxDHd_V_)** + +### PID Controller + +* [x] We should go for [Omron E5-C](https://assets.omron.com/m/6f7cd0d93654a7a4/original/E5_C-Temperature-Controller-to-NB-Screen-Template-Tech-Guide.pdf) series which come with Modbus (consider EMI and cable length to the main controller) +* [x] Each PID will be exposed on the internal ModBus mapping +* There is currently a [custom PID controller](https://gitlab.com/plastichub/pid-controller) in development but as mentioned, it's unlikely that it sees the light before November. However, I can imagine we use sub-routines as they're avaiable +* [-] We should create logging module as well a an API to set temperature profiles for different materials. The logging module will help analyzing different PID settings as well experimenting with barrel cooling (when overshooting becomes an issue). +* [-] Additional, we forward alarms for overshooting on the internal bus + +* **Changes** : Turns out that the [E5DC / E5DC-B](http://www.ia.omron.com/products/family/3242/) family is better choice. + +![](./assets/E5DC-B.jpg) + +### Barrel + +- [-] OD should be standard to EU heatbands +- [ ] Between Nozzel and barrel we might have some adaptery to exchange different screw tips, up to 10 cm +- [x] should have a mount near the nozzle +- [x] Barrel - motor flange should have some redunancy to enable different barrels + +---- + +### Hopper interface and Hopper + +* [x] should have a thread interface + +## Todos + +* [x] Investigate Omron - PID feedback to enable more control via M/G codes (purge, ...) +* [x] Investigate GCode to ROS mapping +* [x] Investigate screw tip machining, if lucky we get away with 4 axis +* [-] Test different VFD/PID checksum/parity settings with larger EMI around + +# References + +## ROS (cancelled) + +* [ROS - Github](https://github.com/ros-industrial) +* [ROS - GBRL - Github](https://github.com/openautomation/ROS-GRBL/wiki/GRBLtron) +* [ROS - Matlab|SimuLnk](https://www.mathworks.com/help/ros/ug/get-started-with-ros-in-simulink.html) +* [ROS Modbus - Wiki](http://wiki.ros.org/modbus) +* [ROS Modbus - PLC - Github](https://github.com/sonyccd/ros_plc_modbus) + +## ProfiBus + +* [Instructables Arduino](https://www.instructables.com/Profibus-DP-Communication-Between-Arduino-and-PLC/) +* [Arduino Forum](https://forum.arduino.cc/index.php?topic=458492.0) +- [Specs - PDF](https://forum.arduino.cc/index.php?topic=458492.0) + +## Related Projects + +* [Project Noah](https://gitlab.com/plastichub/noah) + +### Cable robotics + +- [The Cable-robot Analysis and Simulation Platform for Research (CASPR)](https://github.com/darwinlau/CASPR) +- [CUHK C3 Robotics Laboratory - Youtube](https://www.youtube.com/channel/UCxadDa3g1fUarP4ldAECtLQ) + + +### Rapid - ABB + +* [Language specs and docs](./vendor/abb/2CSG445026D0201-ANR-LAN-Modbus-TCP-Protocol.pdf) +* [ABB - AC_800M - Protocols](./vendor/abb/3BSE035982-511_en_AC_800M_5.1_Feature_Pack_Communication_Protocols.pdf) + +### ABB 6600 + + + +- [ABB - IRC - 5 - Controller](https://new.abb.com/products/robotics/controllers/irc5) +- [ABB - IRC - 5 Manuals](./vendor/abb/IRC5_Operating manual_Trouble shooting_3HAC020738-001_revK_en.pdf) +- [ABB - IRC - Datasheet](./vendor/abb/IRC5-Industrial-Robot-Controller-data sheet.PDF) +- [ABB irb 6600 175-2.8](https://library.e.abb.com/public/560fa420555c2d8ac1257b4b0052112c/3HAC023933-001_rev1_en.pdf) +- [ABB irb 6600 175 - 2.8 - Local](./vendor/abb/IRB_6600_R_US 02_05.pdf) +- [ABB 660 - Specs](./vendor/abb/ABB-IR-6600-3HAC14064-1_revH_en_library.pdf) +- [ABB Robotstudio Downloads](https://new.abb.com/products/robotics/robotstudio/downloads) + +## Project links + +* [Project Slack channel](https://pporgworkspace.slack.com/archives/C01A8G36MRP) +* [Firmware](https://gitlab.com/plastichub/medusa/firmware) + + +## Follow ups + +- [ ] calc. energy overhead, per printed kg of plastic +- [ ] calc. min. invest to print obvious products +- [ ] investigate possible OS verticals +- [ ] develop generic system & functional design for v2.0 candidats, for 6D robots but also cable driven 3D systems +- [ ] check displacement options for segmented prints, (cheap floor track system?) +- [ ] check material remove options (see ATIish tool changers [YT](https://www.youtube.com/watch?v=EvsgCZyQuq0&ab_channel=ATIIndustrialAutomation)) diff --git a/extrusion/lydia-print-head-v1/config.yaml b/extrusion/lydia-print-head-v1/config.yaml new file mode 100644 index 0000000..f2fdcdb --- /dev/null +++ b/extrusion/lydia-print-head-v1/config.yaml @@ -0,0 +1,12 @@ +product_id: lydia-print-head +tags: + - lydia-v4 + - v4 + - extrusion +has_spec: true +preview: ${product_preview} +buy: "mailto:sales@plastic-hub.com?subject=Inquiry%20-%20${slug}" +overview_drawing: true +teaser: "Powerful extruder for semi profesionall production. Comes with lots of extra safety electronics." +products: true +features: true \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/.gitignore b/extrusion/lydia-print-head-v1/firmware/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/extrusion/lydia-print-head-v1/firmware/.travis.yml b/extrusion/lydia-print-head-v1/firmware/.travis.yml new file mode 100644 index 0000000..7c486f1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/.travis.yml @@ -0,0 +1,67 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < https://docs.platformio.org/page/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < https://docs.platformio.org/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < https://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to be used as a library with examples. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/extrusion/lydia-print-head-v1/firmware/.vscode/extensions.json b/extrusion/lydia-print-head-v1/firmware/.vscode/extensions.json new file mode 100644 index 0000000..0f0d740 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} diff --git a/extrusion/lydia-print-head-v1/firmware/License.md b/extrusion/lydia-print-head-v1/firmware/License.md new file mode 100644 index 0000000..cba6f6a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/License.md @@ -0,0 +1,660 @@ +### GNU AFFERO GENERAL PUBLIC LICENSE + +Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains +free software for all its users. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + +A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + +The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + +An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing +under this license. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public +License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your +version supports such interaction) an opportunity to receive the +Corresponding Source of your version by providing access to the +Corresponding Source from a network server at no charge, through some +standard or customary means of facilitating copying of software. This +Corresponding Source shall include the Corresponding Source for any +work covered by version 3 of the GNU General Public License that is +incorporated pursuant to the following paragraph. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Affero General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever +published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for +the specific requirements. + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU AGPL, see . diff --git a/extrusion/lydia-print-head-v1/firmware/README.md b/extrusion/lydia-print-head-v1/firmware/README.md new file mode 100644 index 0000000..cc2aeaf --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/README.md @@ -0,0 +1,37 @@ +## General Purpose Extrusion Firmware + +### VFD + +#### Protocols + +- [x] Modbus, revA +- [x] Analog +- [ ] Profibus Mapping/Proxy +- [ ] RPM - PID + +#### Sensors + +- [x] Jamming, revA +- [ ] Visual feedback +- [ ] Sound + +### PIDs + +#### Protocols + +- [ ] Modbus +- [x] Analog +- [ ] Profibus Mapping/Proxy + +#### Sensors / Signals + +- [ ] Burnout +- [ ] Overshoot +- [x] AT finish +- [x] Overcurrent + +## Commons + +- [ ] Error dispatch, rev-C +- [ ] External LED Bank, rev-C +- [ ] HMI interface for Plastic Hub Studio (PP OS build), January diff --git a/extrusion/lydia-print-head-v1/firmware/components.md b/extrusion/lydia-print-head-v1/firmware/components.md new file mode 100644 index 0000000..6efebed --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/components.md @@ -0,0 +1,92 @@ +## Controllino - Mega + +- [Unit Testing](https://docs.platformio.org/en/latest/plus/unit-testing.html?utm_medium=piohome&utm_source=platformio) +- Semiphores : emulated, via ASM noops +- Memory: seems stable with modbus over ethernet + +### Omron MX2 + +- [Programmer](./firmware/OmronMx2.cpp#L460) + +### Omron - E5DC + +### Calibration + +- [TC calibration](https://www.tcdirect.co.uk/product_2_133_21#133/21/1) + +# Extrusion Firmware + +### Communication modes + +- [-] Custom Serial over RS485 (Extruza, 3dtreehouse) +- [- Standard Serial (Lydia-v4.5 - touchscreen/RPI) +- [- Pure RS485 - Slave|Master (In conjunction with injection addon) +- [-] Bluetooth + - [-] App template +- [ ] TCP + - [ ] Modbus (rev 1, base abstract/odel) + - [ ] ProfiBus (rev 2) + - [ ] DeviceNet (rev 1) +- [ ] Debug Serial (Always) + +### Protocol + +- [ ] Internal: add duplex for RS485 feedback +- [-] Add command queue lifecycle / state response +- [-] Handshake +- [- Checksum +- [ ] Broadcast (for bluetooth as well) +- [-] User space / reserved + +### Controls + +- [ ] Simple cycle control via logic/analog interface +- [ ] Controllino - Mini/Uno version (http://www.kuehlschrankdichtung.de/ | PVC temp and cycle time profile storage) + +### Modbus testing strategy for vendors + +- [ ] 1. test basics after unboxing +- [x] 2. programmer test +- [ ] 3. stress/flood test +- [ ] 4. EMI near (scope) +- [ ] 5. EMI long / cable test (serial debugging with scope) + +### PID / TC related + +- [-] determine barrel empty / full ratio/constant impact on PID readings +- [-] determine actual PID values, independent via calibration devices (see [./firmware/components](./firmware/components) for more) +- [ ] ramp times, window keeping +- [ ] test PVC/PFA [TC cables](https://www.tcdirect.co.uk/product_2_270_1) + + +## Components + +- [ ] Add HMI column +- [ ] Add register range +- [ ] Add wire labels + +| Component | ID | Qty | Volt | VA | Circuit | Powersource | Source File | +|------------------------------ |----------- |----- |------ |---------- |--------- |------------- |------------- | +| VFD | VDF | | | - | Motor | Extern | | +| PID | PID 1... | 3 | 24 | 1.5W | Digital | 24V-I | | +| Controllino - Master | CM | 1 | 24 | 5W | Digital | 24V-I | | +| Fans | FAN | 6 | 12 | ? | Cooling | 12V-I | | +| Height - Sensor | SHEIGHT | 2 | 24 | 100mA | Sensor | 24V | | +| SSR | SSR 1... | 4 | 220 | 100-300W | Heating | Extern | | +| Thermocouple - Extruder | TCE 1... | 4 | | | | | | +| Hopper-Selonid | AUXH 1... | 2 | 12 | ? | Aux | 12V-II | | +| Motor-RPM Feedback | SRPM 1..2 | 2 | 12 | ? | Sensor | 12V-I | | +| Power - Circuit - Contactors | CPO 1... | 3 | 220V | - | Switch | Extern | | +| Thermo - Couple - Motor | TCM | | | | | | | +| Audio - Alarm | AA 1... | 2 | 24V | ? | Feedback | 24V-II | | + +### Modbus design notes + +- each issued read/write has a corrosponding state flag register, eg: issued, proccessing, processed, error code, failure +- use coils only +- when in duplex, feedback channel provides command queue id with state flag, polling should be avoided +- avoid multi bytes/long/strings +- each category shall provide additional user register space + + + diff --git a/extrusion/lydia-print-head-v1/firmware/controllino/Controllino_HMI_Modbus_TCP_IP_and_RTU_iX_example.zip b/extrusion/lydia-print-head-v1/firmware/controllino/Controllino_HMI_Modbus_TCP_IP_and_RTU_iX_example.zip new file mode 100644 index 0000000..28a752c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/controllino/Controllino_HMI_Modbus_TCP_IP_and_RTU_iX_example.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a12f5f01b09498fc4ba07e6903fdbb0a7defd36cb77982f4bbf514a23b1d7a4d +size 23718437 diff --git a/extrusion/lydia-print-head-v1/firmware/documentation/control_pid.md b/extrusion/lydia-print-head-v1/firmware/documentation/control_pid.md new file mode 100644 index 0000000..ce3c9ae --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/documentation/control_pid.md @@ -0,0 +1,71 @@ +# PID Controllers + +The PID controller target temperatures can be set as follows: + +- PID 1 : Address 17 +- PID 2 : Address 18 +- PID 3 : Address 19 + +## Set Target temperature on PID 1 to 100Degc + +- **Address** : 17 (```0x11```) +- **Function** : 6 (WRITE_REGISTER) +- **Values** : 0 - Max Temperature (300) + +**TCP Sequence** + +```c +d2 8d 00 00 00 06 01 06 00 11 00 64 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 64 (100 Degc) + | | | + | | +----> Address (2 bytes) = 17 or 0x0011 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + +## Set Target temperature on PID 2to 100Degc + +- **Address** : 18 (```0x12```) +- **Function** : 6 (WRITE_REGISTER) +- **Values** : 0 - Max Temperature (300) + +**TCP Sequence** + +```c +d2 8d 00 00 00 06 01 06 00 12 00 64 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 64 (100 Degc) + | | | + | | +----> Address (2 bytes) = 18 or 0x0012 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + + +## Set Target temperature on PID 3 to 100Degc + +- **Address** : 18 (```0x13```) +- **Function** : 6 (WRITE_REGISTER) +- **Values** : 0 - Max Temperature (300) + +**TCP Sequence** + +```c +d2 8d 00 00 00 06 01 06 00 13 00 64 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 64 (100 Degc) + | | | + | | +----> Address (2 bytes) = 18 or 0x0013 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` diff --git a/extrusion/lydia-print-head-v1/firmware/documentation/control_vfd.md b/extrusion/lydia-print-head-v1/firmware/documentation/control_vfd.md new file mode 100644 index 0000000..bb1bf07 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/documentation/control_vfd.md @@ -0,0 +1,107 @@ +# VFD + +## Start & Stop + +Starts or stops the VFD, be aware that a target frequency has to be set as well + +- **Address** : 5 +- **Function** : 6 (WRITE_REGISTER) +- **Values** : + - **On** : 1 + - **Off** : 2 + +**TCP Sequence for Start** + +```c +d2 8d 00 00 00 06 01 06 00 05 00 01 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 01 + | | | + | | +----> Address (2 bytes) = 05 or 0x0005 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + +**TCP Sequence for Stop** + +```c +d2 8d 00 00 00 06 01 06 00 05 00 02 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 02 + | | | + | | +----> Address (2 bytes) = 05 or 0x0005 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + +## Frequency + +Sets the target frequency + +- **Address** : 6 +- **Function** : 6 (WRITE_REGISTER) +- **Values** : 1 - 50 + +**TCP Sequence for setting target frequency to 50 Hz** + +Remark : Please respect the max. main frequency setting on the inverter (settings) + +```c +d2 8d 00 00 00 06 01 06 00 05 00 32 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 32 (for 50Hz) + | | | + | | +----> Address (2 bytes) = 06 or 0x0006 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + +## Direction + +Sets the rotation + +- **Address** : 7 +- **Function** : 6 (WRITE_REGISTER) +- **Values** : + - **Forward** : 1 + - **Reverse** : 2 + - **Stop** : 3 + +**TCP Sequence for setting direction : Forward** + +```c +d2 8d 00 00 00 06 01 06 00 07 00 01 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 01 + | | | + | | +----> Address (2 bytes) = 07 or 0x0006 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` + +**TCP Sequence for setting direction : Reverse** + +```c +d2 8d 00 00 00 06 01 06 00 07 00 02 + + + + + + | | | | + | | | +----> Value (2 bytes) = 00 02 + | | | + | | +----> Address (2 bytes) = 07 or 0x0006 + | | + | +--> Function Code (Always 6) + | + +--> Slave - ID (Always 1) +``` diff --git a/extrusion/lydia-print-head-v1/firmware/documentation/modbus_tcp.md b/extrusion/lydia-print-head-v1/firmware/documentation/modbus_tcp.md new file mode 100644 index 0000000..739a73e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/documentation/modbus_tcp.md @@ -0,0 +1,25 @@ +# Omron VFD Registers + +### State + +The VFD's state is written into address 4 (defined in enums.h#MB_R_VFD_STATE) + +**Values** + +``` c +#define OMRON_STATE_ACCELERATING 4 +#define OMRON_STATE_DECELERATING 2 +#define OMRON_STATE_RUNNING 3 +#define OMRON_STATE_STOPPED 1 +``` + +### Status + +The VFD's status is written into address 3 (defined in enums.h#MB_R_VFD_STATUS) + +**Values** + +``` c +#define OMRON_STATUS_STOPPED 2 +#define OMRON_STATUS_RUNNING 0 +``` diff --git a/extrusion/lydia-print-head-v1/firmware/documentation/setPID100.jpg b/extrusion/lydia-print-head-v1/firmware/documentation/setPID100.jpg new file mode 100644 index 0000000..9d3ae72 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/documentation/setPID100.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dd88878f1f4cad18becf12aa2a88a94f6ded6fa9f70166fcc214fd9879c3c18 +size 34126 diff --git a/extrusion/lydia-print-head-v1/firmware/documentation/setPID100_TCP.jpg b/extrusion/lydia-print-head-v1/firmware/documentation/setPID100_TCP.jpg new file mode 100644 index 0000000..992b156 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/documentation/setPID100_TCP.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ad572f01aabdbd76ac40638c1e8dfa263ae8fa750a0cb4a938c631d95e6a754 +size 55402 diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/.gitignore b/extrusion/lydia-print-head-v1/firmware/firmware/.gitignore new file mode 100644 index 0000000..5b8b417 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/.gitignore @@ -0,0 +1,5 @@ +Debug +src +__vm +.vs +node_modules diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Addon.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/Addon.cpp new file mode 100644 index 0000000..a16d5f3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Addon.cpp @@ -0,0 +1,49 @@ +#include "Addon.h" +#include +#include +#include + +bool Addon::hasFlag(uchar flag) +{ + return TEST(flags, flag); +} +void Addon::setFlag(uchar flag) +{ + flags = SBI(flags, flag); +} +void Addon::clearFlag(uchar flag) +{ + CBI(flags, flag); +} +short Addon::debug(Stream *stream) +{ +} +short Addon::info(Stream *stream) +{ +} +void Addon::enable() +{ + this->clearFlag(DISABLED); +} +void Addon::disable() +{ + this->setFlag(DISABLED); +} +bool Addon::enabled() +{ + return this->hasFlag(DISABLED); +} + +Addon *byId(Addons addons, uchar id) +{ + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->id == id) + { + return addon; + } + } + return NULL; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Addon.h b/extrusion/lydia-print-head-v1/firmware/firmware/Addon.h new file mode 100644 index 0000000..66c60d5 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Addon.h @@ -0,0 +1,69 @@ +#ifndef ADDON_H +#define ADDON_H + +#include +#include + +#include "enums.h" +#include "common/macros.h" +#include "common/timer.h" + +#define ADDON_NORMAL 1 << LOOP | 1 << INFO | 1 << SETUP +#ifdef HAS_STATES +#define ADDON_STATED ADDON_NORMAL | 1 << STATE +#else +#define ADDON_STATED ADDON_NORMAL +#endif + +class Stream; +class App; + +class Addon +{ + +public: + const String name; + const short id; + millis_t now; + millis_t last; + millis_t dt; + Addon(String _name, short _id) : name(_name), + id(_id), + now(0), + last(0), + dt(0) + { + flags = ADDON_NORMAL; + } + + Addon(String _name, short _id, short _flags) : name(_name), + id(_id), + flags(_flags) + { + } + + virtual short debug(Stream *stream); + virtual short info(Stream *stream); + virtual short setup(){}; + virtual short loop(){}; + virtual short ok(){}; + virtual bool pause(){}; + virtual bool resume(){}; + virtual bool destroy(){}; + virtual String state() { return ""; }; + + int flags; + void setFlag(uchar flag); + bool hasFlag(uchar flag); + void clearFlag(uchar flag); + void enable(); + void disable(); + bool enabled(); +}; + +typedef Vector Addons; +Addon *byId(Addons addons, uchar id); +typedef short (Addon::*AddonFnPtr)(short); +typedef short (Addon::*AddonRxFn)(short size, uint8_t rxBuffer[]); + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.cpp new file mode 100644 index 0000000..a355252 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.cpp @@ -0,0 +1,408 @@ +#include +#include "./Addon.h" +#include "ModbusRtu.h" +#include "ModbusBridge.h" +#include "config.h" + +#include +#include + +#define RS485Serial 3 + +#define MasterModbusAdd 0 +#define SlaveModbusAdd 1 + +Modbus master(MasterModbusAdd, RS485Serial); + +modbus_t ModbusQuery[1]; +uint16_t ModbusSlaveRegisters[8]; +millis_t WaitingTime; + +int _state = IDLE; + +bool debugQuery = true; + +void ModbusBridge::setDebugSend(bool debug) +{ + master.debugSend = debug; +} + +Modbus *ModbusBridge::modbus() +{ + return &master; +} +// Modbus TCP +short ModbusBridge::setup() +{ + master.begin(MODBUS_RS485_BAUDRATE, MODBUS_RS485_PORT); + master.setTimeOut(MODBUS_RS485_TIMEOUT); + WaitingTime = millis() + nextWaitingTime; + _state = IDLE; + + Ethernet.begin(MB_MAC, MB_IP, MB_GATEWAY, MB_SUBNET); + + for (uchar i = 0; i < MAX_QUERY_BUFFER; i++) + { + queries[i].reset(); + queries[i].id = i; + } + + for (uchar i = 0; i < 50; i++) + { + mb->R[i] = MODBUS_TCP_DEFAULT_REGISTER_VALUE; + } + + startTS = millis(); +} + +Query *ModbusBridge::nextByPrio(uchar state, int prio) +{ + + Query *oldest; + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (!oldest) + { + oldest = &queries[i]; + } + + if (queries[i].state == state && queries[i].prio == prio) + { + oldest = &queries[i]; + } + } + return oldest; +} + +bool didm = false; +Query *ModbusBridge::nextQueryByState(uchar state = DONE, int owner = -1) +{ + + if (owner > 0) + { + Query *q = nextQueryByOwner(state, owner); + if (q != NULL) + { + return q; + } + } + + millis_t t = millis(); + Query *oldest = NULL; + + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (queries[i].state == state) + { + + if (_state == QUEUED && t - queries[i].ts > 1000 * 10) + { + queries[i].reset(); + continue; + } + + if (_state == PROCESSING && t - queries[i].ts > 1000 * 10) + { + queries[i].reset(); + continue; + } + + if (queries[i].ts == 0) + { + queries[i].ts = t; + } + + if (queries[i].prio != MB_QUERY_TYPE_CMD && t - queries[i].ts > 1000) + { + return &queries[i]; + } + + if (!oldest) + { + oldest = &queries[i]; + } + + if (queries[i].ts > oldest->ts) + { + oldest = &queries[i]; + } + } + } + return oldest; +} + +Query *ModbusBridge::nextQueryByOwner(uchar state = DONE, int owner = -1) +{ + millis_t t = millis(); + Query *oldest = NULL; + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (queries[i].state == state && queries[i].owner == owner) + { + + if (_state == QUEUED && t - queries[i].ts > 1000 * 10) + { + queries[i].reset(); + continue; + } + + if (_state == PROCESSING && t - queries[i].ts > 1000 * 10) + { + queries[i].reset(); + Serial.println("reset processing"); + continue; + } + if (queries[i].ts == 0) + { + queries[i].ts = t; + } + + if (queries[i].prio == MB_QUERY_TYPE_CMD && t - queries[i].ts > 300) + { + return &queries[i]; + } + + if (!oldest) + { + oldest = &queries[i]; + } + + if (queries[i].ts > oldest->ts) + { + oldest = &queries[i]; + } + } + } + return oldest; +} + +Query *ModbusBridge::nextSame(uchar state, short slave, int addr, short fn, int value) +{ + millis_t t = millis(); + Query *oldest; + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (queries[i].state == state) + { + Query *q = &queries[i]; + if (q->addr == addr && q->fn == fn && q->value == value && q->slave == slave) + { + if (!oldest) + { + oldest = &queries[i]; + } + if (queries[i].ts > oldest->ts) + { + oldest = &queries[i]; + } + } + } + } + return oldest; +} +int ModbusBridge::numSame(uchar state, short slave, int addr, short fn, int value) +{ + int num = 0; + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (queries[i].state == state) + { + Query *q = &queries[i]; + if (q->addr == addr && q->fn == fn && q->value == value && q->slave == slave) + { + num++; + } + } + } + return num; +} +int ModbusBridge::numByState(int state = DONE) +{ + int num = 0; + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + if (queries[i].state == state) + { + num++; + } + } + return num; +} +void ModbusBridge::print() +{ + Serial.print("----- Queries : --- "); + Serial.print("Proccessing : "); + Serial.print(numByState(PROCESSING)); + Serial.print(" | QUEUED : "); + Serial.print(numByState(QUEUED)); + Serial.print(" | DONE: "); + Serial.print(numByState(DONE)); + + Serial.print(" | ADDR: "); + Serial.print(addr); + Serial.print(" | FN: "); + Serial.print(fn); + Serial.print(" | NOW : "); + Serial.print(millis()); + + Serial.print("-----\n"); + + for (int i = 0; i < MAX_QUERY_BUFFER; i++) + { + Serial.print(" - "); + Serial.print(queries[i].id); + Serial.print(". \t "); + queries[i].print(); + Serial.print("\n"); + } +} +short ModbusBridge::qstate() +{ + return _state; +} +short ModbusBridge::loop() +{ + loop_test(); + mb->Run(); + if (mb->R[9]) + { + print(); + mb->R[9] = 0; + } +} + +short ModbusBridge::query(int slave, short function, long start, int coils, Addon *_addon, AddonFnPtr _mPtr) +{ + if (_state != IDLE) + { + return WAITING; + } + + addr = 0; + id = slave; + fn = function; + addr = start; + nb = coils; + owner = _addon; + updatedPtr = _mPtr; + + if (debugQuery) + { + Serial.print("\n --------------Modbus QUERY --------- SLAVE : "); + Serial.print(id); + Serial.print(" | FN : "); + Serial.print(fn); + Serial.print(" | NB : "); + Serial.print(coils); + Serial.print(" | Address : "); + Serial.print(addr, HEX); + + Serial.print(" | STATE : "); + Serial.print(_state); + + Serial.print(" | OWNER : "); + Serial.println(owner->id); + Serial.println(" \n "); + } + + _state = WAITING; + + return E_OK; +} + +short ModbusBridge::loop_test() +{ + switch (_state) + { + + case IDLE: + { + return; + } + + case WAITING: + { + if (millis() > WaitingTime) + { + _state++; // set to query state + } + break; + } + case QUERY: + { + ModbusQuery[0].u8id = id; // slave address + ModbusQuery[0].u8fct = fn; // function code (this one is registers read) + ModbusQuery[0].u16RegAdd = addr; // start address in slave + ModbusQuery[0].u16CoilsNo = nb; // number of elements (coils or registers) to read + ModbusQuery[0].au16reg = ModbusSlaveRegisters; // pointer to a memory array in the CONTROLLINO + master.query(ModbusQuery[0]); // send query (only once) + _state++; // set to RESPONSE + break; + } + case RESPONSE: + { + master.poll(); // check incoming messages + if (master.getState() == COM_IDLE) + { + + int errors = master.getErrCnt(); + if (errors) + { + + if (owner && onError != NULL) + { + (owner->*onError)(master.getLastError()); + master.clearError(); + } + else + { + Serial.print("ModbusBridge:: Have Errors : "); + Serial.println(master.getLastError()); + } + _state = IDLE; + return; + } + + long onMessageError = 0; + if (owner && onMessage) + { + onMessageError = (owner->*onMessage)(master.rxSize, master.rxBuffer); + } + + short ret = (owner->*updatedPtr)(onMessageError); + WaitingTime = millis() + nextWaitingTime; + + if (TEST(debug_flags, DEBUG_RECEIVE) && onMessageError == ERROR_OK) + { + } + + /* + Serial.print("--------------Modbus RESPONSE --------- FN : "); + Serial.print(fn); + Serial.print(" | NB : "); + Serial.print(nb); + + Serial.print(" | SLAVE : "); + Serial.print(id); + + Serial.print(" | Address : "); + Serial.println(addr); + */ + + _state = IDLE; + } + break; + } + } +} + +short ModbusBridge::debug(Stream *stream) +{ + // *stream << this->name << ":"; + return false; +} + +short ModbusBridge::info(Stream *stream) +{ + // *stream << this->name << "\n\t"; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.h b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.h new file mode 100644 index 0000000..3923fda --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusBridge.h @@ -0,0 +1,172 @@ +#ifndef MODBUS_BRIDGE_H +#define MODBUS_BRIDGE_H + +#include "Addon.h" +#include +#include "Mudbus.h" + +#define MAX_QUERY_BUFFER 20 +class Modbus; + +// query struct +class Query +{ +public: + int slave; + long addr; + long value; + int state; + long fn; + millis_t ts; + int id; + int prio; + int owner; + + long printNumber(int number) + { + Serial.print(" "); + int spaces = 0; + if (number < 1000) + { + spaces = 1; + } + if (number < 100) + { + spaces = 2; + } + if (number < 10) + { + spaces = 3; + } + for (int i = 0; i < spaces; i++) + { + Serial.print(" "); + } + Serial.print(number); + } + + void print() + { + Serial.print("SLAVE: "); + Serial.print(slave); + Serial.print(" \t | Address: "); + // Serial.print(addr, HEX); + printNumber(addr); + Serial.print(" \t | VALUE: "); + printNumber(value); + Serial.print(" \t | STATE "); + if (state == DONE) + { + Serial.print("Done "); + } + if (state == PROCESSING) + { + Serial.print("Processsing"); + } + if (state == QUEUED) + { + Serial.print("Queued "); + } + Serial.print(" \t | FN: "); + Serial.print(fn); + Serial.print(" \t | PRIO: "); + Serial.print(prio); + Serial.print(" | "); + + Serial.print(" \t | OWNER: "); + Serial.print(owner); + Serial.print(" | "); + } + Query() + { + reset(); + } + void reset() + { + state = DONE; + fn = 0; + ts = 0; + value = 0; + slave = 0; + addr = 0; + prio = 0; + owner = 0; + } +}; + +class ModbusBridge : public Addon +{ + +public: + ModbusBridge() : Addon("ModbusBridge", 50, ADDON_NORMAL), + mb(new Mudbus()) + { + setFlag(DEBUG); + debug_flags = 0; + debug_flags = 1 << DEBUG_RECEIVE; + nextWaitingTime = 1000; + } + + uint16_t ModbusSlaveRegisters[8]; + + // Addon std implementation + short debug(Stream *stream); + short info(Stream *stream); + short setup(); + short loop(); + short loop_test(); + + // current query + short id; + short fn; + short addr; + int nb; + + long debug_flags; + short queryState(); + short query(int slave, short function, long start, int coils, Addon *_addon, AddonFnPtr _mPtr); + short qstate(); + + // 0x6 callback + AddonFnPtr updatedPtr; + // on Error + AddonFnPtr onError; + + // on RawMessage + AddonRxFn onMessage; + + // callback owner + Addon *owner; + + int nextWaitingTime; + + Mudbus *mb; + + // Modbus query / commands + Query *nextQueryByState(uchar state = DONE, int owner = -1); + Query *nextQueryByOwner(uchar state = DONE, int owner = -1); + + Query *nextByPrio(uchar state, int prio); + + Query *nextSame(uchar state, short slave, int addr, short fn, int value); + + int numSame(uchar state, short slave, int addr, short fn, int value); + int numByState(int state); + void print(); + enum FLAGS + { + DEBUG_RECEIVE = 1, + DEBUG_SEND = 2, + }; + + Query queries[MAX_QUERY_BUFFER]; + millis_t startTS; + Modbus *modbus(); + void setDebugSend(bool debug); + //////////////////////////////////////////////////////////////// + // + // TCP Gateway + // +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/ModbusRtu.h b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusRtu.h new file mode 100644 index 0000000..3f40849 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/ModbusRtu.h @@ -0,0 +1,1524 @@ +/** + * @file ModbusRtu.h + * @version 1.21 (modified by CONTROLLINO team) + * @date 2016.02.21 (2017.03.30) + * @author Samuel Marco i Armengol (Thank you, Samuel!) + * @contact sammarcoarmengol@gmail.com + * @contribution Helium6072 + * + * @description + * Arduino library for communicating with Modbus devices + * over RS232/USB/485 via RTU protocol. + * + * Further information: + * http://modbus.org/ + * http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf + * + * @license + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version + * 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @defgroup setup Modbus Object Instantiation/Initialization + * @defgroup loop Modbus Object Management + * @defgroup buffer Modbus Buffer Management + * @defgroup discrete Modbus Function Codes for Discrete Coils/Inputs + * @defgroup register Modbus Function Codes for Holding/Input Registers + * + */ + +#include +#include "Arduino.h" +#include "Print.h" +#include +#include "enums.h" + +#define RS485_PIN_DE 0b01000000 +#define RS485_PIN_RE 0b00100000 +#define RS485_DIR_REG DDRJ +#define RS485_PORT_REG PORTJ +#define RS485_CLEAR_DE RS485_PORT_REG &= ~RS485_PIN_DE +#define RS485_CLEAR_RE RS485_PORT_REG &= ~RS485_PIN_RE +#define RS485_SET_DE RS485_PORT_REG |= RS485_PIN_DE +#define RS485_SET_RE RS485_PORT_REG |= RS485_PIN_RE + +#define T35 5 +#define MAX_BUFFER 64 //!< maximum size for the communication buffer in bytes + +/** + * @struct modbus_t + * @brief + * Master query structure: + * This includes all the necessary fields to make the Master generate a Modbus query. + * A Master may keep several of these structures and send them cyclically or + * use them according to program needs. + */ +typedef struct +{ + uint8_t u8id; /*!< Slave address between 1 and 247. 0 means broadcast */ + uint8_t u8fct; /*!< Function code: 1, 2, 3, 4, 5, 6, 15 or 16 */ + uint16_t u16RegAdd; /*!< Address of the first register to access at slave/s */ + uint16_t u16CoilsNo; /*!< Number of coils or registers to access */ + uint16_t *au16reg; /*!< Pointer to memory image in master */ + uint8_t flags; + bool coilValue; + +} modbus_t; + +enum +{ + RESPONSE_SIZE = 6, + EXCEPTION_SIZE = 3, + CHECKSUM_SIZE = 2 +}; + +/** + * @enum MESSAGE + * @brief + * Indexes to telegram frame positions + */ +enum MESSAGE +{ + ID = 0, //!< ID field + FUNC, //!< Function code position + ADD_HI, //!< Address high byte + ADD_LO, //!< Address low byte + NB_HI, //!< Number of coils or registers high byte + NB_LO, //!< Number of coils or registers low byte + BYTE_CNT //!< byte counter +}; + +/** + * @enum MB_FC + * @brief + * Modbus function codes summary. + * These are the implement function codes either for Master or for Slave. + * + * @see also fctsupported + * @see also modbus_t + */ +enum COM_STATES +{ + COM_IDLE = 0, + COM_WAITING = 1 +}; + +enum ERR_LIST +{ + ERR_NOT_MASTER = -1, + ERR_POLLING = -2, + ERR_BUFF_OVERFLOW = -3, + ERR_BAD_CRC = -4, + ERR_EXCEPTION = -5 +}; + +enum +{ + NO_REPLY = 255, + EXC_FUNC_CODE = 1, + EXC_ADDR_RANGE = 2, + EXC_REGS_QUANT = 3, + EXC_EXECUTE = 4 +}; + +const unsigned char fctsupported[] = + { + MB_FC_READ_COILS, + MB_FC_READ_DISCRETE_INPUT, + MB_FC_READ_REGISTERS, + MB_FC_READ_INPUT_REGISTER, + MB_FC_WRITE_COIL, + MB_FC_WRITE_REGISTER, + MB_FC_WRITE_MULTIPLE_COILS, + MB_FC_WRITE_MULTIPLE_REGISTERS}; + +/** + * @class Modbus + * @brief + * Arduino class library for communicating with Modbus devices over + * USB/RS232/485 (via RTU protocol). + */ +class Modbus +{ +private: + HardwareSerial *port; //!< Pointer to Serial class object + SoftwareSerial *softPort; //!< Pointer to SoftwareSerial class object + uint8_t u8id; //!< 0=master, 1..247=slave number + uint8_t u8serno; //!< serial port: 0-Serial, 1..3-Serial1..Serial3; 4: use software serial + uint8_t u8txenpin; //!< flow control pin: 0=USB or RS-232 mode, >0=RS-485 mode + uint8_t u8state; + uint8_t u8lastError; + uint8_t au8Buffer[MAX_BUFFER]; + uint8_t u8BufferSize; + uint8_t u8lastRec; + uint16_t *au16regs; + uint16_t u16InCnt, u16OutCnt, u16errCnt; + uint16_t u16timeOut; + uint32_t u32time, u32timeOut; + uint8_t u8regsize; + + void init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + void init(uint8_t u8id); + void sendTxBuffer(); + int8_t getRxBuffer(); + uint16_t calcCRC(uint8_t u8length); + uint8_t validateAnswer(); + uint8_t validateRequest(); + modbus_t *currentQuery; + void get_FC1(); + void get_FC3(); + int8_t process_FC1(uint16_t *regs, uint8_t u8size); + int8_t process_FC3(uint16_t *regs, uint8_t u8size); + int8_t process_FC5(uint16_t *regs, uint8_t u8size); + int8_t process_FC6(uint16_t *regs, uint8_t u8size); + int8_t process_FC15(uint16_t *regs, uint8_t u8size); + int8_t process_FC16(uint16_t *regs, uint8_t u8size); + void buildException(uint8_t u8exception); // build exception message + +public: + Modbus(); + Modbus(uint8_t u8id, uint8_t u8serno); + Modbus(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + Modbus(uint8_t u8id); + void begin(long u32speed); + void begin(SoftwareSerial *sPort, long u32speed); + void begin(long u32speed, uint8_t u8config); + void begin(); + void setTimeOut(uint16_t u16timeout); //!begin(u32speed); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +bool Modbus::isLocked() +{ + return currentQuery && (currentQuery->flags == QUERY_STATE::QUEUED || currentQuery->flags == QUERY_STATE::SENT); +} + +/** + * @brief + * Initialize class object. + * + * Sets up the software serial port using specified baud rate and SoftwareSerial object. + * Call once class has been instantiated, typically within setup(). + * + * @param speed *softPort, pointer to SoftwareSerial class object + * @param speed baud rate, in standard increments (300..115200) + * @ingroup setup + */ +void Modbus::begin(SoftwareSerial *sPort, long u32speed) +{ + + softPort = sPort; + + softPort->begin(u32speed); + + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (softPort->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the serial port using specified baud rate. + * Call once class has been instantiated, typically within setup(). + * + * @see http://arduino.cc/en/Serial/Begin#.Uy4CJ6aKlHY + * @param speed baud rate, in standard increments (300..115200) + * @param config data frame settings (data length, parity and stop bits) + * @ingroup setup + */ +void Modbus::begin(long u32speed, uint8_t u8config) +{ + + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + port = &Serial1; + break; +#endif + +#if defined(UBRR2H) + case 2: + port = &Serial2; + break; +#endif + +#if defined(UBRR3H) + case 3: + port = &Serial3; + break; +#endif + case 0: + default: + port = &Serial; + break; + } + + port->begin(u32speed, u8config); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + // pinMode(u8txenpin, OUTPUT); + // digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize default class object. + * + * Sets up the serial port using 19200 baud. + * Call once class has been instantiated, typically within setup(). + * + * @overload Modbus::begin(uint16_t u16BaudRate) + * @ingroup setup + */ +void Modbus::begin() +{ + begin(19200); +} + +/** + * @brief + * Method to write a new slave ID address + * + * @param u8id new slave address between 1 and 247 + * @ingroup setup + */ +void Modbus::setID(uint8_t u8id) +{ + if ((u8id != 0) && (u8id <= 247)) + { + this->u8id = u8id; + } +} + +/** + * @brief + * Method to read current slave ID address + * + * @return u8id current slave address between 1 and 247 + * @ingroup setup + */ +uint8_t Modbus::getID() +{ + return this->u8id; +} + +/** + * @brief + * Initialize time-out parameter + * + * Call once class has been instantiated, typically within setup(). + * The time-out timer is reset each time that there is a successful communication + * between Master and Slave. It works for both. + * + * @param time-out value (ms) + * @ingroup setup + */ +void Modbus::setTimeOut(uint16_t u16timeOut) +{ + this->u16timeOut = u16timeOut; +} + +/** + * @brief + * Return communication Watchdog state. + * It could be usefull to reset outputs if the watchdog is fired. + * + * @return TRUE if millis() > u32timeOut + * @ingroup loop + */ +boolean Modbus::getTimeOutState() +{ + return (millis() > u32timeOut); +} + +/** + * @brief + * Get input messages counter value + * This can be useful to diagnose communication + * + * @return input messages counter + * @ingroup buffer + */ +uint16_t Modbus::getInCnt() +{ + return u16InCnt; +} + +/** + * @brief + * Get transmitted messages counter value + * This can be useful to diagnose communication + * + * @return transmitted messages counter + * @ingroup buffer + */ +uint16_t Modbus::getOutCnt() +{ + return u16OutCnt; +} + +/** + * @brief + * Get errors counter value + * This can be useful to diagnose communication + * + * @return errors counter + * @ingroup buffer + */ +uint16_t Modbus::getErrCnt() +{ + return u16errCnt; +} + +void Modbus::clearError() +{ + u16errCnt = 0; +} + +/** + * Get modbus master state + * + * @return = 0 IDLE, = 1 WAITING FOR ANSWER + * @ingroup buffer + */ +uint8_t Modbus::getState() +{ + return u8state; +} + +/** + * Get the last error in the protocol processor + * + * @returnreturn NO_REPLY = 255 Time-out + * @return EXC_FUNC_CODE = 1 Function code not available + * @return EXC_ADDR_RANGE = 2 Address beyond available space for Modbus registers + * @return EXC_REGS_QUANT = 3 Coils or registers number beyond the available space + * @ingroup buffer + */ +uint8_t Modbus::getLastError() +{ + return u8lastError; +} + +/** + * @brief + * *** Only Modbus Master *** + * Generate a query to an slave with a modbus_t telegram structure + * The Master must be in COM_IDLE mode. After it, its state would be COM_WAITING. + * This method has to be called only in loop() section. + * + * @see modbus_t + * @param modbus_t modbus telegram structure (id, fct, ...) + * @ingroup loop + * @todo finish function 15 + */ +int8_t Modbus::query(modbus_t telegram) +{ + + uint8_t u8regsno, u8bytesno; + if (u8id != 0) + return -2; + if (u8state != COM_IDLE) + return -1; + + if ((telegram.u8id == 0) || (telegram.u8id > 247)) + return -3; + + au16regs = telegram.au16reg; + telegram.flags = QUEUED; + currentQuery = &telegram; + + // telegram header + au8Buffer[ID] = telegram.u8id; + au8Buffer[FUNC] = telegram.u8fct; + au8Buffer[ADD_HI] = highByte(telegram.u16RegAdd); + au8Buffer[ADD_LO] = lowByte(telegram.u16RegAdd); + + switch (telegram.u8fct) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + u8BufferSize = 6; + break; + case MB_FC_WRITE_COIL: + au8Buffer[NB_HI] = ((telegram.u16CoilsNo > 0) ? 0xff : 0); + au8Buffer[NB_LO] = 0; + u8BufferSize = 6; + break; + case MB_FC_WRITE_REGISTER: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + u8BufferSize = 6; + break; + case MB_FC_WRITE_MULTIPLE_COILS: // TODO: implement "sending coils" + u8regsno = telegram.u16CoilsNo / 16; + u8bytesno = u8regsno * 2; + if ((telegram.u16CoilsNo % 16) != 0) + { + u8bytesno++; + u8regsno++; + } + + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = u8bytesno; + u8BufferSize = 7; + + u8regsno = u8bytesno = 0; + break; + + case ku8MBLinkTestOmronMX2Only: + { + + break; + } + case MB_FC_WRITE_MULTIPLE_REGISTERS: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = (uint8_t)(telegram.u16CoilsNo * 2); + u8BufferSize = 7; + + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + au8Buffer[u8BufferSize] = highByte(au16regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(au16regs[i]); + u8BufferSize++; + } + break; + } + + sendTxBuffer(); + u8state = COM_WAITING; + return 0; +} + +/** + * @brief *** Only for Modbus Master *** + * This method checks if there is any incoming answer if pending. + * If there is no answer, it would change Master state to COM_IDLE. + * This method must be called only at loop section. + * Avoid any delay() function. + * + * Any incoming data would be redirected to au16regs pointer, + * as defined in its modbus_t query telegram. + * + * @params nothing + * @return errors counter + * @ingroup loop + */ +int8_t Modbus::poll() +{ + // check if there is any incoming frame + uint8_t u8current; + if (u8serno < 4) + { + u8current = port->available(); + } + else + { + u8current = softPort->available(); + } + + if (millis() > u32timeOut) + { + u8state = COM_IDLE; + u8lastError = NO_REPLY; + u16errCnt++; + return 0; + } + + if (u8current == 0) + { + // Serial.println("no port"); + return 0; + } + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) + { + return 0; + }; + + // transfer Serial buffer frame to auBuffer + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + if (i8state < 7) + { + u8state = COM_IDLE; + u16errCnt++; + return i8state; + } + + // validate message: id, CRC, FCT, exception + uint8_t u8exception = validateAnswer(); + if (u8exception != 0) + { + Serial.println("exception"); + Serial.println(u8exception); + u8state = COM_IDLE; + return u8exception; + } + + // process answer + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + // call get_FC1 to transfer the incoming message to au16regs buffer + get_FC1(); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + // call get_FC3 to transfer the incoming message to au16regs buffer + get_FC3(); + break; + case MB_FC_WRITE_COIL: + case MB_FC_WRITE_REGISTER: + case MB_FC_WRITE_MULTIPLE_COILS: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + // nothing to do + break; + default: + break; + } + u8state = COM_IDLE; + currentQuery->flags = QUERY_STATE::RESPONDED; + return u8BufferSize; +} + +/** + * @brief + * *** Only for Modbus Slave *** + * This method checks if there is any incoming query + * Afterwards, it would shoot a validation routine plus a register query + * Avoid any delay() function !!!! + * After a successful frame between the Master and the Slave, the time-out timer is reset. + * + * @param *regs register table for communication exchange + * @param u8size size of the register table + * @return 0 if no query, 1..4 if communication error, >4 if correct query processed + * @ingroup loop + */ +int8_t Modbus::poll(uint16_t *regs, uint8_t u8size) +{ + + au16regs = regs; + u8regsize = u8size; + uint8_t u8current; + + // check if there is any incoming frame + if (u8serno < 4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (u8current == 0) + return 0; + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) + return 0; + + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + u8lastError = i8state; + if (i8state < 7) + return i8state; + + // check slave id + if (au8Buffer[ID] != u8id) + { + return 0; + } + + // validate message: CRC, FCT, address and size + uint8_t u8exception = validateRequest(); + if (u8exception > 0) + { + if (u8exception != NO_REPLY) + { + buildException(u8exception); + sendTxBuffer(); + } + u8lastError = u8exception; + return u8exception; + } + + u32timeOut = millis() + long(u16timeOut); + u8lastError = 0; + + // process message + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + return process_FC1(regs, u8size); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + return process_FC3(regs, u8size); + break; + case MB_FC_WRITE_COIL: + return process_FC5(regs, u8size); + break; + case MB_FC_WRITE_REGISTER: + return process_FC6(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_COILS: + return process_FC15(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_REGISTERS: + return process_FC16(regs, u8size); + break; + default: + break; + } + currentQuery->flags = RESPONDED; + return i8state; +} + +/* _____PRIVATE FUNCTIONS_____________________________________________________ */ + +void Modbus::init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin) +{ + this->u8id = u8id; + this->u8serno = (u8serno > 3) ? 0 : u8serno; + + // this->u8txenpin = u8txenpin; + this->u8txenpin = 2; // Ignore input parameter u8txenpin and hardcode 2 for compatibility + + this->u16timeOut = 1000; +} + +void Modbus::init(uint8_t u8id) +{ + this->u8id = u8id; + this->u8serno = 4; + this->u8txenpin = 0; + this->u16timeOut = 1000; +} + +/** + * @brief + * This method moves Serial buffer data to the Modbus au8Buffer. + * + * @return buffer size if OK, ERR_BUFF_OVERFLOW if u8BufferSize >= MAX_BUFFER + * @ingroup buffer + */ +int8_t Modbus::getRxBuffer() +{ + boolean bBuffOverflow = false; + + if (u8txenpin > 1) + { + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + + u8BufferSize = 0; + if (u8serno < 4) + while (port->available()) + { + au8Buffer[u8BufferSize] = port->read(); + rxBuffer[u8BufferSize] = au8Buffer[u8BufferSize]; + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + else + while (softPort->available()) + { + au8Buffer[u8BufferSize] = softPort->read(); + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + u16InCnt++; + + if (bBuffOverflow) + { + u16errCnt++; + return ERR_BUFF_OVERFLOW; + } + + rxSize = u8BufferSize; + return u8BufferSize; +} + +/** + * @brief + * This method transmits au8Buffer to Serial line. + * Only if u8txenpin != 0, there is a flow handling in order to keep + * the RS485 transceiver in output state as long as the message is being sent. + * This is done with UCSRxA register. + * The CRC is appended to the buffer before starting to send it. + * + * @param nothing + * @return nothing + * @ingroup buffer + */ +void Modbus::sendTxBuffer() +{ + uint8_t i = 0; + + // append CRC to message + uint16_t u16crc = calcCRC(u8BufferSize); + + /* + Serial.print("---- calc CRC : HEX : "); + Serial.print(u16crc, DEC); + Serial.print(" - HEX : "); + Serial.print(u16crc, HEX); + Serial.print(" - "); + Serial.print(u8BufferSize); + Serial.print("\n"); + */ + + au8Buffer[u8BufferSize] = u16crc >> 8; + u8BufferSize++; + au8Buffer[u8BufferSize] = u16crc & 0x00ff; + u8BufferSize++; + + if (debugSend) + { + Serial.print("Send Hex : \t"); + for (int i = 0; i < 8; i++) + { + Serial.print(au8Buffer[i], HEX); + Serial.print(" : "); + } + Serial.println("--------------- \n"); + } + + // set RS485 transceiver to transmit mode + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + UCSR1A = UCSR1A | (1 << TXC1); + break; +#endif + +#if defined(UBRR2H) + case 2: + UCSR2A = UCSR2A | (1 << TXC2); + break; +#endif + +#if defined(UBRR3H) + case 3: + UCSR3A = UCSR3A | (1 << TXC3); + break; +#endif + case 0: + default: + UCSR0A = UCSR0A | (1 << TXC0); + break; + } + RS485_SET_DE; + RS485_SET_RE; + //digitalWrite( u8txenpin, HIGH ); + } + + // transfer buffer to serial line + if (u8serno < 4) + { + port->write(au8Buffer, u8BufferSize); + } + else + { + softPort->write(au8Buffer, u8BufferSize); + } + // keep RS485 transceiver in transmit mode as long as sending + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + while (!(UCSR1A & (1 << TXC1))) + ; + break; +#endif + +#if defined(UBRR2H) + case 2: + while (!(UCSR2A & (1 << TXC2))) + ; + break; +#endif + +#if defined(UBRR3H) + case 3: + while (!(UCSR3A & (1 << TXC3))) + ; + break; +#endif + case 0: + default: + while (!(UCSR0A & (1 << TXC0))) + ; + break; + } + // return RS485 transceiver to receive mode + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + if (u8serno < 4) + while (port->read() >= 0) + ; + else + while (softPort->read() >= 0) + ; + + u8BufferSize = 0; + + // set time-out for master + u32timeOut = millis() + (unsigned long)u16timeOut; + + // increase message counter + u16OutCnt++; + + currentQuery->flags = QUERY_STATE::SENT; +} + +/** + * @brief + * This method calculates CRC + * + * @return uint16_t calculated CRC value for the message + * @ingroup buffer + */ +uint16_t Modbus::calcCRC(uint8_t u8length) +{ + unsigned int temp, temp2, flag; + temp = 0xFFFF; + for (unsigned char i = 0; i < u8length; i++) + { + temp = temp ^ au8Buffer[i]; + // Serial.println(au8Buffer[i], DEC); + for (unsigned char j = 1; j <= 8; j++) + { + flag = temp & 0x0001; + temp >>= 1; + if (flag) + temp ^= 0xA001; + } + } + // Reverse byte order. + temp2 = temp >> 8; + temp = (temp << 8) | temp2; + temp &= 0xFFFF; + // the returned value is already swapped + // crcLo byte is first & crcHi byte is last + return temp; +} + +/** + * @brief + * This method validates slave incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateRequest() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + // check start address & nb range + uint16_t u16regs = 0; + uint8_t u8regs; + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_WRITE_MULTIPLE_COILS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_COIL: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_REGISTER: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + } + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method validates master incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateAnswer() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check exception + if ((au8Buffer[FUNC] & 0x80) != 0) + { + u16errCnt++; + return ERR_EXCEPTION; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method builds an exception message + * + * @ingroup buffer + */ +void Modbus::buildException(uint8_t u8exception) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + + au8Buffer[ID] = u8id; + au8Buffer[FUNC] = u8func + 0x80; + au8Buffer[2] = u8exception; + u8BufferSize = EXCEPTION_SIZE; +} + +/** + * This method processes functions 1 & 2 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + * TODO: finish its implementation + */ +void Modbus::get_FC1() +{ + uint8_t u8byte, i; + u8byte = 0; + + // for (i=0; i< au8Buffer[ 2 ] /2; i++) { + // au16regs[ i ] = word( + // au8Buffer[ u8byte ], + // au8Buffer[ u8byte +1 ]); + // u8byte += 2; + // } +} + +/** + * This method processes functions 3 & 4 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + */ +void Modbus::get_FC3() +{ + uint8_t u8byte, i; + u8byte = 3; + + for (i = 0; i < au8Buffer[2] / 2; i++) + { + au16regs[i] = word( + au8Buffer[u8byte], + au8Buffer[u8byte + 1]); + u8byte += 2; + } +} + +/** + * @brief + * This method processes functions 1 & 2 + * This method reads a bit array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC1(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8bytesno, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // put the number of bytes in the outcoming message + u8bytesno = (uint8_t)(u16Coilno / 8); + if (u16Coilno % 8 != 0) + u8bytesno++; + au8Buffer[ADD_HI] = u8bytesno; + u8BufferSize = ADD_LO; + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bitWrite( + au8Buffer[u8BufferSize], + u8bitsno, + bitRead(regs[u8currentRegister], u8currentBit)); + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8BufferSize++; + } + } + + // send outcoming message + if (u16Coilno % 8 != 0) + u8BufferSize++; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes functions 3 & 4 + * This method reads a word array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC3(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8StartAdd = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8regsno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + uint8_t u8CopyBufferSize; + uint8_t i; + + au8Buffer[2] = u8regsno * 2; + u8BufferSize = 3; + + for (i = u8StartAdd; i < u8StartAdd + u8regsno; i++) + { + au8Buffer[u8BufferSize] = highByte(regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(regs[i]); + u8BufferSize++; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 5 + * This method writes a value assigned by the master to a single bit + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC5(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit; + uint8_t u8CopyBufferSize; + uint16_t u16coil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + + // point to the register and its bit + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + // write to coil + bitWrite( + regs[u8currentRegister], + u8currentBit, + au8Buffer[NB_HI] == 0xff); + + // send answer to master + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 6 + * This method writes a value assigned by the master to a single word + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC6(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8add = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8CopyBufferSize; + uint16_t u16val = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + regs[u8add] = u16val; + + // keep the same header + u8BufferSize = RESPONSE_SIZE; + + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 15 + * This method writes a bit array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC15(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8frameByte, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + boolean bTemp; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + u8frameByte = 7; + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bTemp = bitRead( + au8Buffer[u8frameByte], + u8bitsno); + + bitWrite( + regs[u8currentRegister], + u8currentBit, + bTemp); + + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8frameByte++; + } + } + + // send outcoming message + // it's just a copy of the incomping frame until 6th byte + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 16 + * This method writes a word array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC16(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + uint8_t u8StartAdd = au8Buffer[ADD_HI] << 8 | au8Buffer[ADD_LO]; + uint8_t u8regsno = au8Buffer[NB_HI] << 8 | au8Buffer[NB_LO]; + uint8_t u8CopyBufferSize; + uint8_t i; + uint16_t temp; + + // build header + au8Buffer[NB_HI] = 0; + au8Buffer[NB_LO] = u8regsno; + u8BufferSize = RESPONSE_SIZE; + + // write registers + for (i = 0; i < u8regsno; i++) + { + temp = word( + au8Buffer[(BYTE_CNT + 1) + i * 2], + au8Buffer[(BYTE_CNT + 2) + i * 2]); + + regs[u8StartAdd + i] = temp; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.cpp new file mode 100644 index 0000000..480b9a1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.cpp @@ -0,0 +1,238 @@ +/* + Mudbus.cpp - an Arduino library for a Modbus TCP slave. + Copyright (C) 2011 Dee Wykoff + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "Mudbus.h" +#include "enums.h" + +// For Arduino 0022 +// Server MbServer(MB_PORT); +// For Arduino 1.0 +EthernetServer MbServer(MB_PORT); +// #define MbDebug + +Mudbus::Mudbus() +{ +} + +void Mudbus::Run() +{ + Runs = 1 + Runs * (Runs < 999); + + //****************** Read from socket **************** + // For Arduino 0022 + // Client client = MbServer.available(); + // For Arduino 1.0 + EthernetClient client = MbServer.available(); + if(client.available()) + { + Reads = 1 + Reads * (Reads < 999); + int i = 0; + while(client.available()) + { + ByteArray[i] = client.read(); + i++; + } + SetFC(ByteArray[7]); //Byte 7 of request is FC + if(!Active) + { + Active = true; + PreviousActivityTime = millis(); + #ifdef MbDebug + Serial.println("Mb active"); + #endif + } + } + if(millis() > (PreviousActivityTime + 60000)) + { + if(Active) + { + Active = false; + #ifdef MbDebug + Serial.println("Mb not active"); + #endif + } + } + + int Start, WordDataLength, ByteDataLength, CoilDataLength, MessageLength; + + //****************** Read Coils ********************** + if(FC == MB_FC_READ_COILS) + { + Start = word(ByteArray[8],ByteArray[9]); + CoilDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = CoilDataLength / 8; + if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; + CoilDataLength = ByteDataLength * 8; + #ifdef MbDebug + Serial.print(" MB_FC_READ_COILS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(CoilDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + ByteArray[8] = ByteDataLength; //Number of bytes after this one (or number of bytes of data). + for(int i = 0; i < ByteDataLength ; i++) + { + for(int j = 0; j < 8; j++) + { + bitWrite(ByteArray[9 + i], j, C[Start + i * 8 + j]); + } + } + MessageLength = ByteDataLength + 9; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Read Registers ****************** + if(FC == MB_FC_READ_REGISTERS) + { + Start = word(ByteArray[8],ByteArray[9]); + WordDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = WordDataLength * 2; + #ifdef MbDebug + Serial.print(" MB_FC_READ_REGISTERS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(WordDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + ByteArray[8] = ByteDataLength; //Number of bytes after this one (or number of bytes of data). + for(int i = 0; i < WordDataLength; i++) + { + ByteArray[ 9 + i * 2] = highByte(R[Start + i]); + ByteArray[10 + i * 2] = lowByte(R[Start + i]); + } + MessageLength = ByteDataLength + 9; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Write Coil ********************** + if(FC == MB_FC_WRITE_COIL) + { + Start = word(ByteArray[8],ByteArray[9]); + C[Start] = word(ByteArray[10],ByteArray[11]) > 0; + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_COIL C"); + Serial.print(Start); + Serial.print("="); + Serial.println(C[Start]); + #endif + ByteArray[5] = 2; //Number of bytes after this one. + MessageLength = 8; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Write Register ****************** + if(FC == MB_FC_WRITE_REGISTER) + { + Start = word(ByteArray[8],ByteArray[9]); + R[Start] = word(ByteArray[10],ByteArray[11]); + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_REGISTER R"); + Serial.print(Start); + Serial.print("="); + Serial.println(R[Start]); + #endif + ByteArray[5] = 6; //Number of bytes after this one. + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + + //****************** Write Multiple Coils ********************** + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + if(FC == MB_FC_WRITE_MULTIPLE_COILS) + { + Start = word(ByteArray[8],ByteArray[9]); + CoilDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = CoilDataLength / 8; + if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; + CoilDataLength = ByteDataLength * 8; + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_MULTIPLE_COILS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(CoilDataLength); + #endif + ByteArray[5] = ByteDataLength + 5; //Number of bytes after this one. + for(int i = 0; i < ByteDataLength ; i++) + { + for(int j = 0; j < 8; j++) + { + C[Start + i * 8 + j] = bitRead( ByteArray[13 + i], j); + } + } + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + + //****************** Write Multiple Registers ****************** + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + if(FC == MB_FC_WRITE_MULTIPLE_REGISTERS) + { + Start = word(ByteArray[8],ByteArray[9]); + WordDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = WordDataLength * 2; + #ifdef MbDebug + Serial.print(" MB_FC_READ_REGISTERS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(WordDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + for(int i = 0; i < WordDataLength; i++) + { + R[Start + i] = word(ByteArray[ 13 + i * 2],ByteArray[14 + i * 2]); + } + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + #ifdef MbDebug + Serial.print("Mb runs: "); + Serial.print(Runs); + Serial.print(" reads: "); + Serial.print(Reads); + Serial.print(" writes: "); + Serial.print(Writes); + Serial.println(); + #endif +} + + +void Mudbus::SetFC(int fc) +{ + if(fc == 1) FC = MB_FC_READ_COILS; + if(fc == 3) FC = MB_FC_READ_REGISTERS; + if(fc == 5) FC = MB_FC_WRITE_COIL; + if(fc == 6) FC = MB_FC_WRITE_REGISTER; + if(fc == 15) FC = MB_FC_WRITE_MULTIPLE_COILS; + if(fc == 16) FC = MB_FC_WRITE_MULTIPLE_REGISTERS; +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.h b/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.h new file mode 100644 index 0000000..eba453a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Mudbus.h @@ -0,0 +1,96 @@ +/* + Mudbus.h - an Arduino library for a Modbus TCP slave. + Copyright (C) 2011 Dee Wykoff + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +//#define MbDebug + +// For Arduino 0022 +// #include "WProgram.h" +// For Arduino 1.0 +#include "Arduino.h" + +#include +#include + + +#ifndef Mudbus_h +#define Mudbus_h + +#define MB_N_R 125 //Max 16 bit registers for Modbus is 125 +#define MB_N_C 128 //Max coils for Modbus is 2000 - dont need that many so here is a multiple of 8 +#define MB_PORT 502 + +/* +enum MB_FC { + MB_FC_NONE = 0, + MB_FC_READ_COILS = 1, + MB_FC_READ_REGISTERS = 3, + MB_FC_WRITE_COIL = 5, + MB_FC_WRITE_REGISTER = 6, + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + MB_FC_WRITE_MULTIPLE_COILS = 15, + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 +}; +*/ +class Mudbus +{ +public: + Mudbus(); + void Run(); + int R[MB_N_R]; + bool C[MB_N_C]; + bool Active; + unsigned long PreviousActivityTime; + int Runs, Reads, Writes; +private: + uint8_t ByteArray[260]; + int FC; + void SetFC(int fc); +}; + +#endif + +/* Speculations on Modbus message structure: +********************************************** +**********Master(PC) request frames*********** +00 ID high 0 +01 ID low 1 +02 Protocol high 0 +03 Protocol low 0 +04 Message length high 0 +05 Message length low 6 (6 bytes after this) +06 Slave number 1 +07 Function code +08 Start address high maybe 0 +09 Start address low maybe 0 +10 Length high maybe 125 or Data high if write +11 Length low maybe 125 or Data low if write +********************************************** +**********Slave(Arduino) response frames****** +00 ID high echo / 0 +01 ID low echo / slave ID 1 +02 Protocol high echo +03 Protocol low echo +04 Message length high echo +05 Message length low num bytes after this +06 Slave number echo +07 Function code echo +08 Start address high num bytes of data +09 Data high +10 Data low +********************************************** +*/ diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronE5.h b/extrusion/lydia-print-head-v1/firmware/firmware/OmronE5.h new file mode 100644 index 0000000..7b4857d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronE5.h @@ -0,0 +1,332 @@ +#ifndef OMRON_E5_H +#define OMRON_E5_H + +// Omron EJ5 Modbus Registers & Coils + +#define OR_BIT(A) (A >> 1) +#define OR_WORD(A) (A << 4) + +bool OR_E5_STATUS_BIT(unsigned int high, unsigned int low, byte bit) +{ + // shift down all for 16bit platforms only + if (bit <= 16) + { + return (low & (1 << 8)); + } + + return (OR_WORD(high) & (1 << (OR_BIT(bit)))); +} + +// Status Bit -1 , see h175_e5_c_communications_manual_en.pdf::3-24 +enum OR_E5_STATUS_1 +{ + // Lower Word + + OR_E5_S1_Heater_OverCurrent = 0, + OR_E5_S1_Heater_CurrentHold = 1, + OR_E5_S1_AD_ConverterError = 2, + OR_E5_S1_HS_Alarm = 3, + OR_E5_S1_RSP_InputError = 4, + OR_E5_S1_InputError = 6, + OR_E5_S1_PotentiometerInnputError = 7, + OR_E5_S1_Control_OutputOpenOutput = 8, + OR_E5_S1_Control_OutputCloseOutput = 9, + OR_E5_S1_HBAlarmCT1 = 10, + OR_E5_S1_HBAlarmCT2 = 11, + OR_E5_S1_Alarm1 = 12, + OR_E5_S1_Alarm2 = 13, + OR_E5_S1_Alarm3 = 14, + OR_E5_S1_ProgramEndOutput = 15, + + // Upper Word + + OR_E5_S1_EventInput1 = 16, + OR_E5_S1_EventInput2 = 17, + OR_E5_S1_EventInput3 = 18, + OR_E5_S1_EventInput4 = 19, + OR_E5_S1_WriteMode = 20, + OR_E5_S1_NonVolatileMemory = 21, + OR_E5_S1_SetupArea = 22, + OR_E5_S1_ATExcecute = 23, + OR_E5_S1_RunStop = 24, + OR_E5_S1_ComWrite = 25, + OR_E5_S1_AutoManualSwitch = 26, + OR_E5_S1_ProgramStart = 27, + OR_E5_S1_HeaterOverCurrentCT2 = 28, + OR_E5_S1_HeaterCurrentHoldCT2 = 29, + OR_E5_S1_HSAlarmCT2 = 31 +}; + +// Status Bit - 2 , see h175_e5_c_communications_manual_en.pdf::3-25 + +enum OR_E5_STATUS_2 +{ + // Lower Word + + OR_E5_S2_WorkBit1 = 0, + OR_E5_S2_WorkBit2 = 1, + OR_E5_S2_WorkBit3 = 2, + OR_E5_S2_WorkBit4 = 3, + OR_E5_S2_WorkBit5 = 4, + OR_E5_S2_WorkBit6 = 5, + OR_E5_S2_WorkBit7 = 6, + OR_E5_S2_WorkBit8 = 7, + + // Upper Word + + OR_E5_S2_EventInput5 = 16, + OR_E5_S2_EventInput6 = 17, + OR_E5_S2_Inverse = 20, + OR_E5_S2_SPRamp = 21, + OR_E5_S2_SPMode = 27, + OR_E5_S2_Alarm4 = 28 +}; + +// Variable Area - Settings Range (0x06s) - 2 byte mode, +// see h175_e5_c_communications_manual_en.pdf::5-1 + +enum OR_E5_SWR +{ + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV = 0x2000, + + // Refer to 5-2 Status for details (see @OR_E5_STATUS_1 and @OR_E5_STATUS_2) + OR_E5_SWR_STATUS = 0x2001, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP = 0x2002, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor = 0x2003, + + // MV Monitor (Heating) + // Standard: 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling: 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorHeating = 0x2004, + + // MV Monitor (Cooling) + // 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorCooling = 0x2005, + + // Set Point - SP lower limit to SP upper limit + OR_E5_SWR_SP_LIMIT = 0x2103, + + // Alarm Value 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1 = 0x2104, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_UL = 0x2105, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_LL = 0x2106, + + // Alarm Value 2 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2 = 0x2107, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_UL = 0x2108, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_LL = 0x2109, + + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV2 = 0x2402, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP2 = 0x2403, + + // Multi SP No. Monitor, 0x00000000 to 0x00000007 (0 to 7) + OR_E5_SWR_MSMON = 0x2404, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEX = 0x2406, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the leftmost 16 bits are read. + OR_E5_SWR_STATUSEXL = 0x2407, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEXR = 0x2408, + + // Decimal Point Monitor, + // 0x00000000 to 0x00000003 (0 to 3) + OR_E5_SWR_DECMON = 0x2410, + + // Set Point () + // SP lower limit to SP upper limit + OR_E5_SWR_SP = 0x2601, + + // Remote Set Point Monitor + // - Remote SP lower limit −10% FS to Remote SP upper limit +10% FS + OR_E5_SWR_SP_EX_MON = 0x2602, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor2 = 0x2604, + + // Valve Opening Monitor, 0xFFFFFF9C to 0x0000044C (−10.0 to 110.0) + OR_E5_SWR_VALVE_OPENING_MON = 0x2607, + + // Proportional Band (Cooling), 0x00000001 to 0x0000270F (0.1 to 999.9) + OR_E5_SWR_PRO_BAND = 0x2701, + + // Integral Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_IT_COOLING = 0x2702, + + // Derivative Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_D_COOLING = 0x2703, + + // Dead Band 0xFFFFF831 to 0x0000270F + // (−199.9 to 999.9 for temperature input) + // (−19.99 to 99.99 for analog input) + OR_E5_SWR_DEADBAND = 0x2704, + + // Manual Reset Value, + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_MANUAL_RESET_VALUE = 0x2705, + + // Hysteresis (Heating) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS = 0x2706, + + // Hysteresis (Cooling) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS_COOLING = 0x2707, + + // Control Period (Heating) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_HEATING = 0x2708, + + // Control Period (Cooling) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_COOLING = 0x2709, + + // Position Proportional Dead Band + // 0x00000001 to 0x00000064 (0.1 to 10.0) + OR_E5_SWR_POSITION_PROPORTIONAL_DEAD_BAND = 0x270A, + + // Open/Close Hysteresis + // 0x00000001 to 0x000000C8 (0.1 to 20.0) + OR_E5_SWR_OPEN_CLOSE_HYSTERESIS = 0x270B, + + // SP Ramp Time Unit 0x00000000 (0): EU/second + // 0x00000001 (1): EU/minute + // 0x00000002 (2): EU/hour + OR_E5_SWR_SP_RAMP_UNIT = 0x270C, + + // SP Ramp Set Value 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_RAMP_SET_VALUE = 0x270D, + + // SP Ramp Fall Value + // 0xFFFFFFFF (−1): Same (Same as SP Ramp Set Value.) + // 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_FALL_VALUE = 0x270E, + + // MV at Stop Standard Models + // Standard control: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling control: + // 0xFFFFFBE6 to 0x0000041A (−105.0 to 105.0) + // Position-proportional Models + // Close position-proportional control with the Direct Setting of + // Position Proportional MV parameter set to ON: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Floating position-proportional control or the Direct Setting of + // Position Proportional MV parameter set to OFF: + // 0xFFFFFFFF to 0x00000001 (−1 to 1) + OR_E5_SWR_MV_PV_ERROR = 0x2711, + + // MV Change Rate Limit + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_CHANGE_RATE_LIMIT = 0x2713, + + // PV Input Slope Coefficient + // 0x00000001 to 0x0000270F (0.001 to 9.999) + OR_E5_SWR_PV_INPUT_SLOPE_COEFFICIENT = 0x2718, + + // Heater Burnout Detection 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_1 = 0x271B, + + // Leakage Current 1 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_1 = 0x271C, + + // HS Alarm 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_1 = 0x271D, + + // Process Value Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_PROCESS_VALUE_INPUT_SHIFT = 0x2723, + + // Heater Burnout Detection 2 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_2 = 0x2725, + + // Leakage Current 2 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_2 = 0x2726, + + // HS Alarm 12 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_2 = 0x2727, + + // Soak Time Remain (how lovely) + // 0x00000000 to 0x0000270F (0 to 9999) + OR_E5_SWR_SOAK_REMAIN = 0x2728, + + // Soak Time + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SOAK_TIME = 0x2729, + + // Wait Band 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for Temperature input) + // (0.01 to 99.99 for Analog input) + OR_E5_SWR_WAIT_BAND = 0x272A, + + // Remote SP Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_REMOTE_SP_SHIFT = 0x272B, + + // Remote SP input Slope Coefficient + // 0x00000001 to 0x0 + OR_E5_SWR_REMOTE_SP_SLOPE_COEFFICIENT = 0x272C, + + // Input Digital Filter 0x00000000 to 0x0000270F (0.0 to 999.9) + OR_E5_SWR_DIGITAL_FILTER = 0x2800 + + // Notes : + // *1 Not displayed on the Controller display +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.cpp new file mode 100644 index 0000000..86ecf53 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.cpp @@ -0,0 +1,603 @@ +#include "OmronPID.h" +#include "ModbusBridge.h" + +#include "./components/OmronE5.h" + +bool printModbus = false; +bool printPIDS = false; +bool debugUpdate = false; +bool _updateState = true; +bool printMBErrors = true; +void OmronPID::testPIDs() +{ + // setAllSP(15); + // runAll(); + // stopAll(); + // singlePIDW(2, OR_E5_SWR::OR_E5_SWR_SP, 300); + // singlePIDW(1, 5000, 20); + // singlePID(1, ku8MBWriteSingleRegister, 0, OR_E5_CMD::OR_E5_AT_EXCECUTE); +} + +short OmronPID::read10_16(int slaveAddress, int addr, int prio = 0) +{ + Query *same = modbus->nextSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 10); + if (same != NULL && millis() - same->ts < 1000) + { + return; + } + if (modbus->numByState(DONE) < 10) + { + return; + } + + if (modbus->numSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 1) > 1) + { + return; + } + + Query *next = modbus->nextQueryByState(DONE); + if (next != NULL) + { + next->fn = ku8MBReadHoldingRegisters; + next->slave = slaveAddress; + next->value = 10; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + next->prio = prio; + next->owner = OMRON_PID; + if (debugUpdate) + { + Serial.println(next->slave); + } + return E_OK; + } + else + { + Serial.print("Buffer full"); + } + return E_QUERY_BUFFER_END; +} +void OmronPID::updateState() +{ + if (!_updateState) + { + return; + } + OmronState *next = nextToUpdate(); + if (next != NULL) + { + + modbus->nextWaitingTime = MODBUS_READ_WAIT; + if (debugUpdate) + { + Serial.println("Update slave :"); + Serial.println(next->slaveID); + } + next->flags = OmronState::FLAGS::UPDATING; + read10_16(next->slaveID, 0); + } +} +short OmronPID::rawResponse(short size, uint8_t rxBuffer[]) +{ + + Query *current = modbus->nextQueryByState(PROCESSING, OMRON_PID); + + /* + Serial.print("\n\t Incoming: "); + current->print(); + Serial.println(" :: "); + */ + /* + for (int i = 0; i < size; i++) + { + Serial.print(rxBuffer[i], HEX); + Serial.print(" : "); + } + + Serial.print("\n\t Incoming size : "); + Serial.print(size); + Serial.print("\n"); +*/ + if (current) + { + switch (current->fn) + { + case ku8MBWriteSingleRegister: + { + + if (size == 5 && rxBuffer[1] == OR_E5_RESPONSE_CODE::OR_COMMAND_ERROR) + { + Serial.print("------ \n Command Error: "); + Serial.print(rxBuffer[2]); + Serial.print(" : "); + switch (rxBuffer[2]) + { + case OR_E5_ERROR::VARIABLE_ADDRESS_ERROR: + { + Serial.println(OR_E_MSG_INVALID_ADDRESS); + break; + } + case OR_E5_ERROR::VARIABLE_RANGE_ERROR: + { + Serial.println(OR_E_MSG_INVALID_RANGE); + break; + } + case OR_E5_ERROR::VARIABLE_OPERATION_ERROR: + { + Serial.println(OR_E_MSG_OPERATION_ERROR); + break; + } + } + Serial.println("\n------"); + return rxBuffer[2]; + } + + if (size == 8 && (rxBuffer[0] != current->slave || rxBuffer[2] != current->addr)) + { + return OR_COMMAND_ERROR; + } + break; + } + } + } + return ERROR_OK; +} + +OmronState *OmronPID::current() +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (states[i].flags == OmronState::FLAGS::UPDATING) + { + return &states[i]; + } + } + return NULL; +} + +short OmronPID::responseFn(short error) +{ + + Query *last = modbus->nextQueryByState(QUERY_STATE::PROCESSING, OMRON_PID); + if (!last) + { + Serial.println("nothing to process !"); + return; + } + OmronState *state = pidBySlave(last->slave); + if (last->fn == ku8MBWriteSingleRegister) + { + last->reset(); + if (state) + { + state->flags = OmronState::FLAGS::UPDATED; + } + return; + } + + if (state) + { + if (state->flags != OmronState::FLAGS::UPDATING) + { + } + + if (state->slaveID != last->slave) + { + Serial.println("mismatch::wrong slave id -------"); + last->print(); + last->reset(); + return; + } + + state->lastUpdated = millis(); + state->statusHigh = modbus->ModbusSlaveRegisters[2]; + state->statusLow = modbus->ModbusSlaveRegisters[3]; + state->pv = modbus->ModbusSlaveRegisters[1]; + state->sp = modbus->ModbusSlaveRegisters[5]; + state->flags = OmronState::FLAGS::UPDATED; + state->ready = true; + if (printPIDS) + { + Serial.print("Updated SlaveID: "); + Serial.print(state->slaveID); + Serial.println(""); + print(); + } + last->reset(); + updateTCP(); + } + else + { + Serial.print("Invalid current PID: "); + Serial.println(last->slave); + } +} +void OmronPID::print() +{ + + printStates(); +} +void OmronPID::fromTCP() +{ + millis_t t = now; + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + switch (i) + { + case 0: + { + + if (modbus->mb->R[MB_W_PID_1_SP] > 0) + { + singlePID(states[i].slaveID, ku8MBWriteSingleRegister, OR_E5_SWR::OR_E5_SWR_SP, modbus->mb->R[MB_W_PID_1_SP]); + modbus->mb->R[MB_W_PID_1_SP] = 0; + Serial.println("change"); + modbus->print(); + states[i].lastWritten = t; + } + break; + } + case 1: + { + + if (modbus->mb->R[MB_W_PID_2_SP] > 0) + { + singlePID(states[i].slaveID, ku8MBWriteSingleRegister, OR_E5_SWR::OR_E5_SWR_SP, modbus->mb->R[MB_W_PID_2_SP]); + modbus->mb->R[MB_W_PID_2_SP] = 0; + states[i].lastWritten = t; + return true; + } + break; + } + case 2: + { + + if (modbus->mb->R[MB_W_PID_3_SP]) + { + singlePID(states[i].slaveID, ku8MBWriteSingleRegister, OR_E5_SWR::OR_E5_SWR_SP, modbus->mb->R[MB_W_PID_3_SP]); + modbus->mb->R[MB_W_PID_3_SP] = 0; + states[i].lastWritten = t; + } + break; + } + } + } +} + +void OmronPID::updateTCP() +{ + + modbus->mb->R[MB_R_PID_1_PV + MB_REGISTER_OFFSET] = states[0].pv; + modbus->mb->R[MB_R_PID_2_PV + MB_REGISTER_OFFSET] = states[1].pv; + modbus->mb->R[MB_R_PID_3_PV + MB_REGISTER_OFFSET] = states[2].pv; + + modbus->mb->R[MB_R_PID_1_SP + MB_REGISTER_OFFSET] = states[0].sp; + modbus->mb->R[MB_R_PID_2_SP + MB_REGISTER_OFFSET] = states[1].sp; + modbus->mb->R[MB_R_PID_3_SP + MB_REGISTER_OFFSET] = states[2].sp; +} + +short OmronPID::queryResponse(short error) +{ + Query *last = modbus->nextQueryByState(QUERY_STATE::PROCESSING); + if (last) + { + last->state = QUERY_STATE::DONE; + } +} + +int OmronPID::singlePIDW(int slave, int addr, int value) +{ + singlePID(slave, ku8MBWriteSingleRegister, addr, value); +} +int OmronPID::singlePID(int slave, short fn, int addr, int value) +{ + Query *same = modbus->nextSame(QUEUED, slave, addr, fn, value); + if (modbus->numByState(DONE) < 2 && fn != ku8MBWriteSingleRegister) + { + return false; + } + if (modbus->numSame(QUEUED, slave, addr, fn, value) > 1) + { + return false; + } + + OmronState *pid = pidBySlave(slave); + if (pid) + { + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = fn; + next->slave = pid->slaveID; + next->value = value; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + if (fn == ku8MBWriteSingleRegister) + { + next->prio = MB_QUERY_TYPE_CMD; + } + return E_OK; + } + } + else + { + Serial.println("No such PID"); + return E_NO_SUCH_PID; + } +} + +int OmronPID::eachPIDW(int addr, int value) +{ + return eachPID(ku8MBWriteSingleRegister, addr, value); +} + +int OmronPID::eachPID(short fn, int addr, int value) +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = fn; + next->slave = states[i].slaveID; + next->value = value; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + } + else + { + Serial.println("no buffer free"); + } + } +} +OmronState *OmronPID::pidBySlave(int slave) +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (states[i].slaveID == slave) + { + return &states[i]; + } + } + return NULL; +} + +void OmronPID::stopAll() +{ + eachPID(ku8MBWriteSingleRegister, 0, OR_E5_CMD::OR_E5_STOP); +} + +void OmronPID::runAll() +{ + eachPID(ku8MBWriteSingleRegister, 0, OR_E5_CMD::OR_E5_RUN); +} + +void OmronPID::setAllSP(int sp) +{ + eachPID(ku8MBWriteSingleRegister, OR_E5_SWR::OR_E5_SWR_SP, sp); +} + +short OmronPID::setup() +{ + statusLight.off(); +} + +// for manual testing +bool did = false; + +short OmronPID::loop() +{ + + if (millis() - startTS < 2000) + { + return; + } + + statusLight.loop(); + + if (modbus->qstate() != IDLE) + { + return; + } + + if (!did) + { + testPIDs(); + did = true; + } + if (millis() - interval > OMRON_PID_UPDATE_INTERVAL) + { + fromTCP(); + + updateState(); + + interval = now; + + Query *nextCommand = modbus->nextQueryByState(QUERY_STATE::QUEUED); + if (nextCommand != NULL) + { + if (printModbus) + { + modbus->print(); + } + + nextCommand->state = QUERY_STATE::PROCESSING; + modbus->nextWaitingTime = MODBUS_CMD_WAIT; + modbus->onMessage = (AddonRxFn)&OmronPID::rawResponse; + modbus->onError = (AddonFnPtr)&OmronPID::onError; + if (debugUpdate) + { + Serial.print("query slave : "); + Serial.print(nextCommand->slave); + Serial.print(" qid: "); + Serial.print(nextCommand->id); + Serial.print(" ts: "); + Serial.print(nextCommand->ts); + Serial.print(" fn: "); + Serial.print(nextCommand->fn); + Serial.println("----"); + } + modbus->query(nextCommand->slave, nextCommand->fn, nextCommand->addr, nextCommand->value, this, (AddonFnPtr)&OmronPID::responseFn); + + print(); + if (!isRunning()) + { + statusLight.setBlink(false); + statusLight.off(); + return; + } + if (isHeatingUp()) + { + statusLight.setBlink(true); + } + else + { + statusLight.setBlink(false); + statusLight.on(); + } + } + } +} + +short OmronPID::onError(short error) +{ + if (printMBErrors) + { + Serial.print("Omron PID :: onError "); + if (error == 255) + { + Serial.println("Timeout"); + } + else + { + Serial.println(error); + } + } + Query *last = modbus->nextQueryByState(QUERY_STATE::PROCESSING, OMRON_PID); + if (last) + { + last->reset(); + } + else + { + Serial.println("Omron PID :: onError - can't find last query! "); + } + resetStates(); +} +void OmronPID::resetStates() +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + states[i].flags = OmronState::FLAGS::UPDATED; + } +} +OmronState *OmronPID::nextToUpdate() +{ + OmronState *oldest = NULL; + bool isUpdating = false; + millis_t t = millis(); + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (states[i].flags == OmronState::FLAGS::UPDATING) + { + continue; + } + + if (!oldest) + { + oldest = &states[i]; + } + + /* + if (&states[i] != oldest && states[i].lastUpdated < oldest->lastUpdated) + { + oldest = &states[i]; + } + */ + + if (millis() - states[i].lastUpdated > OMRON_PID_UPDATE_INTERVAL * 2) + { + oldest = &states[i]; + } + + if (states[i].flags == OmronState::FLAGS::UPDATING) + { + isUpdating = true; + } + } + + if (isUpdating) + { + return NULL; + } + + return oldest; +} + +bool OmronPID::isHeatingUp() +{ + bool ret = false; + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (states[i].isHeating()) + { + return true; + } + } + return ret; +} +bool OmronPID::isRunning() +{ + bool ret = false; + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (states[i].isRunning()) + { + return true; + } + } + return ret; +} +void OmronPID::printStates() +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + states[i].print(); + } +} + +OmronState *OmronPID::nextToWrite() +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + if (millis() - states[i].lastWritten > OMRON_PID_WRITE_INTERVAL) + { + return &states[i]; + } + } + return NULL; +} + +short OmronPID::debug(Stream *stream) +{ + //*stream << this->name << ":" << this->ok(); + return false; +} +short OmronPID::info(Stream *stream) +{ + //*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN); + return false; +} + +void OmronPID::initPIDS() +{ + for (short i = 0; i < NB_OMRON_PIDS; i++) + { + states[i].slaveID = slaveStart + i; + states[i].idx = i; + states[i].lastUpdated = millis(); + states[i].lastWritten = millis(); + states[i].flags = OmronState::FLAGS::UPDATED; + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.h b/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.h new file mode 100644 index 0000000..4280886 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronPID.h @@ -0,0 +1,179 @@ +#ifndef OMRON_PID_H +#define OMRON_PID_H + +#ifdef HAS_STATES +#include +#endif + +#include +#include "./Addon.h" +#include "./config.h" +#include "./common/macros.h" +#include "./components/OmronE5.h" +#include "components/StatusLight.h" +#include + +#include "ModbusBridge.h" + +// actual PID, holds only values and handy functions +class OmronState +{ +public: + int statusHigh; + int statusLow; + int pv; + int sp; + int flags; + int slaveID; + int idx; + + millis_t lastUpdated; + millis_t lastWritten; + + short state; + bool ready; + + enum FLAGS + { + DIRTY = 1, + UPDATING = 2, + UPDATED = 3 + }; + + OmronState() : statusHigh(-1), + statusLow(-1), + pv(-1), + sp(-1), + flags(DIRTY), + lastUpdated(millis()), + lastWritten(millis()), + ready(false) + { + } + + bool isRunning() + { + return !OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_RunStop); + } + bool isHeating() + { + return OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_Control_OutputOpenOutput); + } + bool isCooling() + { + return OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_Control_OutputCloseOutput); + } + + void print() + { + Serial.print("PID - "); + Serial.print(idx); + Serial.print(" : Slave Addr : "); + Serial.print(slaveID); + Serial.print(" | PV : "); + Serial.print(pv); + Serial.print(" | SP : "); + Serial.print(sp); + Serial.print(" | LastUpdate : "); + Serial.print(millis() - lastUpdated); + + Serial.print(" | Flags : "); + + Serial.print(flags, HEX); + + Serial.print("\n"); + } +}; + +// Addon to deal with multiple Omron PID controllers +class OmronPID : public Addon +{ +public: + OmronPID(ModbusBridge *_bridge, short _slaveStart) : modbus(_bridge), + slaveStart(_slaveStart), + statusLight(STATUS_PID_PIN), + Addon(OMRON_PID_STR, OMRON_PID, ADDON_STATED) + { + setFlag(DEBUG); + cPID = 0; + initPIDS(); + startTS = millis(); + } + + virtual short loop(); + virtual short setup(); + + short debug(Stream *stream); + short info(Stream *stream); + + // PID access + OmronState *OmronPID::nextToUpdate(); + OmronState *OmronPID::nextToWrite(); + + // Modbus callbacks + short responseFn(short error); + short queryResponse(short error); + short onError(short error); + + short rawResponse(short size, uint8_t rxBuffer[]); + + // PID programming + void stopAll(); + void runAll(); + void setAllSP(int sp); + + bool isHeatingUp(); + bool isRunning(); + StatusLight statusLight; + + /////////////////////////////////////////// + // Modbus + + Vector queries; + +private: + // config + short slaveStart; + short nbPIDs; + + // current PID to read updates from + short cPID; + + ModbusBridge *modbus; + + // actual PID states + OmronState states[NB_OMRON_PIDS]; + + bool mute; + + // Modbus query / commands + int eachPID(short fn, int addr, int value); + int eachPIDW(int addr, int value); + int singlePID(int slave, short fn, int addr, int value); + int singlePIDW(int slave, int addr, int value); + OmronState *pidBySlave(int slave); + + OmronState *current(); + + short read10_16(int slaveAddress, int addr, int prio = 0); + + void updateState(); + millis_t interval; + + void printStates(); + bool locked; + void updateTCP(); + void fromTCP(); + void print(); + void resetStates(); + + millis_t startTS; + +protected: + // initialize PID states + void initPIDS(); + // for debugging and testing + void testPIDs(); +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.cpp new file mode 100644 index 0000000..c179e56 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.cpp @@ -0,0 +1,122 @@ +#include "OmronVFD.h" +#include "ModbusBridge.h" +#include "./components/OmronMX2.h" +#include "app.h" + +#define valA001 3 // A001 Frequency reference source = 03 (no need to change) +#define valA002 3 // A002 Source of the “Move” command = 1 (no need to change) +#define valC026 5 // C026 Relay output function 5 (AL: error signal) = 05 +#define DEF_FC_MAX_FREQ 500 + +void OmronVFD::doTest() +{ + Serial.println(" Do VFD Tests "); + pollState = true; + //forward(); + // ping(); + setTargetFreq(50); + run(); + + //reverse(); + //run(); + + /* + owner->timer.in( + 10000, [](OmronVFD *me) -> void { + me->stop(); + }, + this); + */ + + // stop(); + // configure(); +} +uint16_t OmronVFD::configure() +{ + //write_Single(MX2_A001, valA001); + //write_Single(MX2_A002, valA002); + //write_Single(MX2_C026, valC026); // C026 Relay output function 5 (AL: error signal) = 05 + // write_Single(MX2_A004, DEF_FC_MAX_FREQ / 10); // A004 setting the maximum frequency + // progReg32(MX2_F002, (char *)" F002 ", FC_ACCEL_TIME); // F002 Acceleration Time + // progReg32(MX2_F002, (char *)" F003 ", FC_DEACCEL_TIME); // F003 Acceleration Braking + + for (int i = 0; 0 < MB_N_R; i++) + { + modbus->mb->R[i] = 0; + } + + for (int i = 0; 0 < MB_N_C; i++) + { + modbus->mb->C[i] = false; + } +} +uint16_t OmronVFD::updateState() +{ + // readSingle_16(MX2_STATE); + //readSingle_16(MX2_STATUS); + if (now - readStateTS > OMRON_MX2_STATE_INTERVAL) + { + read_16(1, 5, MB_QUERY_TYPE_STATUS_POLL); + readStateTS = now; + // readSingle_16(0x1003); + } + + //readSingle_16(MX2_CURRENT_FR); + //readSingle_16(MX2_AMPERAGE); +} + +//////////////////////////////////////////////////////////////////////////// +// +// HMI only (Manual = A2 = 2) +uint16_t OmronVFD::stop() +{ + return write_Bit(MX2_START, 0); +} + +uint16_t OmronVFD::run() +{ + return write_Bit(MX2_START, 1); +} + +uint16_t OmronVFD::reverse() +{ + return write_Bit(MX2_SET_DIR, 1); +} +uint16_t OmronVFD::forward() +{ + return write_Bit(MX2_SET_DIR, 0); +} + +uint16_t OmronVFD::setTargetFreq(uint16_t freq) +{ + return write_Single(MX2_TARGET_FR, freq * 100); +} + +//////////////////////////////////////////////////////////////////////////// +// +// Addon impl. +short OmronVFD::setup() +{ + // configure(); +} + +short OmronVFD::loop() +{ + modbusLoop(); + status.loop(); +} + +short OmronVFD::debug(Stream *stream) +{ + //*stream << this->name << ":" << this->ok(); + return false; +} +short OmronVFD::info(Stream *stream) +{ + //*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN); + return false; +} + +void OmronVFD::init() +{ +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.h b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.h new file mode 100644 index 0000000..121280e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFD.h @@ -0,0 +1,150 @@ +#ifndef OMRON_VFD_H +#define OMRON_VFD_H + +#ifdef HAS_STATES +#include +#endif + +#include +#include "./Addon.h" +#include "./config.h" +#include "./common/macros.h" +#include "./components/OmronE5.h" +#include +#include "ModbusBridge.h" +#include "common/timer.h" +#include "components/StatusLight.h" + +class App; + +// actual PID, holds only values and handy functions +class OmronVFDState +{ +public: + struct type_errorMX2 // error structure + { + uint16_t code; // reason + uint16_t status; // Inverter status on shutdown + uint16_t noUse; // Not used + uint16_t fr; // IF frequency during shutdown + uint16_t cur; // IF current on shutdown + uint16_t vol; // IF voltage when disconnected + uint32_t time1; // Total running time in STROKE mode when disconnected + uint32_t time2; // Total operating time of the inverter with the power on at the time of shutdown + }; + union union_errorFC // Omron Error Translation + { + type_errorMX2 MX2; + uint16_t inputBuf[10]; + }; + + int8_t err; // last error + uint16_t numErr; // number of errors + uint8_t nbComErrors; // The number of communication errors when exceeding FC_NUM_READ inverter lock 485 control + uint16_t FC; // Inverter target frequency in 0.01 hertz + uint16_t freqFC; // Read: current inverter frequency in 0.01 hertz + uint16_t power; // Read: Current inverter power in 100 watt units (3 is 300 watts) + uint16_t current; // Read: Current inverter current in 0.01 Amp units + + int16_t state; // Read: State of the inverter register MX2_STATE + int16_t status; // Read: Status of the inverter register MX2_STATUS + + millis_t startTS; // compressor start time + union_errorFC error; // Structure for decoding the inverter error + + millis_t lastUpdated; + millis_t lastWritten; + + OmronVFDState() : lastUpdated(millis()), + lastWritten(millis()) + { + } +}; + +// Addon to deal with multiple Omron PID controllers +class OmronVFD : public Addon +{ +public: + OmronVFD(ModbusBridge *_bridge, short _slaveStart) : modbus(_bridge), + slaveAddress(_slaveStart), + status(STATUS_VFD_PIN), + Addon(OMRON_VFD_STR, OMRON_VFD, ADDON_STATED) + { + setFlag(DEBUG); + init(); + ready = false; + + readStateTS = millis(); + interval = millis(); + setFQTS = millis(); + } + + virtual short loop(); + virtual short setup(); + + short debug(Stream *stream); + short info(Stream *stream); + + // Modbus callbacks + short responseFn(short error); + short queryResponse(short error); + short onError(short error); + short rawResponse(short size, uint8_t rxBuffer[]); + /////////////////////////////////////////// + // Modbus + Vector queries; + + short readSingle_16(int addr, int prio = 0); + short read_16(int addr, int num, int prio = 0); + uint16_t write_Single(uint16_t cmd, unsigned int data); + uint16_t write_Bit(uint16_t addr, int on); + + /////////////////////////////////////////// + // HMI + uint16_t setTargetFreq(uint16_t freq); + uint16_t stop(); + uint16_t run(); + uint16_t reverse(); + uint16_t forward(); + + /////////////////////////////////////////// + // Basics (mandatory) + + uint16_t configure(); + uint16_t updateState(); + millis_t interval; + millis_t readStateTS; + millis_t debugTS; + millis_t setFQTS; + bool pollState; + + void doTest(); + + App *owner; + millis_t last; + +private: + // config + short slaveAddress; + + ModbusBridge *modbus; + + StatusLight status; + + // actual VFD state + OmronVFDState states[1]; + + short ping(); + + void updateTCP(); + void fromTCP(); + + void modbusLoop(); + bool ready; + +protected: + // initialize VFD states + void init(); +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFDModbus.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFDModbus.cpp new file mode 100644 index 0000000..3506d1d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/OmronVFDModbus.cpp @@ -0,0 +1,371 @@ +#include "OmronVFD.h" +#include "ModbusBridge.h" +#include "./components/OmronMX2.h" +#include "app.h" + +//////////////////////////////////////////////////////////////////////////// +// +// Modbus +bool didTest = true; +bool debugReceive = false; +bool debugSend = false; +bool debugFilter = true; +bool debugMultiRegs = false; +bool debugModQueries = false; +bool printErrors = true; + +short OmronVFD::onError(short error) +{ + if (printErrors) + { + Serial.print("Omron VFD onError : "); + if (error == 255) + { + Serial.println("Timeout"); + } + else + { + Serial.println(error); + } + } + Query *last = modbus->nextQueryByState(QUERY_STATE::PROCESSING, OMRON_VFD); + if (last) + { + last->reset(); + } + else + { + Serial.println("Omron VDF :: onError - can't find last query! "); + } +} +void OmronVFD::modbusLoop() +{ + + if (!didTest) + { + didTest = true; + doTest(); + } + + updateState(); + + if (millis() - interval > OMRON_MX2_LOOP_INTERVAL) + { + interval = now; + if (ready) + { + fromTCP(); + } + Query *nextCommand = modbus->nextQueryByState(QUERY_STATE::QUEUED, OMRON_VFD); + if (nextCommand) + { + if (modbus->qstate() != IDLE) + { + return; + } + + nextCommand->state = QUERY_STATE::PROCESSING; + modbus->nextWaitingTime = MODBUS_CMD_WAIT; + modbus->onMessage = (AddonRxFn)&OmronVFD::rawResponse; + modbus->onError = (AddonFnPtr)&OmronVFD::onError; + + if (debugSend) + { + if (now - debugTS > OMRON_MX2_DEBUG_INTERVAL) + { + debugTS = now; + Serial.print("next to send "); + Serial.print(nextCommand->id); + Serial.print(" | "); + Serial.print(nextCommand->ts); + Serial.print(" | Addr="); + Serial.print(nextCommand->addr); + Serial.print(" | Value="); + Serial.print(nextCommand->value); + Serial.print(" | FN="); + Serial.print(nextCommand->fn); + Serial.print("\n"); + + if (debugModQueries) + { + modbus->print(); + } + } + } + + modbus->query(nextCommand->slave, nextCommand->fn, nextCommand->addr, nextCommand->value, this, (AddonFnPtr)&OmronVFD::queryResponse); + return; + } + } +} + +short OmronVFD::ping() +{ + + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = ku8MBLinkTestOmronMX2Only; + next->slave = slaveAddress; + next->value = 1234; + next->addr = 0; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + return E_OK; + } + return E_QUERY_BUFFER_END; +} + +short OmronVFD::rawResponse(short size, uint8_t rxBuffer[]) +{ + if (!size) + { + return E_OK; + } + if (debugReceive) + { + Serial.print("\nIncoming:"); + Serial.print(size); + Serial.print("::\t"); + + for (int i = 0; i < size; i++) + { + Serial.print(rxBuffer[i], HEX); + Serial.print(" : "); + } + Serial.print("\n"); + } + if (size == 5) + { + Serial.println("Error"); + } + + return ERROR_OK; +} + +short OmronVFD::responseFn(short error) +{ +} + +short OmronVFD::queryResponse(short error) +{ + Query *last = modbus->nextQueryByState(QUERY_STATE::PROCESSING, OMRON_VFD); + if (last) + { + long first = modbus->ModbusSlaveRegisters[0]; + if (last->prio == MB_QUERY_TYPE_STATUS_POLL) + { + + states[0].state = modbus->ModbusSlaveRegisters[3]; + states[0].status = modbus->ModbusSlaveRegisters[2]; + states[0].FC = modbus->ModbusSlaveRegisters[0]; + ready = true; + updateTCP(); + if (debugMultiRegs) + { + Serial.print(" - regs : \n "); + for (int i = 0; i < 5; i++) + { + Serial.print(" - "); + Serial.print(modbus->ModbusSlaveRegisters[i]); + Serial.print("\n"); + } + } + } + + last->addr = 0; + last->value = 0; + last->slave = 0; + last->ts = 0; + last->prio = 0; + last->state = QUERY_STATE::DONE; + } + else + { + Serial.println("state error, had nothing to process"); + } +} + +void OmronVFD::updateTCP() +{ + + modbus->mb->R[MB_R_VFD_STATUS] = states[0].status; + modbus->mb->R[MB_R_VFD_STATE] = states[0].state; + modbus->mb->R[MB_R_FREQ_TARGET] = states[0].FC; + // fromTCP(); +} + +void OmronVFD::fromTCP() +{ + if (modbus->mb->R[MB_W_VFD_RUN] == 1) + { + write_Bit(MX2_START, 1); + modbus->mb->R[MB_W_VFD_RUN] = 0; + } + if (modbus->mb->R[MB_W_VFD_RUN] == 2) + { + write_Bit(MX2_START, 0); + modbus->mb->R[MB_W_VFD_RUN] = 0; + } + + if (modbus->mb->R[MB_W_VFD_RUN] == 2) + { + modbus->mb->R[MB_W_VFD_RUN] = 0; + write_Bit(MX2_START, 0); + } + + if (modbus->mb->R[MB_W_DIRECTION] > 0) + { + switch (modbus->mb->R[MB_W_DIRECTION]) + { + case 1: + forward(); + break; + case 2: + reverse(); + break; + default: + stop(); + break; + } + modbus->mb->R[MB_W_DIRECTION] = 0; + } + + if (states[0].state == OMRON_STATE_DECELERATING || states[0].state == OMRON_STATE_ACCELERATING) + { + status.setBlink(true); + } + + if (states[0].state == OMRON_STATE_RUNNING) + { + status.setBlink(false); + status.on(); + } + + if (states[0].state == OMRON_STATE_STOPPED) + { + status.setBlink(false); + status.off(); + } + + if (modbus->mb->R[MB_W_FREQ_TARGET] > 0) + { + setTargetFreq(modbus->mb->R[MB_W_FREQ_TARGET]); + modbus->mb->R[MB_W_FREQ_TARGET] = 0; + } +} + +uint16_t OmronVFD::write_Single(uint16_t addr, unsigned int data) +{ + + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = ku8MBWriteSingleRegister; + next->slave = slaveAddress; + // modbus->setDebugSend(true); + next->value = data; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + next->owner = OMRON_VFD; + next->prio = MB_QUERY_TYPE_CMD; + return E_OK; + } + return E_QUERY_BUFFER_END; +} + +uint16_t OmronVFD::write_Bit(uint16_t addr, int on) +{ + Query *same = modbus->nextSame(QUEUED, slaveAddress, addr, ku8MBWriteSingleCoil, on); + if (same && millis() - same->ts < 300) + { + } + + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = ku8MBWriteSingleCoil; + next->slave = slaveAddress; + next->addr = addr; + // modbus->setDebugSend(true); + next->value = on; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + next->owner = OMRON_VFD; + next->prio = MB_QUERY_TYPE_CMD; + return E_OK; + } + return E_QUERY_BUFFER_END; +} + +short OmronVFD::readSingle_16(int addr, int prio = 0) +{ + + Query *same = modbus->nextSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 1); + if (same && millis() - same->ts < OMRON_MX2_SAME_REQUEST_INTERVAL) + { + return; + } + if (modbus->numByState(DONE) < MODBUS_QUEUE_MIN_FREE) + { + return; + } + + if (modbus->numSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 1) > 1) + { + return; + } + + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = ku8MBReadHoldingRegisters; + next->slave = slaveAddress; + next->value = 1; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + next->prio = prio; + next->owner = OMRON_VFD; + return E_OK; + } + + return E_QUERY_BUFFER_END; +} + +short OmronVFD::read_16(int addr, int num, int prio = 0) +{ + + Query *same = modbus->nextSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 1); + + if (same && millis() - same->ts < OMRON_MX2_SAME_REQUEST_INTERVAL) + { + return; + } + + if (modbus->numByState(DONE) < MODBUS_QUEUE_MIN_FREE) + { + return; + } + + if (modbus->numSame(QUEUED, slaveAddress, addr, ku8MBReadHoldingRegisters, 1) > 1) + { + return; + } + + Query *next = modbus->nextQueryByState(DONE); + if (next) + { + next->fn = ku8MBReadHoldingRegisters; + next->slave = slaveAddress; + next->value = num; + next->addr = addr; + next->state = QUERY_STATE::QUEUED; + next->ts = millis(); + next->prio = prio; + next->owner = OMRON_VFD; + return E_OK; + } + return E_QUERY_BUFFER_END; +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Readme.md b/extrusion/lydia-print-head-v1/firmware/firmware/Readme.md new file mode 100644 index 0000000..6bdf497 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Readme.md @@ -0,0 +1,5 @@ +# TODOS + +- new PHStudio widgets: PID control & Display +- info tab: vfd status, PID status, sensor LEDS +- HMIs: shredder, extrusion, shredder && extrusion, asterix diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.cpp new file mode 100644 index 0000000..7e838d0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.cpp @@ -0,0 +1,54 @@ +/* + * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 + * Original code by Jesse Tane for http://labs.ideo.com August 2008 + * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support + * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop + * Modified Oct 2009 by Dan Clemens to work with timer1 of the ATMega1280 or Arduino Mega + * Modified April 2012 by Paul Stoffregen + * Modified again, June 2014 by Paul Stoffregen + * Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality + * + * This is free software. You can redistribute it and/or modify it under + * the terms of Creative Commons Attribution 3.0 United States License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ + * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. + * + */ + +#include "TimerOne.h" + +TimerOne Timer1; // preinstatiate + +unsigned short TimerOne::pwmPeriod = 0; +unsigned char TimerOne::clockSelectBits = 0; +void (*TimerOne::isrCallback)() = TimerOne::isrDefaultUnused; + +// interrupt service routine that wraps a user defined function supplied by attachInterrupt +#if defined (__AVR_ATtiny85__) +ISR(TIMER1_COMPA_vect) +{ + Timer1.isrCallback(); +} +#elif defined(__AVR__) +ISR(TIMER1_OVF_vect) +{ + Timer1.isrCallback(); +} + +#elif defined(__arm__) && defined(CORE_TEENSY) +void ftm1_isr(void) +{ + uint32_t sc = FTM1_SC; + #ifdef KINETISL + if (sc & 0x80) FTM1_SC = sc; + #else + if (sc & 0x80) FTM1_SC = sc & 0x7F; + #endif + Timer1.isrCallback(); +} + +#endif + +void TimerOne::isrDefaultUnused() +{ +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.h b/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.h new file mode 100644 index 0000000..940412d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/TimerOne.h @@ -0,0 +1,485 @@ +/* + * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 + * Original code by Jesse Tane for http://labs.ideo.com August 2008 + * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support + * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop + * Modified April 2012 by Paul Stoffregen - portable to other AVR chips, use inline functions + * Modified again, June 2014 by Paul Stoffregen - support Teensy 3.x & even more AVR chips + * Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality + * + * + * This is free software. You can redistribute it and/or modify it under + * the terms of Creative Commons Attribution 3.0 United States License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ + * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. + * + */ + +#ifndef TimerOne_h_ +#define TimerOne_h_ + +#if defined(ARDUINO) && ARDUINO >= 100 +#include "Arduino.h" +#else +#include "WProgram.h" +#endif + +#include "config/known_16bit_timers.h" +#if defined (__AVR_ATtiny85__) +#define TIMER1_RESOLUTION 256UL // Timer1 is 8 bit +#elif defined(__AVR__) +#define TIMER1_RESOLUTION 65536UL // Timer1 is 16 bit +#else +#define TIMER1_RESOLUTION 65536UL // assume 16 bits for non-AVR chips +#endif + +// Placing nearly all the code in this .h file allows the functions to be +// inlined by the compiler. In the very common case with constant values +// the compiler will perform all calculations and simply write constants +// to the hardware registers (for example, setPeriod). + + +class TimerOne +{ + +#if defined (__AVR_ATtiny85__) + public: + //**************************** + // Configuration + //**************************** + void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { + TCCR1 = _BV(CTC1); //clear timer1 when it matches the value in OCR1C + TIMSK |= _BV(OCIE1A); //enable interrupt when OCR1A matches the timer value + setPeriod(microseconds); + } + void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { + const unsigned long cycles = microseconds * ratio; + if (cycles < TIMER1_RESOLUTION) { + clockSelectBits = _BV(CS10); + pwmPeriod = cycles; + } else + if (cycles < TIMER1_RESOLUTION * 2UL) { + clockSelectBits = _BV(CS11); + pwmPeriod = cycles / 2; + } else + if (cycles < TIMER1_RESOLUTION * 4UL) { + clockSelectBits = _BV(CS11) | _BV(CS10); + pwmPeriod = cycles / 4; + } else + if (cycles < TIMER1_RESOLUTION * 8UL) { + clockSelectBits = _BV(CS12); + pwmPeriod = cycles / 8; + } else + if (cycles < TIMER1_RESOLUTION * 16UL) { + clockSelectBits = _BV(CS12) | _BV(CS10); + pwmPeriod = cycles / 16; + } else + if (cycles < TIMER1_RESOLUTION * 32UL) { + clockSelectBits = _BV(CS12) | _BV(CS11); + pwmPeriod = cycles / 32; + } else + if (cycles < TIMER1_RESOLUTION * 64UL) { + clockSelectBits = _BV(CS12) | _BV(CS11) | _BV(CS10); + pwmPeriod = cycles / 64UL; + } else + if (cycles < TIMER1_RESOLUTION * 128UL) { + clockSelectBits = _BV(CS13); + pwmPeriod = cycles / 128; + } else + if (cycles < TIMER1_RESOLUTION * 256UL) { + clockSelectBits = _BV(CS13) | _BV(CS10); + pwmPeriod = cycles / 256; + } else + if (cycles < TIMER1_RESOLUTION * 512UL) { + clockSelectBits = _BV(CS13) | _BV(CS11); + pwmPeriod = cycles / 512; + } else + if (cycles < TIMER1_RESOLUTION * 1024UL) { + clockSelectBits = _BV(CS13) | _BV(CS11) | _BV(CS10); + pwmPeriod = cycles / 1024; + } else + if (cycles < TIMER1_RESOLUTION * 2048UL) { + clockSelectBits = _BV(CS13) | _BV(CS12); + pwmPeriod = cycles / 2048; + } else + if (cycles < TIMER1_RESOLUTION * 4096UL) { + clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS10); + pwmPeriod = cycles / 4096; + } else + if (cycles < TIMER1_RESOLUTION * 8192UL) { + clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11); + pwmPeriod = cycles / 8192; + } else + if (cycles < TIMER1_RESOLUTION * 16384UL) { + clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10); + pwmPeriod = cycles / 16384; + } else { + clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10); + pwmPeriod = TIMER1_RESOLUTION - 1; + } + OCR1A = pwmPeriod; + OCR1C = pwmPeriod; + TCCR1 = _BV(CTC1) | clockSelectBits; + } + + //**************************** + // Run Control + //**************************** + void start() __attribute__((always_inline)) { + TCCR1 = 0; + TCNT1 = 0; + resume(); + } + void stop() __attribute__((always_inline)) { + TCCR1 = _BV(CTC1); + } + void restart() __attribute__((always_inline)) { + start(); + } + void resume() __attribute__((always_inline)) { + TCCR1 = _BV(CTC1) | clockSelectBits; + } + + //**************************** + // PWM outputs + //**************************** + //Not implemented yet for ATTiny85 + //TO DO + + //**************************** + // Interrupt Function + //**************************** + void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { + isrCallback = isr; + TIMSK |= _BV(OCIE1A); + } + void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { + if(microseconds > 0) setPeriod(microseconds); + attachInterrupt(isr); + } + void detachInterrupt() __attribute__((always_inline)) { + //TIMSK = 0; // Timer 0 and Timer 1 both use TIMSK register so setting it to 0 will override settings for Timer1 as well + TIMSK &= ~_BV(OCIE1A); + } + static void (*isrCallback)(); + static void isrDefaultUnused(); + + private: + static unsigned short pwmPeriod; + static unsigned char clockSelectBits; + static const byte ratio = (F_CPU)/ ( 1000000 ); + +#elif defined(__AVR__) + public: + //**************************** + // Configuration + //**************************** + void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { + TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer + TCCR1A = 0; // clear control register A + setPeriod(microseconds); + } + void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { + const unsigned long cycles = (F_CPU / 2000000) * microseconds; + if (cycles < TIMER1_RESOLUTION) { + clockSelectBits = _BV(CS10); + pwmPeriod = cycles; + } else + if (cycles < TIMER1_RESOLUTION * 8) { + clockSelectBits = _BV(CS11); + pwmPeriod = cycles / 8; + } else + if (cycles < TIMER1_RESOLUTION * 64) { + clockSelectBits = _BV(CS11) | _BV(CS10); + pwmPeriod = cycles / 64; + } else + if (cycles < TIMER1_RESOLUTION * 256) { + clockSelectBits = _BV(CS12); + pwmPeriod = cycles / 256; + } else + if (cycles < TIMER1_RESOLUTION * 1024) { + clockSelectBits = _BV(CS12) | _BV(CS10); + pwmPeriod = cycles / 1024; + } else { + clockSelectBits = _BV(CS12) | _BV(CS10); + pwmPeriod = TIMER1_RESOLUTION - 1; + } + ICR1 = pwmPeriod; + TCCR1B = _BV(WGM13) | clockSelectBits; + } + + //**************************** + // Run Control + //**************************** + void start() __attribute__((always_inline)) { + TCCR1B = 0; + TCNT1 = 0; // TODO: does this cause an undesired interrupt? + resume(); + } + void stop() __attribute__((always_inline)) { + TCCR1B = _BV(WGM13); + } + void restart() __attribute__((always_inline)) { + start(); + } + void resume() __attribute__((always_inline)) { + TCCR1B = _BV(WGM13) | clockSelectBits; + } + + //**************************** + // PWM outputs + //**************************** + void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { + unsigned long dutyCycle = pwmPeriod; + dutyCycle *= duty; + dutyCycle >>= 10; + if (pin == TIMER1_A_PIN) OCR1A = dutyCycle; + #ifdef TIMER1_B_PIN + else if (pin == TIMER1_B_PIN) OCR1B = dutyCycle; + #endif + #ifdef TIMER1_C_PIN + else if (pin == TIMER1_C_PIN) OCR1C = dutyCycle; + #endif + } + void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { + if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); } + #ifdef TIMER1_B_PIN + else if (pin == TIMER1_B_PIN) { pinMode(TIMER1_B_PIN, OUTPUT); TCCR1A |= _BV(COM1B1); } + #endif + #ifdef TIMER1_C_PIN + else if (pin == TIMER1_C_PIN) { pinMode(TIMER1_C_PIN, OUTPUT); TCCR1A |= _BV(COM1C1); } + #endif + setPwmDuty(pin, duty); + TCCR1B = _BV(WGM13) | clockSelectBits; + } + void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { + if (microseconds > 0) setPeriod(microseconds); + pwm(pin, duty); + } + void disablePwm(char pin) __attribute__((always_inline)) { + if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1); + #ifdef TIMER1_B_PIN + else if (pin == TIMER1_B_PIN) TCCR1A &= ~_BV(COM1B1); + #endif + #ifdef TIMER1_C_PIN + else if (pin == TIMER1_C_PIN) TCCR1A &= ~_BV(COM1C1); + #endif + } + + //**************************** + // Interrupt Function + //**************************** + void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { + isrCallback = isr; + TIMSK1 = _BV(TOIE1); + } + void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { + if(microseconds > 0) setPeriod(microseconds); + attachInterrupt(isr); + } + void detachInterrupt() __attribute__((always_inline)) { + TIMSK1 = 0; + } + static void (*isrCallback)(); + static void isrDefaultUnused(); + + private: + // properties + static unsigned short pwmPeriod; + static unsigned char clockSelectBits; + + + + + + +#elif defined(__arm__) && defined(CORE_TEENSY) + +#if defined(KINETISK) +#define F_TIMER F_BUS +#elif defined(KINETISL) +#define F_TIMER (F_PLL/2) +#endif + + public: + //**************************** + // Configuration + //**************************** + void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { + setPeriod(microseconds); + } + void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { + const unsigned long cycles = (F_TIMER / 2000000) * microseconds; + // A much faster if-else + // This is like a binary serch tree and no more than 3 conditions are evaluated. + // I haven't checked if this becomes significantly longer ASM than the simple ladder. + // It looks very similar to the ladder tho: same # of if's and else's + + /* + // This code does not work properly in all cases :( + // https://github.com/PaulStoffregen/TimerOne/issues/17 + if (cycles < TIMER1_RESOLUTION * 16) { + if (cycles < TIMER1_RESOLUTION * 4) { + if (cycles < TIMER1_RESOLUTION) { + clockSelectBits = 0; + pwmPeriod = cycles; + }else{ + clockSelectBits = 1; + pwmPeriod = cycles >> 1; + } + }else{ + if (cycles < TIMER1_RESOLUTION * 8) { + clockSelectBits = 3; + pwmPeriod = cycles >> 3; + }else{ + clockSelectBits = 4; + pwmPeriod = cycles >> 4; + } + } + }else{ + if (cycles > TIMER1_RESOLUTION * 64) { + if (cycles > TIMER1_RESOLUTION * 128) { + clockSelectBits = 7; + pwmPeriod = TIMER1_RESOLUTION - 1; + }else{ + clockSelectBits = 7; + pwmPeriod = cycles >> 7; + } + } + else{ + if (cycles > TIMER1_RESOLUTION * 32) { + clockSelectBits = 6; + pwmPeriod = cycles >> 6; + }else{ + clockSelectBits = 5; + pwmPeriod = cycles >> 5; + } + } + } + */ + if (cycles < TIMER1_RESOLUTION) { + clockSelectBits = 0; + pwmPeriod = cycles; + } else + if (cycles < TIMER1_RESOLUTION * 2) { + clockSelectBits = 1; + pwmPeriod = cycles >> 1; + } else + if (cycles < TIMER1_RESOLUTION * 4) { + clockSelectBits = 2; + pwmPeriod = cycles >> 2; + } else + if (cycles < TIMER1_RESOLUTION * 8) { + clockSelectBits = 3; + pwmPeriod = cycles >> 3; + } else + if (cycles < TIMER1_RESOLUTION * 16) { + clockSelectBits = 4; + pwmPeriod = cycles >> 4; + } else + if (cycles < TIMER1_RESOLUTION * 32) { + clockSelectBits = 5; + pwmPeriod = cycles >> 5; + } else + if (cycles < TIMER1_RESOLUTION * 64) { + clockSelectBits = 6; + pwmPeriod = cycles >> 6; + } else + if (cycles < TIMER1_RESOLUTION * 128) { + clockSelectBits = 7; + pwmPeriod = cycles >> 7; + } else { + clockSelectBits = 7; + pwmPeriod = TIMER1_RESOLUTION - 1; + } + + uint32_t sc = FTM1_SC; + FTM1_SC = 0; + FTM1_MOD = pwmPeriod; + FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_CPWMS | clockSelectBits | (sc & FTM_SC_TOIE); + } + + //**************************** + // Run Control + //**************************** + void start() __attribute__((always_inline)) { + stop(); + FTM1_CNT = 0; + resume(); + } + void stop() __attribute__((always_inline)) { + FTM1_SC = FTM1_SC & (FTM_SC_TOIE | FTM_SC_CPWMS | FTM_SC_PS(7)); + } + void restart() __attribute__((always_inline)) { + start(); + } + void resume() __attribute__((always_inline)) { + FTM1_SC = (FTM1_SC & (FTM_SC_TOIE | FTM_SC_PS(7))) | FTM_SC_CPWMS | FTM_SC_CLKS(1); + } + + //**************************** + // PWM outputs + //**************************** + void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { + unsigned long dutyCycle = pwmPeriod; + dutyCycle *= duty; + dutyCycle >>= 10; + if (pin == TIMER1_A_PIN) { + FTM1_C0V = dutyCycle; + } else if (pin == TIMER1_B_PIN) { + FTM1_C1V = dutyCycle; + } + } + void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { + setPwmDuty(pin, duty); + if (pin == TIMER1_A_PIN) { + *portConfigRegister(TIMER1_A_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; + } else if (pin == TIMER1_B_PIN) { + *portConfigRegister(TIMER1_B_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; + } + } + void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { + if (microseconds > 0) setPeriod(microseconds); + pwm(pin, duty); + } + void disablePwm(char pin) __attribute__((always_inline)) { + if (pin == TIMER1_A_PIN) { + *portConfigRegister(TIMER1_A_PIN) = 0; + } else if (pin == TIMER1_B_PIN) { + *portConfigRegister(TIMER1_B_PIN) = 0; + } + } + + //**************************** + // Interrupt Function + //**************************** + void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { + isrCallback = isr; + FTM1_SC |= FTM_SC_TOIE; + NVIC_ENABLE_IRQ(IRQ_FTM1); + } + void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { + if(microseconds > 0) setPeriod(microseconds); + attachInterrupt(isr); + } + void detachInterrupt() __attribute__((always_inline)) { + FTM1_SC &= ~FTM_SC_TOIE; + NVIC_DISABLE_IRQ(IRQ_FTM1); + } + static void (*isrCallback)(); + static void isrDefaultUnused(); + + private: + // properties + static unsigned short pwmPeriod; + static unsigned char clockSelectBits; + +#undef F_TIMER + +#endif +}; + +extern TimerOne Timer1; + +#endif + diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/VFD.h b/extrusion/lydia-print-head-v1/firmware/firmware/VFD.h new file mode 100644 index 0000000..1b8c3a0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/VFD.h @@ -0,0 +1,110 @@ +#ifndef VFD_H +#define VFD_H + +#include +#include "./Addon.h" +#include "./enums.h" +#include "./config.h" + +#ifdef HAS_STATES +#include +#endif + +class VFD : public Addon +{ +public: + + enum DIRECTION + { + FORWARD = 1, + STOP = 0, + REVERSE = 2 + }; + + VFD() : Addon(VFD_STR, VFD_CONTROL), + direction(STOP){}; + + void rev(short nop) + { + update(DIRECTION::REVERSE); + } + + void fwd(short nop) + { + update(DIRECTION::FORWARD); + } + + short setup() + { + pinMode(FWD_PIN, OUTPUT); + pinMode(REV_PIN, OUTPUT); + + stop(); + } + + short stop(short nop = 0) + { + update(DIRECTION::STOP); + } + + void speed(int aValue) + { + } + + virtual void debug(Stream *stream) + { + // *stream << this->name << ":" << SPACE(direction); + } + + virtual void info(Stream *stream) + { + // *stream << this->name << "\n\t" << SPACE(": FWD PIN " << FWD_PIN << " | REV PIN " << REV_PIN); + } + + uchar direction; + uchar lastDirection; + millis_t dt; + +#ifdef HAS_STATES + String state() + { + const int capacity = JSON_OBJECT_SIZE(2); + StaticJsonDocument doc; + doc["0"] = id; + doc["1"] = direction; + return doc.as(); + } +#endif +private: + void update(uchar newDirection) + { + if (direction != newDirection) + { + dt = now; + lastDirection = direction; + direction = newDirection; + switch (direction) + { + case DIRECTION::FORWARD: + { + digitalWrite(REV_PIN, LOW); + digitalWrite(FWD_PIN, HIGH); + break; + } + case DIRECTION::REVERSE: + { + digitalWrite(FWD_PIN, LOW); + digitalWrite(REV_PIN, HIGH); + break; + } + case DIRECTION::STOP: + { + digitalWrite(FWD_PIN, LOW); + digitalWrite(REV_PIN, LOW); + } + } + } + } +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/Version.h b/extrusion/lydia-print-head-v1/firmware/firmware/Version.h new file mode 100644 index 0000000..e406747 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/Version.h @@ -0,0 +1,7 @@ +#ifndef VERSION_H + + #define VERSION_H + + #define VERSION '1.0.0|fe804146360b35c845dfdaa7781350e91aab19d2' + + #endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/Auto-Reverse.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Auto-Reverse.h new file mode 100644 index 0000000..df6d592 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Auto-Reverse.h @@ -0,0 +1,35 @@ +#ifndef MOTOR_AUTO_REVERSE_H +#define MOTOR_AUTO_REVERSE_H + +#include +#include "../Addon.h" +#include "../config.h" +#include +#include "../macros.h" +#include "../enums.h" + +class App; + +class AutoReverse : Addon +{ +public: + AutoReverse(App *app); + AutoReverse() : Addon(AUTO_REVERSE_STR, AUTO_REVERSE) {} + + virtual short setup() + { + } + virtual short ok() + { + return true; + } + void debug(Stream *stream) + { + // *stream << this->name << ":" << this->ok(); + } + void info(Stream *stream) + { + // *stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN); + } +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/CartridgeFull.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/CartridgeFull.h new file mode 100644 index 0000000..9f199c1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/CartridgeFull.h @@ -0,0 +1,45 @@ +#ifndef CARTRIDGE_FULL_H +#define CARTRIDGE_FULL_H + +#include +#include "Addon.h" +#include + +#include "../config.h" +#include "../macros.h" + +#include "../components/PhotoElectricSensor.h" + +// Addon to detect when the container is full of shredded flakes. + +class CartridgeFull : public Addon +{ +private: + PhotoElectricSensor sensor; + +public: + CartridgeFull() : sensor(CARTRIDGE_FULL_1, CARTRIDGE_FULL_1_INTERVAL), + Addon(CARTRDIGE_FULL_STR, CARTRIDGE_FULL_SENSOR_1) + { + // this->setFlag(DEBUG); + } + + virtual short loop() + { + this->sensor.loop(); + } + virtual short ok() + { + return sensor.ok(); + } + void debug(Stream *stream) + { + //*stream << this->name << ":" << this->ok(); + } + void info(Stream *stream) + { + //*stream << this->name << "\n\t : " << SPACE("CARTRIDGE FULL 1" << CARTRIDGE_FULL_1); + } +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/DipSwitch.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/DipSwitch.h new file mode 100644 index 0000000..f4cf6b8 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/DipSwitch.h @@ -0,0 +1,51 @@ +#ifndef _DIP_SWITCH_H +#define _DIP_SWITCH_H + +#include "addon.h" +#include + +class _DipSwitch : public Addon +{ +public: + _DipSwitch(int number_of_pins, int *pins) : _number_of_pins(number_of_pins), + _pins(_pins), + Addon("Dip Switch", DIP_SWITCH) + { + // this->setFlag(DEBUG); + } + + short setup() + { + for (int i = 0; i < _number_of_pins; i++) + { + pinMode(_pins[i], INPUT_PULLUP); + } + } + + short loop() + { + _value = 0; + for (int i = 0; i < _number_of_pins; i++) + { + _value += digitalRead(_pins[i]) << i; + } + return _value; + } + + void debug(Stream *stream) + { + //*stream << this->name << ":" << digitalRead(49); + } + + void info(Stream *stream) + { + //*stream << this->name << "\n\t : "; + } + +private: + int _number_of_pins; + int *_pins; + int _value; +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/DirectionSwitch.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/DirectionSwitch.h new file mode 100644 index 0000000..7dd766b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/DirectionSwitch.h @@ -0,0 +1,33 @@ +#ifndef DIRECTION_SWITCH_H +#define DIRECTION_SWITCH_H + +#include "../config.h" +#include "../components/3pos.h" +#include "../Addon.h" +#include +#include "../common/macros.h" + +class DirectionSwitch : public Addon { + public: + Pos3 dir_switch; + DirectionSwitch () : + dir_switch(DIR_SWITCH_UP_PIN, DIR_SWITCH_DOWN_PIN), + Addon(DIRECTION_SWITCH_STR,DIRECTION_SWITCH){} + + void debug(Stream* stream){ + //*stream << this->name << ":" << + // SPACE(dir_switch.switch_pos) << SPACE(dir_switch.last_switch); + } + void info(Stream* stream){ + //*stream << this->name << "\n\t : " SPACE("Up Pin:" << DIR_SWITCH_UP_PIN) << SPACE("\t | Down Pin :" << DIR_SWITCH_DOWN_PIN); + } + short setup(){ + dir_switch.setup(); + return dir_switch.loop(); + } + short loop(){ + return dir_switch.loop(); + } +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/EnclosureSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/EnclosureSensor.h new file mode 100644 index 0000000..7d35e92 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/EnclosureSensor.h @@ -0,0 +1,43 @@ +#ifndef ENCLOSURE_SENSOR_H +#define ENCLOSURE_SENSOR_H + +#include "../config.h" +#include "../Addon.h" +#include +#include "../macros.h" +#include "../components/Proximity_Sensor.h" + +class EnclosureSensor : public Addon +{ +public: + ProximitySensor sensor1; + ProximitySensor sensor2; + EnclosureSensor() : sensor1(ENCLOSURE_SENSOR_PIN_1), + sensor2(ENCLOSURE_SENSOR_PIN_2), + Addon(ENCLOSURE_SENSOR_STR, ENCLOSURE_SENSOR) {} + + void debug(Stream *stream) + { + //*stream << this->name << ":" + // << SPACE(sensor1.value) << ":" << SPACE(sensor2.value) << " | ok : " << ok(); + } + void info(Stream *stream) + { + //*stream << this->name << SPACE("\n\t : " << ENCLOSURE_SENSOR_PIN_1) << SPACE(" : " << ENCLOSURE_SENSOR_PIN_2); + } + short setup() + { + sensor1.setup(); + sensor2.setup(); + sensor1.loop(); + sensor2.loop(); + } + short loop() + { + sensor1.loop(); + sensor2.loop(); + } + short ok() { return sensor1.value == 1 && sensor2.value == 1; } +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorIdle.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorIdle.h new file mode 100644 index 0000000..110a421 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorIdle.h @@ -0,0 +1,32 @@ +#ifndef MOTOR_IDLE_H +#define MOTOR_IDLE_H + +#include +#include "Addon.h" +#include "config.h" +#include +#include "../common/macros.h" + +class MotorIdle : public Addon +{ +public: + MotorIdle() : Addon(MOTOR_IDLE_STR, MOTOR_IDLE) {} + + virtual short setup() + { + pinMode(MOTOR_IDLE_PIN, INPUT_PULLUP); + } + virtual short ok() + { + return !digitalRead(MOTOR_IDLE_PIN); + } + void debug(Stream *stream) + { + //*stream << this->name << ":" << this->ok(); + } + void info(Stream *stream) + { + //*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN); + } +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorLoad.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorLoad.h new file mode 100644 index 0000000..740450d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorLoad.h @@ -0,0 +1,145 @@ +#ifndef MOTOR_OVERLOAD_H +#define MOTOR_OVERLOAD_H + +#include +#include +#include "../Addon.h" +#include "../config.h" + +#include "../common/macros.h" +#include "../common/ppmath.h" + +#ifdef HAS_STATES +#include +#endif + +class MotorLoad : public Addon +{ +public: + enum MSTATE + { + NONE = 0, + IDLE = 1, + LOAD = 2, + OVERLOAD = 2, + ERROR = 3 + }; + +#ifdef HAS_STATES + + String state() + { + const int capacity = JSON_OBJECT_SIZE(2); + StaticJsonDocument doc; + doc['0'] = id; + doc['s'] = currentState; + return doc.as(); + } +#endif + + MotorLoad(short _pin) : dt(0), + pin(_pin), + load(0), + lastIdle(0), + lastLoad(0), + lastOverload(0), + currentState(NONE), + lastState(NONE), + Addon(MOTOR_LOAD_STR, MOTOR_LOAD) + { + // this->setFlag(DEBUG); + } + + short jammed() + { + return RANGE(load, MOTOR_OVERLOAD_RANGE_MIN, MOTOR_OVERLOAD_RANGE_MAX); + } + + short idle() + { + return RANGE(load, MOTOR_IDLE_LOAD_RANGE_MIN, MOTOR_IDLE_LOAD_RANGE_MAX); + } + + short shredding() + { + return RANGE(load, MOTOR_SHREDDING_LOAD_RANGE_MIN, MOTOR_SHREDDING_LOAD_RANGE_MAX); + } + + short setup() + { + loop(); + } + + short loop() + { + if (now - last > MOTOR_LOAD_READ_INTERVAL) + { + load = analogRead(pin); + last = now; + uchar newState = NONE; + if (idle()) + { + lastIdle = now; + newState = IDLE; + } + else if (jammed()) + { + lastOverload = now; + newState = OVERLOAD; + } + else if (shredding()) + { + lastLoad = now; + newState = LOAD; + } + + if (newState != currentState) + { + dt = now; + lastState = currentState; + currentState = newState; + } + } + return load; + } + + short ok() + { + if (currentState == IDLE && + (now - dt) > MAX_IDLE_TIME) + { + return E_MOTOR_DT_IDLE; + } + + if (currentState == LOAD && + (now - dt) > MAX_SHRED_TIME) + { + return E_MOTOR_DT_OVERLOAD; + } + + return E_OK; + } + + void debug(Stream *stream) + { + // *stream << this->name << ":" << jammed() << SPACE('@') << load << SPACE(":state") << currentState; + } + + void info(Stream *stream) + { + // *stream << this->name << "\n\t : " SPACE("Pin:" << pin); + } + + millis_t dt; + uchar lastState; + uchar currentState; + millis_t lastIdle; + millis_t lastLoad; + millis_t lastOverload; +protected: + short pin; + short load; + + +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorSpeed.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorSpeed.h new file mode 100644 index 0000000..6f2d9ce --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorSpeed.h @@ -0,0 +1,41 @@ +#ifndef MOTOR_SPEED_H +#define MOTOR_SPEED_H + +#include +#include "Addon.h" +#include "config.h" +#include +#include "../common/macros.h" +#include "IRSensor.h" + +class MotorSpeed : public Addon +{ +public: + MotorSpeed() : + sensor(new IRSensor()), + Addon(MOTOR_IR_SPEED_STR, MOTOR_SPEED) {} + + virtual short setup() + { + sensor->setup(); + } + virtual short ok() + { + return this->sensor->ok(); + } + virtual short loop() + { + this->sensor->loop(); + } + void debug(Stream *stream) + { + //*stream << this->name << ":" << this->ok(); + } + void info(Stream *stream) + { + //*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN); + } + protected: + IRSensor *sensor; +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorTemperature.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorTemperature.h new file mode 100644 index 0000000..63d152c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/MotorTemperature.h @@ -0,0 +1,40 @@ +#ifndef MOTOR_TEMPERATURE_H +#define MOTOR_TEMPERATURE_H + +#include +#include "Addon.h" +#include "config.h" +#include +#include "../common/macros.h" +#include "TemperatureSensor.h" + +class MotorTemperature : public Addon +{ +private: + TemperatureSensor sensor; + +public: + MotorTemperature() : sensor(MOTOR_TEMPERTURE_SCK_PIN, MOTOR_TEMPERTURE_CS_PIN, MOTOR_TEMPERTURE_SO_PIN, MOTOR_TEMPERTURE_MAX, MOTOR_TEMPERTURE_INTERVAL), + Addon(MOTOR_TEMPERATURE_STR, MOTOR_TEMPERATURE) {} + + virtual short ok() + { + return sensor.ok(); + } + void debug(Stream *stream) + { + // *stream << this->name << ":" << this->ok(); + } + void info(Stream *stream) + { + /* + *stream << this->name << "\n\t : " << + SPACE("Pin SCK:" << MOTOR_TEMPERTURE_SCK_PIN ) << + SPACE("Pin CS :" << MOTOR_TEMPERTURE_CS_PIN ) << + SPACE("Pin SO:" << MOTOR_TEMPERTURE_SO_PIN ) << + SPACE("Max" << MOTOR_TEMPERTURE_MAX ) << + SPACE("Interval" << MOTOR_TEMPERTURE_INTERVAL ); + */ + } +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/OperationModeSwitch.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/OperationModeSwitch.h new file mode 100644 index 0000000..4822eab --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/OperationModeSwitch.h @@ -0,0 +1,148 @@ +#ifndef OPERATION_MODE_SWITCH_H +#define OPERATION_MODE_SWITCH_H + +#ifdef HAS_STATES +#include +#endif + +#ifndef OP_MODE_ANALOG +#include +#endif + +#include "../config.h" +#include "../Addon.h" +#include +#include "../common/macros.h" +#include "../common/ppmath.h" + +class OperationModeSwitch : public Addon +{ + +public: + short pin1; +#ifdef OP_MODE_ANALOG + ushort level1; + ushort level2; + ushort level3; + OperationModeSwitch(short _pin1, ushort _level1, ushort _level2, ushort _level3) : pin1(_pin1), + level1(_level1), + level2(_level2), + level3(_level3), + Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH) + { + //setFlag(DEBUG); + } +#ifdef HAS_STATES + String state() + { + const int capacity = JSON_OBJECT_SIZE(2); + StaticJsonDocument doc; + doc['0'] = id; + doc['1'] = value(); + return doc.as(); + } +#endif + void debug(Stream *stream) + { + //*stream << this->name << SPACE(value()); + } + void info(Stream *stream) + { + //*stream << this->name << "\n\t "; + } + + short value() + { + ushort value = analogRead(pin1); + if (RANGE(value, level1 - 10, level1 + 10)) + { + return OP_DEBUG; + } + if (RANGE(value, level2 - 10, level2 + 10)) + { + return OP_NORMAL; + } + if (RANGE(value, level3 - 10, level3 + 10)) + { + return OP_SERVICE; + } + return OP_NONE; + } + short setup() + { + } + + short loop() + { + // Serial.println(analogRead(pin1)); + } + +#else + Bounce debouncer1; + Bounce debouncer2; + Bounce debouncer3; + short pin1; + short pin2; + short pin3; + + OperationModeSwitch(short _pin1, short _pin2, short _pin3) : pin1(_pin1), // 1-2 + pin2(_pin2), // 5-6 + pin3(_pin3), // 9-10 + Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH) + { + } + + void debug(Stream *stream) + { + *stream << this->name << ": PIN1 " << SPACE(!debouncer1.read()) << ": PIN2 " << SPACE(!debouncer2.read()) << ": PIN3 " << SPACE(!debouncer3.read()); + } + void info(Stream *stream) + { + *stream << this->name << "\n\t : "; + } + + short value() + { + if (!debouncer1.read()) + { + return OP_DEBUG; + } + + if (!debouncer2.read()) + { + return OP_NORMAL; + } + + if (!debouncer3.read()) + { + return OP_SERVICE; + } + + return OP_NONE; + } + short setup() + { + this->debouncer1 = Bounce(); + this->debouncer1.attach(this->pin1, INPUT_PULLUP); + this->debouncer1.interval(25); + + this->debouncer2 = Bounce(); + this->debouncer2.attach(this->pin2, INPUT_PULLUP); + this->debouncer2.interval(25); + + this->debouncer3 = Bounce(); + this->debouncer3.attach(this->pin3, INPUT_PULLUP); + this->debouncer3.interval(25); + } + + short loop() + { + this->debouncer1.update(); + this->debouncer2.update(); + this->debouncer3.update(); + } + +#endif +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/Power.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Power.h new file mode 100644 index 0000000..98b2da2 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Power.h @@ -0,0 +1,140 @@ +#ifndef POWER_H +#define POWER_H + +#include "../config.h" + +#ifdef HAS_STATES +#include +#endif + +#include "../Addon.h" +#include +#include "../common/macros.h" +#include "../config.h" +#include "../components/CurrentSensor.h" +class Power : public Addon +{ +public: + Power(int _power0, int _power1) : power0(_power0), + power1(_power1), + primary(false), + secondary(false), + slots({false, false}), +#ifdef POWER_CSENSOR_PRIMARY + cSensorPrim(CurrentSensor(POWER_CSENSOR_PRIMARY, 200)), +#endif +#ifdef POWER_CSENSOR_SECONDARY + cSensorSec(CurrentSensor(POWER_CSENSOR_SECONDARY, 200)), +#endif + Addon(POWER_STR, POWER) + { + // setFlag(DEBUG); + } +#ifdef HAS_STATES + String state() + { + const int capacity = JSON_OBJECT_SIZE(4); + StaticJsonDocument doc; + doc['0'] = id; + doc['1'] = slots[0]; + doc['2'] = slots[1]; + return doc.as(); + } +#endif + void debug(Stream *stream) + { + *stream << this->name << ":" << cSensorSec.value; + } + void info(Stream *stream) + { + //*stream << this->name; + } + + short setup() + { +#ifdef POWER_0 + pinMode(power0, OUTPUT); +#endif +#ifdef POWER_1 + pinMode(power1, OUTPUT); +#endif + +#ifdef POWER_CSENSOR_PRIMARY + cSensorPrim.setup(); +#endif + +#ifdef POWER_CSENSOR_SECONDARY + cSensorSec.setup(); +#endif + } + + short on(short slot) + { +#ifdef USE_CONTROLLINO + digitalWrite(slot == POWER_PRIMARY ? power0 : power1, POWER_NC ? HIGH : LOW); +#else + analogWrite(slot == POWER_PRIMARY ? power0 : power1, POWER_NC ? 1024 : 0); +#endif + slots[slot] = true; + return slots[slot]; + } + short isOn(short slot) + { + return slots[slot]; + } + short off(short slot) + { +#ifdef USE_CONTROLLINO + digitalWrite(slot == POWER_PRIMARY ? power0 : power1, POWER_NC ? 1024 : 0); +#else + analogWrite(slot == POWER_PRIMARY ? power0 : power1, POWER_NC ? 0 : 1024); +#endif + slots[slot] = false; + return slots[slot]; + } + + short check(short slot) + { + switch (slot) + { + case POWER_PRIMARY: + { + + #ifdef POWER_CSENSOR_PRIMARY + //return slot[POWER_PRIMARY] && cSenorPrim.ok(); + #else + // return slots[POWER_PRIMARY]; + #endif + + break; + } + } + } + + short loop() + { + +#ifdef POWER_CSENSOR_PRIMARY + cSensorPrim.loop(); +#endif + +#ifdef POWER_CSENSOR_SECONDARY + cSensorSec.loop(now); +#endif + } + + int power0; + int power1; + bool primary; + bool secondary; + int slots[2]; +#ifdef POWER_CSENSOR_SECONDARY + CurrentSensor cSensorSec; +#endif +#ifdef POWER_CSENSOR_PRIMARY + CurrentSensor cSensorPrim; +#endif +protected: +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/Reset.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Reset.h new file mode 100644 index 0000000..9b1cab2 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Reset.h @@ -0,0 +1,30 @@ +#ifndef RESET_H +#define RESET_H + +// This module uses currently a normally closed momentary button. + +static millis_t sw_reset_TS = 0; + +static void reset_setup() +{ + pinMode(RESET_PIN, INPUT_PULLUP); + sw_reset_TS = millis(); +} + +static void reset_loop() +{ + if (millis() - sw_reset_TS > RESET_INTERVAL) { + #if RESET_NC == true + // globals.isReset = digitalRead(RESET_PIN); + #else + // globals.isReset = !digitalRead(RESET_PIN); + #endif + + sw_reset_TS = millis(); + // if(globals.isReset && DEBUG){ + // Serial.println("reset"); + // } + } +} + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/Status.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Status.h new file mode 100644 index 0000000..881e3ee --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/Status.h @@ -0,0 +1,64 @@ +#ifndef STATUS_H +#define STATUS_H + +static millis_t status_blink_TS = 0; +static bool doBlink = false; +static bool last_blink = true; +static millis_t blink_start_ts; +static millis_t max_blink_time = HOUR_MS; // stop blinking in an hour + +// This is using currently 2 LEDs : red & green, running at 220V via relay. + +static void status_setup() { } + +static void status_loop(){ + + if (millis() - status_blink_TS > 1000 ) { + status_blink_TS = millis(); + last_blink = !last_blink; + if(doBlink){ + //analogWrite(STATUS_ERROR_PIN, last_blink ? RELAY_ON : RELAY_OFF); + } + if(millis() - status_blink_TS > max_blink_time ){ + doBlink = false; + } + } +} + +static void status_blink(bool blink){ + if(!doBlink && blink){ + blink_start_ts = millis(); + } + doBlink = blink; +} + +static void setStatusAllOn(){ + if(doBlink){ + return; + } + digitalWrite(STATUS_POWER_PIN, HIGH); +} + +static void setStatusAllOff(){ + if(doBlink){ + return; + } + digitalWrite(STATUS_POWER_PIN, LOW); +} + +static void setStatus(bool error) { + /* + if(doBlink){ + return; + } + if (error) { + analogWrite(STATUS_ERROR_PIN, RELAY_ON); + analogWrite(STATUS_OK_PIN, RELAY_OFF); + } else { + analogWrite(STATUS_OK_PIN, RELAY_ON); + analogWrite(STATUS_ERROR_PIN, RELAY_OFF); + } + */ +} + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/addons/TemperatureSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/addons/TemperatureSensor.h new file mode 100644 index 0000000..e17f995 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/addons/TemperatureSensor.h @@ -0,0 +1,42 @@ +#ifndef TEMPERATURE_SENSOR_H +#define TEMPERATURE_SENSOR_H + +#include +#include "../config.h" +#include "../macros.h" +#include "../time.h" + +class TemperatureSensor +{ + +public: + TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)), + temperature(), + temperature_TS(millis()), + maxTemp(_max), + interval(_interval) {} + + bool ok() + { + return temperature < maxTemp; + } + + void loop() + { + + if (millis() - temperature_TS > interval) + { + temperature_TS = millis(); + temperature = ktc.readCelsius(); + } + } + +private: + MAX6675 ktc; + short temperature; + short maxTemp; + short interval; + millis_t temperature_TS; +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/app.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/app.cpp new file mode 100644 index 0000000..7e0c682 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/app.cpp @@ -0,0 +1,307 @@ +#include +#include +#include + +#include "app.h" +#include "features.h" + +#include + +static Addon *addonsArray[10]; + +short App::ok() +{ + return E_OK; +} + +App::App() : Addon("APP", APP, 1 << STATE), +#ifdef HAS_DIRECTION_SWITCH + dirSwitch(new DirectionSwitch()), +#endif +#ifdef ENCLOSURE_SENSOR + enclosureSensor(new EnclosureSensor()), +#endif +#ifdef HAS_VFD + vfd(new VFD()), +#endif +#ifdef MOTOR_HAS_TEMPERTURE + mHeat(new MotorTemperature()), +#endif +#ifdef HAS_MOTOR_IR_SENSOR + mSpeed(new MotorSpeed()), +#endif +#ifdef MOTOR_LOAD_PIN + mLoad(new MotorLoad(MOTOR_LOAD_PIN)), +#endif +#ifdef HAS_SERIAL + serialBridge(new PPSerial(Serial)), +#endif +#ifdef HAS_OP_MODE_SWITCH +#ifdef OP_MODE_ANALOG + opModeSwitch(new OperationModeSwitch(OP_MODE_1_PIN, 120, 60, 30)), +#else + opModeSwitch(new OperationModeSwitch(OP_MODE_1_PIN, OP_MODE_2_PIN, OP_MODE_3_PIN)), +#endif +#endif +#ifdef HAS_MODBUS_BRIDGE + modbusBridge(new ModbusBridge()), +#endif +#ifdef HAS_OMRON_VFD_MODBUS + omronVFD(new OmronVFD(modbusBridge, OMRON_MX2_SLAVE_ID)), +#endif +#ifdef OMRON_PID_SLAVE_START + pids(new OmronPID(modbusBridge, OMRON_PID_SLAVE_START)), +#endif + shredState(0) +{ + //#if defined(MODBUS_BRIDGE) && defined(HAS_VFD) + // vfd->modbus = modbusBridge; + //#endif + /// modbusBridge->debug(&Serial); +} + +#ifdef HAS_STATES +String App::state() +{ + const int capacity = JSON_OBJECT_SIZE(6); + StaticJsonDocument doc; + doc["0"] = id; + doc["1"] = _state; + doc["2"] = shredState; + doc["3"] = overloaded; + doc["4"] = _error; + doc["5"] = freeMemory(); + return doc.as(); +} +#endif + +short App::getAppState(short val) +{ + return _state; +} +void (*resetFunction)(void) = 0; // Self reset (to be used with watchdog) + +short App::setAppState(short newState) +{ +} + +void printMem() +{ + Serial.print("mem: "); + Serial.print(freeMemory()); + Serial.println('--'); +} +short App::setup() +{ + Serial.begin(DEBUG_BAUD_RATE); + Serial.println("Booting Firmware ...................... "); + addons.setStorage(addonsArray); + setup_addons(); + printMem(); + digitalWrite(STATUS_POWER_PIN, HIGH); + /* + powerSwitch->on(0); + powerSwitch->on(1); + delay(4000); + dFC.initFC(); + */ + +#ifdef MEARSURE_PERFORMANCE + printPerfTS = 0; + addonLoopTime = 0; + bridgeLoopTime = 0; +#endif + debugTS = 0; + comTS = 0; + loopTS = 0; + shredState = 0; + overloaded = 0; + _state = 0; + /* + timer.every(5000, [](App *app) -> void { + printMem(); + }, + this); + */ +} + +void App::loop_service() +{ +#ifdef HAS_POWER + powerSwitch->on(POWER_PRIMARY); +#endif + // _loop_motor_manual(); +} +void App::_loop_motor_manual() +{ + +#if defined(HAS_DIRECTION_SWITCH) && defined(HAS_VFD) + uchar sw = this->dirSwitch->loop(); + if (sw == 2) + { + this->vfd->fwd(true); + } + else if (sw == 1) + { + this->vfd->rev(true); + } + else + { + this->vfd->stop(); + } +#endif +} + +void App::loop_normal() +{ +} +void App::debug_mode_loop() +{ + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->hasFlag(LOOP)) + { + addon->loop(); + } + } +} + +short App::loop() +{ + loop_addons(); + loop_com(); + timer.tick(); + now = millis(); + short error = ok(); + if (error) + { + _error = error; + return; + } + +#ifdef HAS_OP_MODE_SWITCH + short op = opModeSwitch->value(); + switch (op) + { + case OP_DEBUG: + { +#ifdef HAS_POWER + powerSwitch->on(POWER_PRIMARY); + powerSwitch->on(POWER_SECONDARY); +#endif + break; + } + + case OP_NORMAL: + { +#ifdef HAS_POWER + // powerSwitch->on(POWER_PRIMARY); + // powerSwitch->on(POWER_SECONDARY); +#endif + loop_normal(); + debug(); + break; + } + case OP_NONE: + { +#ifdef HAS_POWER + // powerSwitch->off(POWER_PRIMARY); +#endif + // vfd->stop(); + // plunger->stop(); + // loopShred(); + break; + } + case OP_SERVICE: + { + // loop_normal(); + // powerSwitch->on(POWER_PRIMARY); + // powerSwitch->on(POWER_SECONDARY); + // vfd->rev(true); + + break; + } + } +#endif +} + +void App::loop_com() +{ + if (millis() - comTS > 300) + { +#if defined(HAS_BRIDGE) && defined(HAS_SERIAL) + PPSerial::Message *msg = serialBridge->read(); + if (msg) + { + switch (msg->verb) + { + + case Bridge::EC_METHOD: + { + char *strings[3]; + char *ptr = NULL; + byte index = 0; + + ptr = strtok(msg->payload, ":"); + + while (ptr != NULL && index < 4) + { + strings[index] = ptr; + index++; + ptr = strtok(NULL, ":"); + } + + int id = atoi(strings[0]); + char *_method = strings[1]; + + SKeyVal *method = VSL::instance()->hasMethod(id, _method); + if (method) + { + int arg = atoi(strings[2]); + Addon *addon = (Addon *)method->instance; + AddonFnPtr ptr = method->mPtr; + short ret = (addon->*ptr)(arg); + + if (TEST(msg->flags, Bridge::STATE)) + { +#ifdef HAS_STATES + this->appState(0); +#endif + } + else if (TEST(msg->flags, Bridge::RECEIPT)) + { +#ifdef BRIDGE_HAS_RESPONSE + const char *response = Bridge::CreateResponse(msg->id, 0, ret); + Serial.write(response); +#endif + } + if (TEST(msg->flags, Bridge::DEBUG)) + { + // Serial.println("Called command"); + } + } + else + { + VSL::instance()->debug(); + if (TEST(msg->flags, Bridge::DEBUG)) + { + /* + Serial.print("Incoming message, cant find class & method "); + Serial.print(_class); + Serial.print(":"); + Serial.print(_method); + Serial.print("\n"); + */ + } + } + break; + } + } + msg->payload = NULL; + } +#endif + comTS = millis(); + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/app.h b/extrusion/lydia-print-head-v1/firmware/firmware/app.h new file mode 100644 index 0000000..f9b5345 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/app.h @@ -0,0 +1,126 @@ +#ifndef APP_H +#define APP_H + +#include "config.h" +#include +#include "types.h" +#include "Addon.h" +#include "common/timer.h" + +class DirectionSwitch; +class EnclosureSensor; +class VFD; +class MotorIdle; +class MotorTemperature; +class MotorSpeed; +class OperationModeSwitch; +class Power; +class MotorLoad; +class RMotorControl; +class PPSerial; +class ModbusBridge; +class OmronPID; +class OmronVFD; + +class App : public Addon +{ + +public: + App(); + + DirectionSwitch *dirSwitch; + EnclosureSensor *enclosureSensor; + VFD *vfd; + MotorIdle *mIdle; + MotorTemperature *mHeat; + MotorSpeed *mSpeed; + Power *powerSwitch; + OperationModeSwitch *opModeSwitch; + MotorLoad *mLoad; + PPSerial *serialBridge; + ModbusBridge *modbusBridge; + OmronPID *pids; + OmronVFD *omronVFD; + + Addon *byId(short id); + + short setup(); + short loop(); + short debug(); + short info(); + short ok(); + + void loop_service(); + void loop_normal(); + ushort loop_auto_reverse(); + + void loop_com(); + + void _loop_motor_manual(); + void loop_addons(); + + void setup_addons(); + ushort numByFlag(ushort flag); + + void App::debug_mode_loop(); + short extrude(short value = 0); + ushort loopExtrude(); + Vector addons; + + // bridge + short setFlag(ushort addonId, ushort flag); + +#ifdef HAS_STATES + short appState(short nop = 0); + String state(); +#endif + + millis_t comTS; + millis_t loopTS; + millis_t wait; + millis_t waitTS; + Timer<10, millis> timer; // 10 concurrent tasks, using micros as resolution + + short plungerCB(short val); + short setOverload(short val); + short overloaded; + + enum SHRED_STATE + { + + }; + short shredState; + short shredStateLast; + short shredCancelState; + short jamCounter; + short setShredState(short newState); + + enum APP_STATE + { + RESET = 0, + EXTRUDING = 1, + STANDBY = 2, + ERROR = 5 + }; + + short _state; + short _error; + short getLastError(short val = 0) + { + return _error; + } + short setLastError(short val = 0); + short setAppState(short newState); + short getAppState(short val); + +private: +#ifdef MEARSURE_PERFORMANCE + millis_t addonLoopTime; + millis_t bridgeLoopTime; + millis_t printPerfTS; +#endif + + millis_t debugTS; +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/app_addons.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/app_addons.cpp new file mode 100644 index 0000000..cc142c0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/app_addons.cpp @@ -0,0 +1,238 @@ +#include +#include +#include +#include "app.h" +#include "config.h" +#include "types.h" +#include "common/macros.h" +#include "Addon.h" +#include "features.h" + +short App::setFlag(ushort addonId, ushort flag) +{ + Addon *addon = byId(addonId); + if (addon) + { + addon->setFlag(flag); + return E_OK; + } + return ERROR_WARNING; +} + +ushort App::numByFlag(ushort flag) +{ + uchar s = addons.size(); + uchar l = 0; + String out = ""; + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (!!(addon->hasFlag(flag))) + { + l++; + } + } + return l; +} + +#ifdef HAS_STATES +short App::appState(short nop) +{ + uchar s = addons.size(); + uchar si = 0; + String out = ""; + uchar l = numByFlag(STATE); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (!!(addon->hasFlag(STATE))) + { + si++; + out += addon->state(); + if (si < l) + { + out += ","; + } + } + } + const char *response = Bridge::CreateResponse(STATE_RESPONSE_CODE, 0, out.c_str()); + Serial.write(response); +} +#endif +short App::debug() +{ +#ifndef MEARSURE_PERFORMANCE + if (millis() - debugTS > DEBUG_INTERVAL) + { + uchar s = addons.size(); + uchar nb = 0; + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->hasFlag(DEBUG)) + { + if ((addon->debug)(&Serial)) + { + Serial.println("\n"); + nb++; + } + } + } + if (nb) + { + Serial.println("\n"); + } + debugTS = millis(); + } +#endif +} + +short App::info() +{ + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->hasFlag(INFO)) + { + addon->info(&Serial); + Serial << "\n"; + } + } +} + +Addon *App::byId(short id) +{ + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->id == id) + { + return addon; + } + } + return NULL; +} + +void App::setup_addons() +{ + +#ifdef HAS_POWER + addons.push_back((Addon *)powerSwitch); +#endif + +#ifdef HAS_DIRECTION_SWITCH + addons.push_back((Addon *)dirSwitch); +#endif + +#ifdef ENCLOSURE_SENSOR + addons.push_back((Addon *)enclosureSensor); +#endif + +#ifdef MOTOR_OVERLOAD_PIN + addons.push_back((Addon *)mOverload); +#endif + +#ifdef MOTOR_IDLE_PIN + addons.push_back((Addon *)mIdle); +#endif + +#ifdef HAS_OP_MODE_SWITCH + addons.push_back((Addon *)opModeSwitch); +#endif +#ifdef HAS_SERIAL + addons.push_back((Addon *)serialBridge); +#endif + +#ifdef MOTOR_LOAD_PIN + addons.push_back((Addon *)mLoad); +#endif + +#if ENABLED(MOTOR_HAS_TEMPERTURE) + addons.push_back((Addon *)mHeat); +#endif + +#if ENABLED(HAS_MOTOR_IR_SENSOR) + addons.push_back((Addon *)mSpeed); +#endif + +#ifdef HAS_VFD + addons.push_back((Addon *)vfd); +#endif + +#ifdef HAS_MODBUS_BRIDGE + addons.push_back((Addon *)modbusBridge); +#endif + +#ifdef OMRON_PID_SLAVE_START + addons.push_back((Addon *)pids); +#endif + +#ifdef HAS_OMRON_VFD_MODBUS + addons.push_back((Addon *)omronVFD); + omronVFD->owner = this; +#endif + addons.push_back((Addon *)this); + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->hasFlag(SETUP)) + { + addon->setup(); + } + } +#ifdef HAS_BRIDGE + REGISTER_CLASS_MEMBER_FN(POWER, powerSwitch, "on", (AddonFnPtr)&Power::on, short); + REGISTER_CLASS_MEMBER_FN(POWER, powerSwitch, "off", (AddonFnPtr)&Power::off, short); + REGISTER_CLASS_MEMBER_FN(VFD_CONTROL, vfd, "fwd", (AddonFnPtr)&VFD::fwd, short); + REGISTER_CLASS_MEMBER_FN(VFD_CONTROL, vfd, "rev", (AddonFnPtr)&VFD::rev, short); + REGISTER_CLASS_MEMBER_FN(VFD_CONTROL, vfd, "stop", (AddonFnPtr)&VFD::stop, short); + + // REGISTER_CLASS_MEMBER_FN(APP, this, "shred", (AddonFnPtr)&App::shred, short); + REGISTER_CLASS_MEMBER_FN(APP, this, "setOverload", (AddonFnPtr)&App::setOverload, short); + + REGISTER_CLASS_MEMBER_FN(APP, this, "setAppState", (AddonFnPtr)&App::setAppState, short); + REGISTER_CLASS_MEMBER_FN(APP, this, "getAppState", (AddonFnPtr)&App::getAppState, short); + +#ifdef HAS_MODBUS_BRIDGE + REGISTER_CLASS_MEMBER_FN(ModbusBridge, modbusBridge, "setFn", (AddonFnPtr)&ModbusBridge::setFn, short); + REGISTER_CLASS_MEMBER_FN(ModbusBridge, modbusBridge, "setAddr", (AddonFnPtr)&ModbusBridge::setAddr, short); + REGISTER_CLASS_MEMBER_FN(ModbusBridge, modbusBridge, "setNb", (AddonFnPtr)&ModbusBridge::setNb, short); +#endif + +#ifdef HAS_STATES + REGISTER_CLASS_MEMBER_FN(APP, this, "appState", (AddonFnPtr)&App::appState, short); +#endif + +#endif +} +void App::loop_addons() +{ + +#ifdef MEARSURE_PERFORMANCE + millis_t now = millis(); +#endif + + uchar s = addons.size(); + for (uchar i = 0; i < s; i++) + { + Addon *addon = addons[i]; + if (addon->hasFlag(LOOP)) + { + addon->now = millis(); + addon->loop(); + } + } + +#ifdef MEARSURE_PERFORMANCE + addonLoopTime = millis() - now; + if (millis() - printPerfTS > 3000) + { + printPerfTS = now; + Serial << SPACE("Addon loop time") << addonLoopTime << "\n"; + } +#endif + debug(); +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/app_extruding.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/app_extruding.cpp new file mode 100644 index 0000000..400bb21 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/app_extruding.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include "app.h" +#include "features.h" + +#ifdef HAS_EXTRUDE_DEBUG +#define EXTRUDE_DEBUG(A) Serial.println(A); +#else +#define EXTRUDE_DEBUG(A) +#endif + +short App::extrude(short value) +{ +} + +ushort App::loopExtrude() +{ +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/bridge.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/bridge.cpp new file mode 100644 index 0000000..b892d6f --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/bridge.cpp @@ -0,0 +1,121 @@ +#include "bridge.h" +#include +#include +#include "constants.h" + +typedef struct +{ + short key; + char *value; +} TAddons; + +const TAddons addonsDict[]{}; + +static VSL *_instance; +class SKeyVal; +SKeyVal *clazzMaps[20]; +Vector clazzes; + +class SKeyValS +{ +public: + void *instance; + ushort id; + SKeyValS() {} + SKeyValS(void *_instance, ushort _id) : instance(_instance), + id(_id) {} +}; + +char *getAddonName(short key) +{ + for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i) + { + if (addonsDict[i].key == key) + { + return addonsDict[i].value; + } + } + return NULL; +} +short getAddonKey(String name) +{ + for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i) + { + if (name.equals(String(addonsDict[i].value))) + { + return addonsDict[i].value; + } + } + return -1; +} + +void VSL::init() +{ + _instance = new VSL(); + clazzes.setStorage(clazzMaps); +} + +VSL *VSL::instance() +{ + if (!_instance) + { + VSL::init(); + } + return _instance; +} + +SKeyVal *VSL::hasMethod(ushort id, String methodName) +{ + uchar s = clazzes.size(); + for (uchar i = 0; i < s; i++) + { + + SKeyVal *val = clazzes.at(i); + if (val->key == id && val->methodName.equals(methodName)) + { + return val; + } + } + return NULL; +} +void VSL::debug() +{ +#ifdef BRIDGE_DEBUG + uchar s = clazzes.size(); + for (uchar i = 0; i < s; i++) + { + SKeyVal *val = clazzes.at(i); + Serial.print(val->className); + Serial.print(":"); + Serial.print(val->methodName); + Serial.print("\n"); + } +#endif +} + +SKeyVal *VSL::registerMemberFunction(ushort id, Addon *clazz, char *method, AddonFnPtr ptr, char *ret) +{ + SKeyVal *meth = hasMethod(id, method); + if (meth) + { +#ifdef BRIDGE_DEBUG + Serial << "Register class member: " + << SPACE(name << "::" << method) + << "already registered! \n"; +#endif + } + else + { +#ifdef BRIDGE_DEBUG + if (!getAddonKey(name)) + { + Serial.println("invalid addon key"); + } +#endif + meth = new SKeyVal(id, clazz, method, ptr); + //Serial << "Register member method:" + // << SPACE(meth->className << "::" << meth->methodName) + // << "\n"; + clazzes.push_back(meth); + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/bridge.h b/extrusion/lydia-print-head-v1/firmware/firmware/bridge.h new file mode 100644 index 0000000..1dc2c83 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/bridge.h @@ -0,0 +1,81 @@ +#ifndef BRDIGE_H +#define BRIDGE_H + +#include "Addon.h" +#include +class App; +class SKeyVal; +class SKeyValS; + +class SKeyVal +{ +public: + short key; + void *instance; + String methodName; + AddonFnPtr mPtr; + SKeyVal() {} + SKeyVal(ushort _key, void *_instance, String _methodName, AddonFnPtr _mPtr) : key(_key), + instance(_instance), + methodName(_methodName), + mPtr(_mPtr) {} +}; +class VSL +{ +public: + SKeyVal *registerMemberFunction( + ushort id, + Addon *clazz, + char *method, + AddonFnPtr ptr, + char *ret); + + static void init(); + static VSL *instance(); + SKeyVal *VSL::hasMethod(ushort id, String method); + void debug(); +}; + +#define REGISTER_CLASS_MEMBER_FN(id, inst, methodName, method, ret) \ + { \ + VSL::instance()->registerMemberFunction(id, inst, methodName, method, "2"); \ + } +#endif + +namespace Bridge +{ + +static const char *START_STR = "<<"; +static const char *END_STR = ">>"; +static const char RESPONSE_DEL = ';'; +static const char *CreateResponse(short id, short error, short ret) +{ + static char response[1024] = {'\0'}; + snprintf(response, sizeof(response), "%s%d%c%d%c%d%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR); + return response; +} +static const char *CreateResponse(short id, short error, const char *ret) +{ + static char response[1024] = {'\0'}; + snprintf(response, sizeof(response), "%s%d%c%d%c%s%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR); + return response; +} + +enum ECALLS +{ + EC_COMMAND = 1, + EC_METHOD = 2, + EC_FUNC = 3, + EC_USER = 10 +}; + +enum MessageFlags +{ + NEW = 1, + PROCESSING = 2, + PROCESSED = 3, + DEBUG = 4, + RECEIPT = 5, + STATE = 6 +}; +} // namespace Bridge diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/common/macros.h b/extrusion/lydia-print-head-v1/firmware/firmware/common/macros.h new file mode 100644 index 0000000..a253087 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/common/macros.h @@ -0,0 +1,98 @@ +#ifndef MACROS_H +#define MACROS_H + +#include "../types.h" + +// Macros for adding +#define INC_0 1 +#define INC_1 2 +#define INC_2 3 +#define INC_3 4 +#define INC_4 5 +#define INC_5 6 +#define INC_6 7 +#define INC_7 8 +#define INC_8 9 +#define INCREMENT_(n) INC_ ##n +#define INCREMENT(n) INCREMENT_(n) + +// Macros for subtracting +#define DEC_1 0 +#define DEC_2 1 +#define DEC_3 2 +#define DEC_4 3 +#define DEC_5 4 +#define DEC_6 5 +#define DEC_7 6 +#define DEC_8 7 +#define DEC_9 8 +#define DECREMENT_(n) DEC_ ##n +#define DECREMENT(n) DECREMENT_(n) + +// compiler - & C quirks +#define FORCE_INLINE __attribute__((always_inline)) inline +#define _UNUSED __attribute__((unused)) + +// fallback noop +#define NOOP do{} while(0) + +//Option testing +#define _CAT(a, ...) a ## __VA_ARGS__ +#define SWITCH_ENABLED_ 1 +#define ENABLED(b) _CAT(SWITCH_ENABLED_, b) + +// time +#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) +#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) + +#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) +#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) +#define HOUR_MS ((millis_t)1000 * (millis_t)(60 * 60)) +#define MIN_MS ((millis_t)1000 * (millis_t)(60)) +#define SECS ((millis_t)1000) + +// bit masks +#undef _BV +#define _BV(b) (1 << (b)) +#define TEST(n,b) !!((n)&_BV(b)) +#define SBI(n,b) (n |= _BV(b)) +#define CBI(n,b) (n &= ~_BV(b)) +#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0) + +#define _BV32(b) (1UL << (b)) +#define TEST32(n,b) !!((n)&_BV32(b)) +#define SBI32(n,b) (n |= _BV32(b)) +#define CBI32(n,b) (n &= ~_BV32(b)) +#define SIGN(a) ((a>0)-(a<0)) + +// math basics + +#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H)) +#define NUMERIC(a) WITHIN(a, '0', '9') +#define DECIMAL(a) (NUMERIC(a) || a == '.') +#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') +#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') +#define COUNT(a) (sizeof(a)/sizeof(*a)) +#define ZERO(a) memset(a,0,sizeof(a)) +#define COPY(a,b) memcpy(a,b,MIN(sizeof(a),sizeof(b))) + + +// #define M_PI 3.14159265358979323846f +#define RADIANS(d) ((d)*M_PI/180.0f) +#define DEGREES(r) ((r)*180.0f/M_PI) +#define CEILING(x,y) (((x) + (y) - 1) / (y)) + +// Macros for initializing arrays +#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 } +#define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 } +#define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 } +#define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 } +#define ARRAY_2(v1, v2, ...) { v1, v2 } +#define ARRAY_1(v1, ...) { v1 } + +#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__) +#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__) + +#define SPACE(A) " " << A << " " + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath.h b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath.h new file mode 100644 index 0000000..93ac9d8 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath.h @@ -0,0 +1,14 @@ +#ifndef PPMATH_H +#define PPMATH_H + +template +T clamp(const T &value, const T &low, const T &high) +{ + return value < low ? low : (value > high ? high : value); +} + +#define RANGE(i, min, max) ((i > min) && (i < max)) ? true : false + +#define NCLAMP(x, min, max) (x - min) / (max - min) + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.cpp new file mode 100644 index 0000000..9b9eb85 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.cpp @@ -0,0 +1,17 @@ +#include "ppmath_motor.h" +int vfd_calc_vsi(int rpm) +{ + return ((rpm * VFD_VSI_MAX_V_SPEED) / MOTOR_FREQ_CMAX); +} +int vfd_calc_vsi_grinder(int rpm){ + return VFD_VSI_SCALE * + vfd_calc_vsi( + clamp(rpm * RPM_GRINDER_SHREDDER_SCALE, RPM_GRINDING_MIN, RPM_GRINDING_MAX) + ); +} +int vfd_calc_vsi_shredder(int rpm){ + return VFD_VSI_SCALE * + vfd_calc_vsi( + clamp(rpm, RPM_SHREDDERING_MIN, RPM_SHREDDERING_MAX) + ); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.h b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.h new file mode 100644 index 0000000..95acaf6 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/common/ppmath_motor.h @@ -0,0 +1,18 @@ +#ifndef PPMATH_MOTOR_H +#define PPMATH_MOTOR_H + +#include "ppmath.h" +#include "constants.h" + +// Base calculation for the corresponding V per RPM, +// taking the VFD VSI Voltage level for the max. operating frequency +// into account. The max. operating frequency is set in the VFD ! +int vfd_calc_vsi(int rpm); + +// safe VSI version for grinder +int vfd_calc_vsi_grinder(int rpm); + +// safe VSI version for shredder +int vfd_calc_vsi_shredder(int rpm); + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/common/timer.h b/extrusion/lydia-print-head-v1/firmware/firmware/common/timer.h new file mode 100644 index 0000000..603d758 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/common/timer.h @@ -0,0 +1,136 @@ +#ifndef TIMER_H +#define TIMER_H + +#if defined(ARDUINO) && ARDUINO >= 100 +#include +#else +#include +#endif + +#include "macros.h" + +#ifndef TIMER_MAX_TASKS +#define TIMER_MAX_TASKS 0x10 +#endif + +template < + size_t max_tasks = TIMER_MAX_TASKS, /* max allocated tasks */ + unsigned long (*time_func)() = millis /* time function for timer */ + > +class Timer +{ +public: + typedef bool (*handler_t)(void *opaque); /* task handler func signature */ + /* Calls handler with opaque as argument in delay units of time */ + bool + in(unsigned long delay, handler_t h, void *opaque = NULL) + { + return add_task(time_func(), delay, h, opaque); + } + + /* Calls handler with opaque as argument at time */ + bool + at(unsigned long time, handler_t h, void *opaque = NULL) + { + const unsigned long now = time_func(); + return add_task(now, time - now, h, opaque); + } + + /* Calls handler with opaque as argument every interval units of time */ + bool + every(unsigned long interval, handler_t h, void *opaque = NULL) + { + return add_task(time_func(), interval, h, opaque, interval); + } + + + /* Ticks the timer forward - call this function in loop() */ + void + tick() + { + tick(time_func()); + } + + /* Ticks the timer forward - call this function in loop() */ + inline void + tick(unsigned long t) + { + for (size_t i = 0; i < max_tasks; ++i) + { + struct task *const task = &tasks[i]; + const unsigned long duration = t - task->start; + + if (task->handler && duration >= task->expires) + { + task->repeat = task->handler(task->opaque) && task->repeat; + + if (task->repeat) + task->start = t; + else + remove(task); + }else{ + } + } + } + +private: + struct task + { + handler_t handler; /* task handler callback func */ + void *opaque; /* argument given to the callback handler */ + unsigned long start, + expires, /* when the task expires */ + repeat; /* repeat task */ + } tasks[max_tasks]; + + inline void + remove(struct task *task) + { + task->handler = NULL; + task->opaque = NULL; + task->start = 0; + task->expires = 0; + task->repeat = 0; + } + + inline struct task * + next_task_slot() + { + for (size_t i = 0; i < max_tasks; ++i) + { + struct task *const slot = &tasks[i]; + if (slot->handler == NULL) + return slot; + } + + return NULL; + } + + inline struct task * + add_task(unsigned long start, unsigned long expires, + handler_t h, void *opaque, bool repeat = 0) + { + struct task *const slot = next_task_slot(); + + if (!slot){ + return NULL; + } + + slot->handler = h; + slot->opaque = opaque; + slot->start = start; + slot->expires = expires; + slot->repeat = repeat; + + return slot; + } +}; + +/* create a timer with the default settings */ +inline Timer<> +timer_create_default() +{ + return Timer<>(); +} + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/3pos.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/3pos.h new file mode 100644 index 0000000..defa892 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/3pos.h @@ -0,0 +1,81 @@ +#ifndef POS3_H +#define POS3_H + +#include +#include "../enums.h" + +class Pos3 +{ +public: + Pos3(int _upPin, int _downPin) : upPin(_upPin), downPin(_downPin) + { + } + + int setup() + { + + this->debouncerUp = Bounce(); + this->debouncerUp.attach(this->upPin, INPUT_PULLUP); + this->debouncerUp.interval(25); + + this->debouncerDown = Bounce(); + this->debouncerDown.attach(this->downPin, INPUT_PULLUP); + this->debouncerDown.interval(25); + return 0; + } + int loop() + { + int newDirection = this->read(); + + if (newDirection != this->switch_pos) + { + this->last_switch = this->switch_pos; + } + this->switch_pos = newDirection; + + return this->switch_pos; + } + + int last_switch = -1; // Track last switch position + int switch_pos = -1; // Current switch position + +protected: + int upPin; + int downPin; + + Bounce debouncerUp; + Bounce debouncerDown; + +private: + int read() + { + + this->debouncerUp.update(); + this->debouncerDown.update(); + + bool up = this->debouncerUp.read() == 0 ? true : false; + bool down = this->debouncerDown.read() == 0 ? true : false; + + int newDirection = 0; + + if (up) + { + newDirection = POS3_DIRECTION::UP; + } + if (down) + { + newDirection = POS3_DIRECTION::DOWN; + } + if (!up && !down) + { + newDirection = POS3_DIRECTION::MIDDLE; + } + if (up && down) + { + newDirection = POS3_DIRECTION::INVALID; + } + return newDirection; + } +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/CurrentSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/CurrentSensor.h new file mode 100644 index 0000000..fd85f7c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/CurrentSensor.h @@ -0,0 +1,39 @@ +#ifndef CURRENT_SENSOR_H +#define CURRENT_SENSOR_H + +#include "../config.h" +#include "../common/macros.h" +class CurrentSensor +{ + +public: + CurrentSensor(short _pin, short _interval) : pin(_pin), + interval(_interval), + ts(0) {} + + bool ok() + { + + } + + bool setup() + { + } + + void loop(millis_t now) + { + if (now - ts > interval) + { + value = analogRead(pin); + ts = now; + } + } + float value; +private: + short interval; + short pin; + millis_t ts; + +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.cpp new file mode 100644 index 0000000..ab2b98a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.cpp @@ -0,0 +1,96 @@ +#include "IRSensor.h" +#include "config.h" +#include + +IRSensor::IRSensor() +{ + this->highTS = 0; + this->lowTS = 0; + this->dt = 0; + this->now = 0; + this->ir_moving = 0; +} + +void IRSensor::debug(Stream &stream) +{ +#ifdef IR_SPEED + stream + << "IR-MOVING : " << ir_moving << "IR-SPEED: " << (int)this->velocity; +#else + stream << "IR-MOVING : " << (int)this->ir_moving; +#endif +} + +void IRSensor::count() +{ +#ifdef IR_SPEED + if (digitalRead(IR_PIN) && (micros() - this->debounce > IR_INTERVAL) && digitalRead(IR_PIN)) + { + // Check again that the encoder sends a good signal and then check that the time is greater than 1000 microseconds and check again that the signal is correct. + this->debounce = micros(); // Store the time to verify that we do not count the rebound in the signal. + pulses++; + } +#endif +} + +short IRSensor::setup() +{ +#ifdef IR_SPEED + pinMode(IR_PIN, INPUT); + attachInterrupt(0, ir_count, RISING); // Configuration of interrupt 0, where it is connected. + this->pulses = 0; + this->rpm = 0; + this->timeold = 0; +#endif +} + +short IRSensor::loop() +{ +#ifdef IR_SPEED + if (millis() - this->timeold >= IR_INTERVAL) + { + noInterrupts(); // Don't process interrupts during calculations // We disconnect the interrupt so it doesn't act in this part of the program. + this->rpm = (minute / this->pulsesperturn) / (millis() - timeold) * pulses; // Calculate the revolutions per minute + this->velocity = this->rpm * 3.1416 * this->wheel_diameter * 60 / 1000000; // Speed ​​calculation in [Km / h] + timeold = millis(); // We store the current time. + this->pulses = 0; // Initialize the pulses. + this->interrupts(); // Restart the interrupt processing // Reiniciamos la interrupción + } +#endif + + this->ir_value = digitalRead(IR_PIN); + this->now = millis(); + if (this->ir_value == HIGH) + { + this->highTS = this->now; + } + else + { + this->lowTS = this->now; + } + + if (this->highTS <= this->lowTS) + { + this->dt = this->lowTS - this->highTS; + } + else + { + this->dt = this->highTS - this->lowTS; + } + + this->dt = abs(this->dt); + + if (this->dt > IR_TIMEOUT) + { + this->ir_moving = 0; + } + else + { + this->ir_moving = 1; + } +} + +short IRSensor::ok() +{ + return this->ir_moving == 1; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.h new file mode 100644 index 0000000..686219a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/IRSensor.h @@ -0,0 +1,42 @@ +#ifndef IRSENSOR_H +#define IRSENSOR_H + +#include +#include "types.h" + +/*/ + @link : http://androminarobot-english.blogspot.com/2017/03/encoder-and-arduinotutorial-about-ir.html +*/ + +class IRSensor +{ + +public: + + IRSensor(); +#ifdef IR_SPEED + unsigned int rpm; // RPM + volatile byte pulses; // Pulses per secs + millis_t timeold; + millis_t minute; + unsigned int pulsesperturn; // Number of notches the encoder disc has + const int wheel_diameter; // diameter [mm] + static volatile unsigned long debounce; // poor man's debouncer +#endif + + short ir_value; + bool ir_moving; + short ok(); + void debug(Stream &stream); + void count(); + short setup(); + short loop(); + +protected: + millis_t highTS; // Last HIGH TS + millis_t lowTS; // Last LOW TS + millis_t dt; // Last delta time between HIGH / LOW + millis_t now; // Temp. variable to store tick TS +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronE5.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronE5.h new file mode 100644 index 0000000..daa6f8b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronE5.h @@ -0,0 +1,360 @@ +#ifndef OMRON_E5_H +#define OMRON_E5_H + +// Omron EJ5 Modbus Registers & Coils + +#define OR_BIT(A) (A >> 1) +#define OR_WORD(A) (A << 4) +#define OR_E5_STATUS_BIT(H, L, B) (B <= 16 ? (L & (1 << 8)) : (OR_WORD(H) & (1 << (OR_BIT(B))))) +#define OR_E5_CMD(CMD, VALUE) (CMD | VALUE) + +// Status Bit -1 , see h175_e5_c_communications_manual_en.pdf::3-24 +enum OR_E5_STATUS_1 +{ + // Lower Word + + OR_E5_S1_Heater_OverCurrent = 0, + OR_E5_S1_Heater_CurrentHold = 1, + OR_E5_S1_AD_ConverterError = 2, + OR_E5_S1_HS_Alarm = 3, + OR_E5_S1_RSP_InputError = 4, + OR_E5_S1_InputError = 6, + OR_E5_S1_PotentiometerInnputError = 7, + OR_E5_S1_Control_OutputOpenOutput = 8, + OR_E5_S1_Control_OutputCloseOutput = 9, + OR_E5_S1_HBAlarmCT1 = 10, + OR_E5_S1_HBAlarmCT2 = 11, + OR_E5_S1_Alarm1 = 12, + OR_E5_S1_Alarm2 = 13, + OR_E5_S1_Alarm3 = 14, + OR_E5_S1_ProgramEndOutput = 15, + + // Upper Word + + OR_E5_S1_EventInput1 = 16, + OR_E5_S1_EventInput2 = 17, + OR_E5_S1_EventInput3 = 18, + OR_E5_S1_EventInput4 = 19, + OR_E5_S1_WriteMode = 20, + OR_E5_S1_NonVolatileMemory = 21, + OR_E5_S1_SetupArea = 22, + OR_E5_S1_ATExcecute = 23, + OR_E5_S1_RunStop = 24, + OR_E5_S1_ComWrite = 25, + OR_E5_S1_AutoManualSwitch = 26, + OR_E5_S1_ProgramStart = 27, + OR_E5_S1_HeaterOverCurrentCT2 = 28, + OR_E5_S1_HeaterCurrentHoldCT2 = 29, + OR_E5_S1_HSAlarmCT2 = 31 +}; + +// Status Bit - 2 , see h175_e5_c_communications_manual_en.pdf::3-25 + +enum OR_E5_STATUS_2 +{ + // Lower Word + + OR_E5_S2_WorkBit1 = 0, + OR_E5_S2_WorkBit2 = 1, + OR_E5_S2_WorkBit3 = 2, + OR_E5_S2_WorkBit4 = 3, + OR_E5_S2_WorkBit5 = 4, + OR_E5_S2_WorkBit6 = 5, + OR_E5_S2_WorkBit7 = 6, + OR_E5_S2_WorkBit8 = 7, + + // Upper Word + + OR_E5_S2_EventInput5 = 16, + OR_E5_S2_EventInput6 = 17, + OR_E5_S2_Inverse = 20, + OR_E5_S2_SPRamp = 21, + OR_E5_S2_SPMode = 27, + OR_E5_S2_Alarm4 = 28 +}; + +// Variable Area - Settings Range (0x06s) - 2 byte mode, +// see h175_e5_c_communications_manual_en.pdf::5-1 + +enum OR_E5_SWR +{ + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV = 0x2000, + + // Refer to 5-2 Status for details (see @OR_E5_STATUS_1 and @OR_E5_STATUS_2) + OR_E5_SWR_STATUS = 0x2001, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP = 0x2002, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor = 0x2003, + + // MV Monitor (Heating) + // Standard: 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling: 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorHeating = 0x2004, + + // MV Monitor (Cooling) + // 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorCooling = 0x2005, + + // Set Point - SP lower limit to SP upper limit + OR_E5_SWR_SP_LIMIT = 0x2103, + + // Alarm Value 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1 = 0x2104, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_UL = 0x2105, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_LL = 0x2106, + + // Alarm Value 2 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2 = 0x2107, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_UL = 0x2108, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_LL = 0x2109, + + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV2 = 0x2402, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP2 = 0x2403, + + // Multi SP No. Monitor, 0x00000000 to 0x00000007 (0 to 7) + OR_E5_SWR_MSMON = 0x2404, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEX = 0x2406, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the leftmost 16 bits are read. + OR_E5_SWR_STATUSEXL = 0x2407, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEXR = 0x2408, + + // Decimal Point Monitor, + // 0x00000000 to 0x00000003 (0 to 3) + OR_E5_SWR_DECMON = 0x2410, + + // Set Point () + // SP lower limit to SP upper limit + OR_E5_SWR_SP = 0x2601, + + // Remote Set Point Monitor + // - Remote SP lower limit −10% FS to Remote SP upper limit +10% FS + OR_E5_SWR_SP_EX_MON = 0x2602, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor2 = 0x2604, + + // Valve Opening Monitor, 0xFFFFFF9C to 0x0000044C (−10.0 to 110.0) + OR_E5_SWR_VALVE_OPENING_MON = 0x2607, + + // Proportional Band (Cooling), 0x00000001 to 0x0000270F (0.1 to 999.9) + OR_E5_SWR_PRO_BAND = 0x2701, + + // Integral Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_IT_COOLING = 0x2702, + + // Derivative Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_D_COOLING = 0x2703, + + // Dead Band 0xFFFFF831 to 0x0000270F + // (−199.9 to 999.9 for temperature input) + // (−19.99 to 99.99 for analog input) + OR_E5_SWR_DEADBAND = 0x2704, + + // Manual Reset Value, + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_MANUAL_RESET_VALUE = 0x2705, + + // Hysteresis (Heating) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS = 0x2706, + + // Hysteresis (Cooling) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS_COOLING = 0x2707, + + // Control Period (Heating) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_HEATING = 0x2708, + + // Control Period (Cooling) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_COOLING = 0x2709, + + // Position Proportional Dead Band + // 0x00000001 to 0x00000064 (0.1 to 10.0) + OR_E5_SWR_POSITION_PROPORTIONAL_DEAD_BAND = 0x270A, + + // Open/Close Hysteresis + // 0x00000001 to 0x000000C8 (0.1 to 20.0) + OR_E5_SWR_OPEN_CLOSE_HYSTERESIS = 0x270B, + + // SP Ramp Time Unit 0x00000000 (0): EU/second + // 0x00000001 (1): EU/minute + // 0x00000002 (2): EU/hour + OR_E5_SWR_SP_RAMP_UNIT = 0x270C, + + // SP Ramp Set Value 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_RAMP_SET_VALUE = 0x270D, + + // SP Ramp Fall Value + // 0xFFFFFFFF (−1): Same (Same as SP Ramp Set Value.) + // 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_FALL_VALUE = 0x270E, + + // MV at Stop Standard Models + // Standard control: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling control: + // 0xFFFFFBE6 to 0x0000041A (−105.0 to 105.0) + // Position-proportional Models + // Close position-proportional control with the Direct Setting of + // Position Proportional MV parameter set to ON: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Floating position-proportional control or the Direct Setting of + // Position Proportional MV parameter set to OFF: + // 0xFFFFFFFF to 0x00000001 (−1 to 1) + OR_E5_SWR_MV_PV_ERROR = 0x2711, + + // MV Change Rate Limit + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_CHANGE_RATE_LIMIT = 0x2713, + + // PV Input Slope Coefficient + // 0x00000001 to 0x0000270F (0.001 to 9.999) + OR_E5_SWR_PV_INPUT_SLOPE_COEFFICIENT = 0x2718, + + // Heater Burnout Detection 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_1 = 0x271B, + + // Leakage Current 1 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_1 = 0x271C, + + // HS Alarm 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_1 = 0x271D, + + // Process Value Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_PROCESS_VALUE_INPUT_SHIFT = 0x2723, + + // Heater Burnout Detection 2 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_2 = 0x2725, + + // Leakage Current 2 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_2 = 0x2726, + + // HS Alarm 12 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_2 = 0x2727, + + // Soak Time Remain (how lovely) + // 0x00000000 to 0x0000270F (0 to 9999) + OR_E5_SWR_SOAK_REMAIN = 0x2728, + + // Soak Time + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SOAK_TIME = 0x2729, + + // Wait Band 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for Temperature input) + // (0.01 to 99.99 for Analog input) + OR_E5_SWR_WAIT_BAND = 0x272A, + + // Remote SP Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_REMOTE_SP_SHIFT = 0x272B, + + // Remote SP input Slope Coefficient + // 0x00000001 to 0x0 + OR_E5_SWR_REMOTE_SP_SLOPE_COEFFICIENT = 0x272C, + + // Input Digital Filter 0x00000000 to 0x0000270F (0.0 to 999.9) + OR_E5_SWR_DIGITAL_FILTER = 0x2800 + + // Notes : + // *1 Not displayed on the Controller display +}; + +// Operation Command Address +enum OR_E5_CMD_ADDRESS +{ + OR_E5_CMD_STOP_RUN = 0x100, + OR_E5_CMD_COM_WRITE = 0x000, + // Auto-Tune + OR_E5_CMD_AT = 0x200 +}; + +enum OR_E5_CMD +{ + OR_E5_STOP = OR_E5_CMD(OR_E5_CMD_ADDRESS::OR_E5_CMD_STOP_RUN, 1), + OR_E5_RUN = OR_E5_CMD(OR_E5_CMD_ADDRESS::OR_E5_CMD_STOP_RUN, 0), + OR_E5_AT_CANCEL = OR_E5_CMD(OR_E5_CMD_ADDRESS::OR_E5_CMD_AT, 0), + OR_E5_AT_EXCECUTE = OR_E5_CMD(OR_E5_CMD_ADDRESS::OR_E5_CMD_AT, 1) +}; + +enum OR_E5_ERROR +{ + VARIABLE_ADDRESS_ERROR = 0x2, + VARIABLE_RANGE_ERROR = 0x3, + VARIABLE_OPERATION_ERROR = 0x4 +}; + +enum OR_E5_RESPONSE_CODE +{ + OR_READ_ERROR = 0x83, + OR_RESPONSE_OK = 0x10, + OR_OPERATION_ERROR = 0x90, + OR_COMMAND_ERROR = 0x86 +}; + +#define OR_E_MSG_INVALID_ADDRESS "Invalid Variable Address" +#define OR_E_MSG_INVALID_RANGE "Invalid Variable Range" +#define OR_E_MSG_OPERATION_ERROR "OPERATION ERROR" + + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronMX2.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronMX2.h new file mode 100644 index 0000000..6fdae87 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/OmronMX2.h @@ -0,0 +1,86 @@ +#ifndef OMRON_MX2_H +#define OMRON_MX2_H + +// Omron MX2 Registers +#define MX2_STATE 0x0003 // (2 bytes) Status of the inverter +#define MX2_STATUS 0x004 // (2 bytes) Status of the inverter +#define MX2_TARGET_FR 0x0001 // (4 bytes) Source (reference) of the frequency reference (0,01 [Hz]) +#define MX2_ACCEL_TIME 0x1103 // (4 bytes) Acceleration time (cm compressor) in 0.01 sec +#define MX2_DEACCEL_TIME 0x1105 // (4 bytes) Braking time (cm compressor) in 0.01 sec + +#define MX2_CURRENT_FR 0x1001 // (4 bytes) Output frequency control (0,01 [Hz]) +#define MX2_AMPERAGE 0x1003 // (2 bytes) Output current monitoring (0,01 [A]) +#define MX2_VOLTAGE 0x1011 // (2 bytes) Monitoring output voltage 0.1 [V] +#define MX2_POWER 0x1012 // (2 bytes) Power control 0.1 [kW] +#define MX2_POWER_HOUR 0x1013 // (4 bytes) Watt-hour control 0.1 [kW / h] +#define MX2_HOUR 0x1015 // (4 bytes) Control of operating time in the "Run" mode 1 [h] +#define MX2_HOUR1 0x1017 // (4 bytes) Monitoring of running hours with power on 1 [h] +#define MX2_TEMP 0x1019 // (2 bytes) Radiator temperature control (0.1 degree) -200 ... 1500 +#define MX2_VOLTAGE_DC 0x1026 // (2 bytes) DC voltage control (PN) 0.1 [V] +#define MX2_NUM_ERR 0x0011 // (2 bytes) Trip counter 0 ... 65530 +#define MX2_ERROR1 0x0012 // (20 bytes) Description 1 trip the remaining 5 lie sequentially behind the first address error are calculated MX2_ERROR1 + i * 0x0a +#define MX2_INIT_DEF 0x1357 // (2 bytes) Set the initialization mode to 0 (nothing), 1 (clearing the shutdown history), 2 (clearing the shutdown history and initializing data), 4 (clearing the shutdown history, initializing data and the program EzSQ) +#define MX2_INIT_RUN 0x13b7 // (2 bytes) Initialization start 0 (off), 1 (on) + +#define MX2_SOURCE_FR 0x1201 // (2 bytes) Frequency reference source +#define MX2_SOURCE_CMD 0x1202 // (2 bytes) Command source +#define MX2_BASE_FR 0x1203 // (2 bytes) Main frequency 300 ... "maximum frequency" 0.1 Hz +#define MX2_MAX_FR 0x1204 // (2 bytes) Maximum frequency 300 ... 4000 (10000) 0.1 Hz +#define MX2_DC_BRAKING 0x1245 // (2 bytes) Enable DC Braking +#define MX2_STOP_MODE 0x134e // (2 bytes) Choosing a stop method B091 = 01 +#define MX2_MODE 0x13ae // (2 bytes) IF mode selection b171 = 03 + +// Setting the inverter for a specific compressor Registers Hxxx Permanent magnet motor (PM motor) +#define MX2_b171 0x13ae // b171 Inverter selection b171 read / write 0 (off), 1 (IM mode), 2 (high frequency mode), 3 (PM mode) = 03 +#define MX2_b180 0x13b7 // b180 Initialization trigger = 01 +#define MX2_H102 0x1571 // H102 Setting the PM engine code 00 (standard Omron data) 01 (auto-tuning data) = 1 +#define MX2_H103 0x1572 // H103 PM engine power (0.1 / 0.2 / 0.4 / 0.55 / 0.75 / 1.1 / 1.5 / 2.2 / 3.0 / 3, 7 / 4.0 / 5.5 / 7.5 / 11.0 / 15.0 / 18.5) = 7 +#define MX2_H104 0x1573 // H104 Setting the number of poles of the PM motor = 4 +#define MX2_H105 0x1574 // H105 Rated current of the PM motor = 1000 (this is 11A) +#define MX2_H106 0x1575 // H106 PM motor constant R From 0.001 to 65.535 Ohms = 0.55 +#define MX2_H107 0x1576 // H107 PM Engine Ld Constant From 0.01 to 655.35 mH = 2.31 +#define MX2_H108 0x1577 // H108 Lq constant of PM engine From 0.01 to 655.35 mH = 2.7 +#define MX2_H109 0x1578 // H109 Ke Engine Constant PM-motor 0.0001 ... 6.5535 Vmax ./ (rad / s) = 750 must be selected it affects consumption and noise +#define MX2_H110 0x1579 // (4 bytes) H110 PM motor constant J From 0.001 to 9999,000 kg / m² = 0.01 +#define MX2_H111 0x157B // H111 Auto tuning constant R From 0.001 to 65.535 Ohms +#define MX2_H112 0x157C // H112 Auto-tuning constant Ld From 0.01 to 655.35 mH +#define MX2_H113 0x157D // H113 Auto tuning constant Lq From 0.01 to 655.35 mH +#define MX2_H116 0x1581 // H116 The response of the PM motor at a speed of 1 ... 1000 = 100 (default) +#define MX2_H117 0x1582 // H117 Starting current of the PM motor From 20.00 to 100.00% = 70 (default) +#define MX2_H118 0x1583 // H118 Starting time of the PM motor 0.01 ... 60.00 s = 1 (default) +#define MX2_H119 0x1584 // H119 Engine PM stabilization constant From 0 to 120% s = 100 +#define MX2_H121 0x1586 // H121 Minimum frequency of the PM motor From 0.0 to 25.5% = 0 +#define MX2_H122 0x1587 // H122 Idling current PM motor From 0.00 to 100.00% = 50 (default) +#define MX2_H123 0x1588 // H123 Choice of PM engine start method 00 (off) 01 (on) = 0 (default) +#define MX2_H131 0x158A // H131 Estimation of the initial position of the rotor of the PM motor: standby time 0 V 0 ... 255 = 10 (default) +#define MX2_H132 0x158B // H132 Assessment of the initial position of the rotor of the PM motor: waiting time for determination 0 ... 255 = 10 (default) +#define MX2_H133 0x158C // H133 Assessment of the initial position of the rotor of the PM motor: determination time 0 ... 255 = 30 (default) +#define MX2_H134 0x158D // H134 Assessment of the initial position of the rotor of the PM motor: voltage gain 0 ... 200 = 100 (default) +#define MX2_C001 0x1401 // C001 Input function [1] 0 (FW: go forward) = 0 +#define MX2_C004 0x1404 // C004 Input function [4] 18 (RS: reset) = 18 +#define MX2_C005 0x1405 // C005 Input function [5] [also input “PTC”] = 19 PTC Thermistor with positive TCS for thermal protection (only C005) +#define MX2_C026 0x1404 // C026 Relay output function 5 (AL: error signal) = 05 +#define MX2_b091 0x135E // b091 Choice of stopping method 0 (braking to a complete stop), 1 (coasting stop) = 1 +#define MX2_b021 0x1316 // b021 Operating mode with overload limitation 0 (off), 1 (enabled during acceleration and rotation at a constant speed), \ + // 2 (enabled during rotation at a constant speed), 3 (enabled during acceleration and rotation at a constant speed [increase \ + // speed in generator mode]) = 1 +#define MX2_b022 0x1317 // b022 Overload restriction level 200 ... 2000 (0.1%) = +#define MX2_b023 0x1318 // b023 Braking time with overload limitation (0.1 sec) = 10 +#define MX2_F002 0x1103 // (4 bytes) F002 Acceleration time (1) Standard, default acceleration, range from 0.001 to 3600 s (0.01 sec) = 20 * 100 +#define MX2_F003 0x1105 // (4 bytes) F003 Deceleration time (1) Standard, default acceleration, range from 0.001 to 3600 s (0.01 sec) = 20 * 100 +#define MX2_A001 0x1201 // A001 Frequency reference source 00 ... Potent. on external panels 01 ... Control terminals 02 ... Setting parameter F001 \ + // 03 ... Input via ModBus network 04 ... Add. card 06 ... Entrance imp. after 07 ... via EzSQ 10 ... Result of arithmetic operation = 03 +#define MX2_A002 0x1202 // A002 Source of the “Run” command 01 .. Control terminals 02 ... “Run” key on the keypad or digital panel 03 ... Input via the ModBus network 04 ... Add. card = 01 +#define MX2_A003 0x1203 // A003 Main frequency Can be set in the range from 30 Hz to the maximum frequency (A004) (0.1 Hz) = 120 * 10 +#define MX2_A004 0x1204 // A004 Maximum frequency Can be set in the range from the fundamental frequency to 400 Hz (0.1 Hz) = 120 * 10 + +// Omron MX2 Bits +#define MX2_START 0x0000 // (bit) Run command 1: Run, 0: Stop (valid with A002 = 03) +#define MX2_SET_DIR 0x0001 // (bit) Command of direction of rotation 1: Reverse rotation, 0: Rotation in the forward direction (valid with A002 = 03) +#define MX2_RESET 0x0004 // (bit) Reset emergency shutdown (RS) 1: Reset +#define MX2_READY 0x0011 // (bit) Ready IF 1: Ready, 0: Not ready +#define MX2_DIRECTION 0x0010 // (bit) Direction of rotation 1: Reverse rotation, 0: Rotation in the forward direction (deadlock with "d003") + +#define TEST_NUMBER 1234 // Verification code for function 0x08 + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/PhotoElectricSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/PhotoElectricSensor.h new file mode 100644 index 0000000..a28e7db --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/PhotoElectricSensor.h @@ -0,0 +1,89 @@ +#ifndef PHOTO_ELECTRIC_SENSOR +#define PHOTO_ELECTRIC_SENSOR + +// Typical photo electric sensor. This needs debouncing. +// Currently used : OMRON - E3FB-DN22, see vendor files + +#include "../types.h" +#include "../common/macros.h" +#include "../common/ppmath.h" + +#define PES_TIMEOUT 1600 +class PhotoElectricSensor +{ +public: + PhotoElectricSensor(short pin, short interval) + { + this->pin = pin; + this->interval = interval; + this->highTS = 0; + this->lowTS = 0; + this->dt = 0; + this->now = 0; + this->moving = 0; + this->setup(); + } + + short setup(){} + short loop() + { + now = millis(); + if (now - dt > 800) + { + this->value = RANGE(analogRead(this->pin), 50 - 10, 50 + 10); + dt = now; + } + /* + this->debouncer.update(); + this->value = !this->debouncer.read(); + + if (this->last != this->value) + { + this->last = this->value; + this->highTS = 0; + this->lowTS = 0; + } + + this->now = millis(); + + if (this->value == HIGH) + { + this->highTS = this->now; + } + else + { + this->lowTS = this->now; + } + + if (this->highTS <= this->lowTS) + { + this->dt = this->lowTS - this->highTS; + } + else + { + this->dt = this->highTS - this->lowTS; + } + + this->dt = abs(this->dt); +*/ + return this->value; + } + short ok() + { + return this->value; + } + short value; + short moving; + + millis_t highTS; // Last HIGH TS + millis_t lowTS; // Last LOW TS + millis_t dt; // Last delta time between HIGH / LOW + millis_t now; // Temp. variable to store tick TS + bool last; + +protected: + short pin; + short interval; +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/Proximity_Sensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/Proximity_Sensor.h new file mode 100644 index 0000000..6decb92 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/Proximity_Sensor.h @@ -0,0 +1,39 @@ +#ifndef PROXIMITY_SENSOR_H +#define PROXIMITY_SENSOR_H + +// Typical proximity switch. This needs debouncing. +// Wiring : +// Blue -> GND +// Brown -> 6 - 36 V +// Black -> Digital In + +#include +#include "../types.h" + +class ProximitySensor +{ +public: + ProximitySensor(short _pin) : pin(_pin){} + + short setup() + { + this->debouncer = Bounce(); + this->debouncer.attach(this->pin, INPUT_PULLUP); + this->debouncer.interval(25); + this->loop(); + return this->value; + } + short loop() + { + this->debouncer.update(); + this->value = !this->debouncer.read(); + return this->value; + } + bool value; + +protected: + uchar pin; + Bounce debouncer; +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/StatusLight.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/StatusLight.h new file mode 100644 index 0000000..170d05f --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/StatusLight.h @@ -0,0 +1,67 @@ +#ifndef STATUSLIGHT_H +#define STATUSLIGHT_H + +class StatusLight +{ +public: + StatusLight(short _pin) : pin(_pin) + { + doBlink = false; + status_blink_TS = 0; + last_blink = !digitalRead(pin); + } + + short setup() + { + } + + void setBlink(bool blink) + { + doBlink = blink; + } + + void on() + { + digitalWrite(pin, HIGH); + } + + void off() + { + digitalWrite(pin, LOW); + } + + short loop() + { + if (doBlink) + { + if (millis() - status_blink_TS > 1000) + { + status_blink_TS = millis(); + last_blink = !last_blink; + digitalWrite(pin, last_blink); + } + } + } + + void status_loop() + { + } + + void status_blink(bool blink) + { + if (!doBlink && blink) + { + blink_start_ts = millis(); + } + doBlink = blink; + } + + short pin; + millis_t status_blink_TS; + bool doBlink; + bool last_blink; + millis_t blink_start_ts; + millis_t max_blink_time; // stop blinking in an hour +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/components/TemperatureSensor.h b/extrusion/lydia-print-head-v1/firmware/firmware/components/TemperatureSensor.h new file mode 100644 index 0000000..e17f995 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/components/TemperatureSensor.h @@ -0,0 +1,42 @@ +#ifndef TEMPERATURE_SENSOR_H +#define TEMPERATURE_SENSOR_H + +#include +#include "../config.h" +#include "../macros.h" +#include "../time.h" + +class TemperatureSensor +{ + +public: + TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)), + temperature(), + temperature_TS(millis()), + maxTemp(_max), + interval(_interval) {} + + bool ok() + { + return temperature < maxTemp; + } + + void loop() + { + + if (millis() - temperature_TS > interval) + { + temperature_TS = millis(); + temperature = ktc.readCelsius(); + } + } + +private: + MAX6675 ktc; + short temperature; + short maxTemp; + short interval; + millis_t temperature_TS; +}; + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/config.h b/extrusion/lydia-print-head-v1/firmware/firmware/config.h new file mode 100644 index 0000000..c0029fb --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/config.h @@ -0,0 +1,134 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "enums.h" +#include "common/macros.h" +#include +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Core settings +// + +#define LOOP_DELAY 100 // Our frame time, exluding delays in some places +#define BOOT_DELAY 1000 // Wait at least this amount in ms after boot before doing anything + +// Please consider to set this to false for production - especially with the full feature set since this is requiring extra +// time for the serial communication and will affect the overall framerate/performance +// #define DEBUG true + +#define DEBUG_INTERVAL 1000 +#define DEBUG_BAUD_RATE 19200 // Serial port speed + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Machine settings +// + +#define USE_CONTROLLINO + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// VFD related +// + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Motor related +// +// Motor overload pin, if defined, this will be used to detect jamming +// On an OmronM2X, set the output via C21 (for output pin 11) to 03 for +// 'Overload' (which is set in C41 ) +// #define MOTOR_LOAD_PIN CONTROLLINO_A2 + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Extrusion related +// + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// General switches + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Feedback + +#define HAS_STATUS +#define STATUS_POWER_PIN CONTROLLINO_R6 +#define STATUS_PID_PIN CONTROLLINO_R7 +#define STATUS_VFD_PIN CONTROLLINO_R8 + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Plastic Hub Studio - internals : used by external controller setups +// Make sure it's matching +#define FIRMATA_BAUD_RATE 19200 +#define FIRMWARE_VERSION 0.8 + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Omron Pids +// + +#define NB_OMRON_PIDS 3 + +#define OMRON_PID_SLAVE_START 1 + +#define OMRON_PID_UPDATE_INTERVAL 1000 +#define OMRON_PID_WRITE_INTERVAL 500 + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Omron - MX2 - VFD +#define OMRON_MX2_SLAVE_ID 10 +#define OMRON_MX2_STATE_INTERVAL 1000 +#define OMRON_MX2_DEBUG_INTERVAL 3000 +#define OMRON_MX2_READ_INTERVAL 1000 +#define OMRON_MX2_LOOP_INTERVAL 500 +#define OMRON_MX2_SAME_REQUEST_INTERVAL 2000 + +#define MODBUS_QUEUE_MIN_FREE 5 + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Modbus + +#define MODBUS_RS485_BAUDRATE 19200 +#define MODBUS_RS485_PORT SERIAL_8E1 +#define MODBUS_RS485_TIMEOUT 2000 + +#define MODBUS_TCP_DEFAULT_REGISTER_VALUE 0 + +#define HAS_MODBUS_BRIDGE + +static uint8_t MB_MAC[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}; +static uint8_t MB_IP[]{192, 168, 1, 111}; +static uint8_t MB_GATEWAY[] = {192, 168, 1, 1}; +static uint8_t MB_SUBNET[] = {255, 255, 255, 0}; + +//////////////////////////////////////////////////////////////// +// +// Instrumentation +// +// #define MEARSURE_PERFORMANCE + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// externals +// + +// pull in internal constants +#include "constants.h" + +// pull in internal configs +#include "config_adv.h" + +// The user_config.h is initially added to the github repository but changes will be ignored via .gitignore. Please keep this file safe and possibly +// on a per tenant base stored. You can override parameters in this file by using #undef SOME_PARAMETER and then re-define again if needed, otherwise disable +// default features by using #undef FEATURE_OR_PARAMETER. +// This presents the possibilty to play with the code whilst staying in the loop with latest updates. +#include "user_config.h" + +// At last we check all configs and spit compiler errors +#include "config_validator.h" + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/config/known_16bit_timers.h b/extrusion/lydia-print-head-v1/firmware/firmware/config/known_16bit_timers.h new file mode 100644 index 0000000..bdae330 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/config/known_16bit_timers.h @@ -0,0 +1,153 @@ +#ifndef known_16bit_timers_header_ +#define known_16bit_timers_header_ + +// Wiring-S +// +#if defined(__AVR_ATmega644P__) && defined(WIRING) + #define TIMER1_A_PIN 5 + #define TIMER1_B_PIN 4 + #define TIMER1_ICP_PIN 6 + +// Teensy 2.0 +// +#elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) + #define TIMER1_A_PIN 14 + #define TIMER1_B_PIN 15 + #define TIMER1_C_PIN 4 + #define TIMER1_ICP_PIN 22 + #define TIMER1_CLK_PIN 11 + #define TIMER3_A_PIN 9 + #define TIMER3_ICP_PIN 10 + +// Teensy++ 2.0 +#elif defined(__AVR_AT90USB1286__) && defined(CORE_TEENSY) + #define TIMER1_A_PIN 25 + #define TIMER1_B_PIN 26 + #define TIMER1_C_PIN 27 + #define TIMER1_ICP_PIN 4 + #define TIMER1_CLK_PIN 6 + #define TIMER3_A_PIN 16 + #define TIMER3_B_PIN 15 + #define TIMER3_C_PIN 14 + #define TIMER3_ICP_PIN 17 + #define TIMER3_CLK_PIN 13 + +// Teensy 3.0 +// +#elif defined(__MK20DX128__) + #define TIMER1_A_PIN 3 + #define TIMER1_B_PIN 4 + #define TIMER1_ICP_PIN 4 + +// Teensy 3.1 / Teensy 3.2 +// +#elif defined(__MK20DX256__) + #define TIMER1_A_PIN 3 + #define TIMER1_B_PIN 4 + #define TIMER1_ICP_PIN 4 + #define TIMER3_A_PIN 32 + #define TIMER3_B_PIN 25 + #define TIMER3_ICP_PIN 32 + +// Teensy 3.5 / Teensy 3.6 +// +#elif defined(__MK64FX512__) || defined(__MK66FX1M0__) + #define TIMER1_A_PIN 3 + #define TIMER1_B_PIN 4 + #define TIMER1_ICP_PIN 4 + #define TIMER3_A_PIN 29 + #define TIMER3_B_PIN 30 + #define TIMER3_ICP_PIN 29 + +// Teensy-LC +// +#elif defined(__MKL26Z64__) + #define TIMER1_A_PIN 16 + #define TIMER1_B_PIN 17 + #define TIMER1_ICP_PIN 17 + #define TIMER3_A_PIN 3 + #define TIMER3_B_PIN 4 + #define TIMER3_ICP_PIN 4 + +// Arduino Mega +// +#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + #define TIMER1_A_PIN 11 + #define TIMER1_B_PIN 12 + #define TIMER1_C_PIN 13 + #define TIMER3_A_PIN 5 + #define TIMER3_B_PIN 2 + #define TIMER3_C_PIN 3 + #define TIMER4_A_PIN 6 + #define TIMER4_B_PIN 7 + #define TIMER4_C_PIN 8 + #define TIMER4_ICP_PIN 49 + #define TIMER5_A_PIN 46 + #define TIMER5_B_PIN 45 + #define TIMER5_C_PIN 44 + #define TIMER3_ICP_PIN 48 + #define TIMER3_CLK_PIN 47 + +// Arduino Leonardo, Yun, etc +// +#elif defined(__AVR_ATmega32U4__) + #define TIMER1_A_PIN 9 + #define TIMER1_B_PIN 10 + #define TIMER1_C_PIN 11 + #define TIMER1_ICP_PIN 4 + #define TIMER1_CLK_PIN 12 + #define TIMER3_A_PIN 5 + #define TIMER3_ICP_PIN 13 + +// Uno, Duemilanove, LilyPad, etc +// +#elif defined (__AVR_ATmega168__) || defined (__AVR_ATmega328P__) + #define TIMER1_A_PIN 9 + #define TIMER1_B_PIN 10 + #define TIMER1_ICP_PIN 8 + #define TIMER1_CLK_PIN 5 + +// Sanguino +// +#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) + #define TIMER1_A_PIN 13 + #define TIMER1_B_PIN 12 + #define TIMER1_ICP_PIN 14 + #define TIMER1_CLK_PIN 1 + +// Wildfire - Wicked Devices +// +#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION >= 3 + #define TIMER1_A_PIN 5 // PD5 + #define TIMER1_B_PIN 8 // PD4 + #define TIMER1_ICP_PIN 6 // PD6 + #define TIMER1_CLK_PIN 23 // PB1 + #define TIMER3_A_PIN 12 // PB6 + #define TIMER3_B_PIN 13 // PB7 + #define TIMER3_ICP_PIN 9 // PB5 + #define TIMER3_CLK_PIN 0 // PD0 +#elif defined(__AVR_ATmega1284P__) && defined(WILDFIRE_VERSION) && WILDFIRE_VERSION < 3 + #define TIMER1_A_PIN 5 // PD5 + #define TIMER1_B_PIN 4 // PD4 + #define TIMER1_ICP_PIN 6 // PD6 + #define TIMER1_CLK_PIN 15 // PB1 + #define TIMER3_A_PIN 12 // PB6 + #define TIMER3_B_PIN 13 // PB7 + #define TIMER3_ICP_PIN 11 // PB5 + #define TIMER3_CLK_PIN 0 // PD0 + +// Mighty-1284 - Maniacbug +// +#elif defined(__AVR_ATmega1284P__) + #define TIMER1_A_PIN 12 // PD5 + #define TIMER1_B_PIN 13 // PD4 + #define TIMER1_ICP_PIN 14 // PD6 + #define TIMER1_CLK_PIN 1 // PB1 + #define TIMER3_A_PIN 6 // PB6 + #define TIMER3_B_PIN 7 // PB7 + #define TIMER3_ICP_PIN 5 // PB5 + #define TIMER3_CLK_PIN 8 // PD0 + +#endif + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/config_adv.h b/extrusion/lydia-print-head-v1/firmware/firmware/config_adv.h new file mode 100644 index 0000000..9c6ebed --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/config_adv.h @@ -0,0 +1,115 @@ +#ifndef CONFIG_ADV_H +#define CONFIG_ADV_H + +//#define BRIDGE_DEBUG // enable bridge debugging + +//////////////////////////////////////////////////////////////////////////////// +// +// Modbus + +#define MODBUS_CMD_WAIT 200 +#define MODBUS_READ_WAIT 200 + +#define MODBUS_R_RETRY 2 // max read queries +#define MODBUS_W_RETRY 4 // max write queries + +// @todo +// - advance config validation for the settings above +// - accumulate global modbus query timeout + +//////////////////////////////////////////////////////////////////////////////// +// +// Power settings + +// optional current sensor to validate primary power is there +// #define POWER_CSENSOR_PRIMARY CONTROLLINO_A15 + +// optional current sensor to validate primary power is there +#define POWER_CSENSOR_SECONDARY CONTROLLINO_A14 + +///////////////////////////////////////////////////////////// +// +// Motor load settings, this requires a current sensor or can be +// taken from the VFD's output. + +// the interval to read the current +#define MOTOR_LOAD_READ_INTERVAL 100 + +// the current measured when the motor runs idle, min - max range +#define MOTOR_IDLE_LOAD_RANGE_MIN 30 +#define MOTOR_IDLE_LOAD_RANGE_MAX 50 + +// the current measured when the motor is under load, min - max range +#define MOTOR_SHREDDING_LOAD_RANGE_MIN 50 +#define MOTOR_SHREDDING_LOAD_RANGE_MAX 99 + +// the current measured when the motor is overloaded, min - max range +#define MOTOR_OVERLOAD_RANGE_MIN 100 +#define MOTOR_OVERLOAD_RANGE_MAX 400 + +#define MOTOR_MIN_DT 2500 + +///////////////////////////////////////////////////////////// +// +// Bridge related +#define STATE_RESPONSE_CODE 1000 +// #define BRIDGE_HAS_RESPONSE +///////////////////////////////////////////////////////////// +// +// Error codes +// +#define E_MSG_OK "Ok" +#define E_MSG_STUCK "Shredder is stuck" + +// common operating failures +#define E_OK 0 //all good +#define E_STUCK 100 //Shredder stuck +#define E_NO_SUCH_PID 2001 //cant find PID +#define E_QUERY_BUFFER_END 99 // have no free query buffer slot + +// power failures + +#define E_POWER_PRIM_ON 145 // Power is on whilst it shouldn't be +#define E_POWER_PRIM_OFF 146 // Power is off whilst it should be + +#define E_POWER_SEC_ON 147 // Power is on whilst it shouldn't be +#define E_POWER_SEC_OFF 148 // Power is off whilst it should be +#define E_POWER 150 // Nothing is online + +#define E_VFD_OFFLINE E_POWER_PRIM_OFF // VFD should be online + +// sensor failures +#define E_VFD_CURRENT 200 // VFD current abnormal: below or above average +#define E_OPERATING_SWITCH 220 // Operating switch invalid value + +#define E_CARTRIDGE_OPEN 240 // Cartridge open sensor doesn't work +#define E_SERVICE_OPEN 241 // Sensor open sensor doesn't work + +//////////////////////////// +// +// sub system failures +// +#define E_USER_START 1000 // base offset for sub system errors + +// vfd +#define E_VFD_RUN 300 // Motor should spin but doesnt +#define E_VFD_LOSS 301 // Motor should not spin but does +#define E_VFD_CUSTOM(A) E_USER_START+A // Custom VFD error +// motor +#define E_MOTOR_DT_IDLE 320 // Motor runs idle longer as defined +#define E_MOTOR_DT_OVERLOAD 321 // Motor runs overloaded longer as defined + +#define E_BRIDGE_LOSS 400 // bridge poll timeout + +// bridge +#define E_BRIDGE_START 2000 // base offset for custom bridge errors +#define E_BRIDGE_CUSTOM(A) E_USER_START+A // Custom bridge error +#define E_BRIDGE_PARITY E_BRIDGE_CUSTOM(1) // @todo, parity check failure +#define E_BRIDGE_CRC E_BRIDGE_CUSTOM(2) // @todo, crc failure +#define E_BRIDGE_FLOOD E_BRIDGE_CUSTOM(3) // @todo, msg queue + +// extrusion +#define E_EX_BASE 3000 // base offset extruder +#define E_EX_CUSTOM(A) E_EX_BASE+A // Custom bridge error + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/config_validator.h b/extrusion/lydia-print-head-v1/firmware/firmware/config_validator.h new file mode 100644 index 0000000..3382f9e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/config_validator.h @@ -0,0 +1,21 @@ +#ifndef CONFIG_VALIDATOR +#define CONFIG_VALIDATOR + +#include "common/macros.h" + +#if defined(ENABLE_AUTO_REVERSE_PIN) && defined(HAS_AUTO_REVERSE_MODE) + #error "You can not have auto-revese toggle and a 3 pos mode switch" +#endif + +#if DEBUG == true && USE_FIRMATA && DEBUG_BAUD_RATE !=FIRMATA_BAUD_RATE + #error "Debug baud rate must match firmata baud rate" +#endif + + +#if defined(USE_UNO) && defined(IR_SPEED) + #if IR_PIN !=2 && IR_PIN !=3 + #error "For speed computation on the UNO, you need to use pins D2 or D3!" + #endif +#endif + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/constants.h b/extrusion/lydia-print-head-v1/firmware/firmware/constants.h new file mode 100644 index 0000000..4377563 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/constants.h @@ -0,0 +1,129 @@ +#ifndef CONSTANTS_H +#define CONSTANTS_H + +#include "enums.h" + +///////////////////////////////////////////////////////////////////////// +// +// Primary - Motor related (shredder, extrusion, grinder) + +#define MOTOR_FREQ_NORMAL 50 // set this to 60 Hz if needed +#define MOTOR_RPM 1480 // the actual motor speed +#define MOTOR_REDUCTION 0.03 // ie: 0.03 means 1:30 + +// Thresholds + +// the maximum override in %, eg: 0.5 = 50% and it's not recommeded to run +// the motor below 50% of it's designed operating frequency - it's getting hot +#define MOTOR_LOW_FREQ_LIMIT 0.50 +// the maximum override in %, eg: 0.5 = 50% and it's not recommeded to run +// the motor above 50% of it's designed operating frequency +#define MOTOR_HIGH_FREQ_LIMIT 0.50 + +// - PRE-CALCS +#define MOTOR_FREQ_CMIN MOTOR_FREQ_NORMAL - (MOTOR_FREQ_NORMAL * MOTOR_LOW_FREQ_LIMIT) +#define MOTOR_FREQ_CMAX MOTOR_FREQ_NORMAL + (MOTOR_FREQ_NORMAL * MOTOR_HIGH_FREQ_LIMIT) + +///////////////////////////////////////////////////////////////////////// +// +// Shredder related + +// default shredding speed, when chaning machine mode, it will snap to this +// value - if quick speed dial is available or other reasons (eg: remote) +// those values are currently based on v3 observations +#define RPM_SHREDDERING_DEFAULT 60 + +// min. shredding speed - when in shredder only mode, it won't go below +#define RPM_SHREDDERING_MIN 30 + +// max. shredding speed - when in shredder only mode, it won't go above +#define RPM_SHREDDERING_MAX 130 + +///////////////////////////////////////////////////////////////////////// +// +// Grinder related - Standalone/Combo + +// default grinding speed, when chaning machine mode, it will snap to this +// value - if quick speed dial is available or other reasons (eg: remote) +// those values are currently for a 28 mm hexbar +#define RPM_GRINDING_DEFAULT 440 + +// min. grinding speed - when in grinder only mode, it won't go below +#define RPM_GRINDING_MIN 400 + +// max. grinding speed - when in grinder only mode, it won't go above +#define RPM_GRINDING_MAX 500 + +// user - land scaler (ie: radius) +#define RPM_GRINDER_SCALE 1 + +// transmission ratio from motor to grinder +// ie: 0.03 means 1:30 +#define RPM_GRINDER_SHREDDER_SCALE 1 + +///////////////////////////////////////////////////////////////////////// +// +// Extrusion related - Standalone + +// default extrusion speed, when chaning machine mode, it will snap to this +// value - if quick speed dial is available or other reasons (eg: remote) +#define RPM_EXTRUSION_DEFAULT 50 + +// min. extrusion speed - when in extrusion only mode, it won't go below +#define RPM_EXTRUSION_MIN 25 + +// max. extrusion speed - when in extrusion only mode, it won't go above +#define RPM_EXTRUSION_MAX 150 + +// user - land scaler +#define RPM_EXTRUSION_SCALE 1 + +///////////////////////////////////////////////////////////////////////// +// +// VFD - Standalone + +// Speed in (VSI) +#define VFD_VSI_MIN_V_SPEED 0 // +#define VFD_VSI_MAX_V_SPEED 5 // most VFDs take speed regulation from 0 - 10 +#define VFD_VSI_SCALE 1.0 // For noise, ie: voltage loss + +#define VFD_QSPEED_1 1 // VFD quick speed dial profile 1 +#define VFD_QSPEED_2 2 // VFD quick speed dial profile 2 +#define VFD_QSPEED_3 3 // VFD quick speed dial profile 3 +#define VFD_QSPEED_4 4 // VFD quick speed dial profile 4 +#define VFD_QSPEED_5 5 // VFD quick speed dial profile 5 +#define VFD_QSPEED_6 6 // VFD quick speed dial profile 5 + +#define ADDON_MOTOR_IDLE "MotorIdle" + +///////////////////////////////////////////////////////////////////////// +// +// Plastic type related scaling +// @TODO : RPM scaling per plastic type + +#define RPM_GRINDING_PET 440 + +///////////////////////////////////////////////////////////////////////// +// +// Addons +// + +#define HOPPER_LOADED_STR "HopperLoaded" +#define MOTOR_IDLE_STR "MotorIdle" +#define VFD_STR "VFD" +#define DIRECTION_SWITCH_STR "DirectionSwitch" +#define MOTOR_LOAD_STR "MotorLoad" +#define ENCLOSURE_SENSOR_STR "EnclosureSensor" +#define MOTOR_TEMPERATURE_STR "MotorTemperature" +#define POWER_STR "Power" +#define PLUNGER_STR "Plunger" +#define CARTRDIGE_FULL_STR "CartridgeFull" +#define MOTOR_IR_SPEED_STR "MotorIRSpeed" +#define AUTO_REVERSE_STR "AutoReverse" +#define OPERATION_MODE_SWITCH_STR "OperationModeSwitch" +#define APP_STR "App" +#define RMOTOR_CONTROL_STR "RMotorControl" +#define OMRON_PID_STR "OmronE5PID" +#define OMRON_VFD_STR "OmronMx2" + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/docs/protocol.md b/extrusion/lydia-print-head-v1/firmware/firmware/docs/protocol.md new file mode 100644 index 0000000..d66fdb1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/docs/protocol.md @@ -0,0 +1,76 @@ +# Extruder - Serial Protocol + +## Protocols + +### Serial + +#### Request + +Since it's serial, we receive for each command a reply matching an issue id as well a payload with the requested data or command replies. + +**Command construction** : + +Send Data/Command Syntax : `` `ID ; VERB ; FLAGS ; VERSION ; PAYLOAD` `` + +**ID** : queued/issued command id, used to confirm command on sender side + +**VERB** : COMMAND,STATUS,DATA + +**FLAGS** : +```c++ + enum MessageFlags + { + NEW = 1 << 1, // set on target when inbound + // set on target + PROCESSING = 1 << 2, + // set on target when inbound + PROCESSED = 1 << 3, + // set on host, turn on debugging through the entire processing chain + DEBUG = 1 << 4, + RECEIPT = 1 << 5 // set on host, this will return the new state + }; + +``` + +**PAYLOAD**: String, this string depends on the verb (see *ECALLS*). + +Payloads is the actual call, in the form of Class:Function:Parameter(short), + +### Example + +``` + "1;2;64;1;VFD:fwd:1" +``` + +```c++ +enum ECALLS +{ + // global function + EC_COMMAND = 1, + // addon method + EC_METHOD = 2, + // external function + EC_FUNC = 3, + // user space + EC_USER = 10 + +}; +``` + +**Format for Verb EC_METHOD** : Addon-Class-Name:Addon-Class-MemberFunction-Name:Argument + +#### Response + +Response construction via delimitter : 10|x0A - line by line + +Response syntax : `` `ID ; STATUS ; PAYLOAD` `` + +**ID**: queued/issued command id, used to confirm command on sender side + +**STATUS** : Error code, OK=0, SERVERITY Mask (syslog) + +**PAYLOAD** : String - this string contains all enabled module states. The payload depends upon the sent query type (see **ECALLS**). + +**Format for Verb EC_METHOD**, ie: ``` `Power:off:1` ``` = NEW_VALUE (the new state) + +------------------------------------------------------------ diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/enums.h b/extrusion/lydia-print-head-v1/firmware/firmware/enums.h new file mode 100644 index 0000000..02dfdf1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/enums.h @@ -0,0 +1,183 @@ +#ifndef ENUMS_H +#define ENUMS_H + +enum MB_FC +{ + MB_FC_NONE = 0, /*!< null operator */ + MB_FC_READ_COILS = 1, /*!< FCT=1 -> read coils or digital outputs */ + MB_FC_READ_DISCRETE_INPUT = 2, /*!< FCT=2 -> read digital inputs */ + MB_FC_READ_REGISTERS = 3, /*!< FCT=3 -> read registers or analog outputs */ + MB_FC_READ_INPUT_REGISTER = 4, /*!< FCT=4 -> read analog inputs */ + MB_FC_WRITE_COIL = 5, /*!< FCT=5 -> write single coil or output */ + MB_FC_WRITE_REGISTER = 6, /*!< FCT=6 -> write single register */ + MB_FC_WRITE_MULTIPLE_COILS = 15, /*!< FCT=15 -> write multiple coils or outputs */ + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 /*!< FCT=16 -> write multiple registers */ +}; + +enum BOARD +{ + MEGA +}; + +enum POS3_DIRECTION +{ + UP = 1, + MIDDLE = 0, + DOWN = 2, + INVALID = -1 +}; + +enum MODE +{ +}; + +enum AR_MODE +{ + NORMAL = 1, // Shredding + EXTRUSION = 2, // Extrusion (no reverse) + NONE = 3, // Disable any jamming detection + REMOTE = 4 // User land, ie: Firmata, I2C or PlasticHub-Studio +}; + +enum ADDON_FLAGS +{ + DEBUG = 1, + INFO = 2, + LOOP = 3, + DISABLED = 4, + SETUP = 5, + MAIN = 6, + STATE = 7 +}; + +enum ADDONS +{ + MOTOR_IDLE = 1, + MOTOR_LOAD = 2, + MOTOR_TEMPERATURE = 3, + VFD_CONTROL = 4, + DIRECTION_SWITCH = 5, + ENCLOSURE_SENSOR = 6, + MOTOR_SPEED = 7, + POWER = 11, + OPERATION_MODE_SWITCH = 20, + SERIAL_BRIDGE = 23, + APP = 25, + MODBUS_BRIDGE = 26, + RMOTOR_CONTROL = 30, + OMRON_PID = 31, + OMRON_VFD = 32, + LAST = 64 +}; + +enum POWER_CIRCUIT +{ + POWER_PRIMARY = 0, + POWER_SECONDARY = 1 +}; + +enum OPERATION_MODE +{ + OP_NONE = 0, + OP_NORMAL = 1, + OP_DEBUG = 2, + OP_SERVICE = 3, + OP_TEST +}; +enum ERROR +{ + ERROR_OK = 0, + ERROR_WARNING = 1, + ERROR_FATAL = 2 +}; + +enum MBB_STATE +{ + WAITING = 0, + QUERY = 1, + RESPONSE = 2, + IDLE = 3 +}; + +// Modbus query state +enum QUERY_STATE +{ + QUEUED = 1, + PROCESSING = 2, + SENT = 3, + RESPONDED = 4, + DONE = 5 +}; + +#define ku8MBReadCoils 0x01 ///< Modbus function 0x01 Read Coils +#define ku8MBReadDiscreteInputs 0x02 ///< Modbus function 0x02 Read Discrete Inputs +#define ku8MBWriteSingleCoil 0x05 ///< Modbus function 0x05 Write Single Coil +#define ku8MBWriteMultipleCoils 0x0F ///< Modbus function 0x0F Write Multiple Coils + +// Modbus function codes for 16 bit access +#define ku8MBReadHoldingRegisters 0x03 ///< Modbus function 0x03 Read Holding Registers +#define ku8MBReadInputRegisters 0x04 ///< Modbus function 0x04 Read Input Registers +#define ku8MBWriteSingleRegister 0x06 ///< Modbus function 0x06 Write Single Register +#define ku8MBWriteMultipleRegisters 0x10 ///< Modbus function 0x10 Write Multiple Registers +#define ku8MBMaskWriteRegister 0x16 ///< Modbus function 0x16 Mask Write Register +#define ku8MBReadWriteMultipleRegisters 0x17 ///< Modbus function 0x17 Read Write Multiple Registers +#define ku8MBLinkTestOmronMX2Only 0x08 ///< Modbus function 0x08 Test + +// Modbus protocol errors +#define ERR_MODBUS_0x01 -41 // Modbus 0x01 protocol illegal function exception +#define ERR_MODBUS_0x02 -42 // Modbus 0x02 protocol illegal data address exception +#define ERR_MODBUS_0x03 -43 // Modbus 0x03 protocol illegal data value exception +#define ERR_MODBUS_0x04 -44 // Modbus 0x4 protocol slave device failure exception +#define ERR_MODBUS_0xe0 -45 // Modbus 0xe0 Master invalid response slave ID exception +#define ERR_MODBUS_0xe1 -46 // Modbus 0xe1 Master invalid response function exception +#define ERR_MODBUS_0xe2 -47 // Modbus 0xe2 Master response timed out exception +#define ERR_MODBUS_0xe3 -48 // Modbus 0xe3 Master invalid response CRC exception +#define ERR_MODBUS_UNKNOW -56 // Modbus unknown error (protocol failure) +#define ERR_MODBUS_STATE -57 // Forbidden ( invalid ) state of the inverter +#define ERR_MODBUS_BLOCK -58 // Attempt to turn on the VT with the inverter locked + +// Omron Mx2 specific +#define ERR_MODBUS_MX2_0x01 -49 // Omron mx2 Exception code 0x01 The specified function is not supported +#define ERR_MODBUS_MX2_0x02 -50 // Omron mx2 Exception code 0x02 The specified function was not found. +#define ERR_MODBUS_MX2_0x03 -52 // Omron mx2 Exception code 0x03 Unacceptable data format +#define ERR_MODBUS_MX2_0x05 -52 // Omron mx2 communication error over Modbus (function communication check 0x08 Omron mx2) +#define ERR_MODBUS_MX2_0x21 -53 // Omron mx2 Exception code 0x21 Data written to the storage register is outside the inverter +#define ERR_MODBUS_MX2_0x22 -54 // Omron mx2 Exception code 0x22 These functions are not available for the inverter +#define ERR_MODBUS_MX2_0x23 -55 // Omron mx2 Exception code 0x23 The register (bit) into which the value should be written is read-only + +#define MB_REGISTER_OFFSET 10 + +// Omron Plastic - Hub Register Mapping (Read mirror) +#define MB_R_VFD_STATE 4 +#define MB_R_VFD_STATUS 3 +#define MB_R_FREQ_TARGET 1 + +// Omron Plastic - Hub Coil Mapping (Write) +#define MB_W_VFD_RUN 5 +#define MB_W_FREQ_TARGET 6 +#define MB_W_DIRECTION 7 + +#define MB_R_PID_1_PV (MB_REGISTER_OFFSET) + 1 +#define MB_R_PID_1_SP (MB_REGISTER_OFFSET) + 2 +#define MB_R_PID_2_PV (MB_REGISTER_OFFSET) + 3 +#define MB_R_PID_2_SP (MB_REGISTER_OFFSET) + 4 +#define MB_R_PID_3_PV (MB_REGISTER_OFFSET) + 5 +#define MB_R_PID_3_SP (MB_REGISTER_OFFSET) + 6 + +#define MB_W_PID_1_SP MB_REGISTER_OFFSET + 7 +#define MB_W_PID_2_SP MB_REGISTER_OFFSET + 8 +#define MB_W_PID_3_SP MB_REGISTER_OFFSET + 9 + +#define MB_QUERY_TYPE_STATUS_POLL 10 +#define MB_QUERY_TYPE_CMD 100 + +#define OMRON_STATE_ACCELERATING 4 +#define OMRON_STATE_DECELERATING 2 +#define OMRON_STATE_RUNNING 3 +#define OMRON_STATE_STOPPED 1 +#define OMRON_STATE_ERROR 8 + +#define OMRON_STATUS_STOPPED 2 +#define OMRON_STATUS_RUNNING 0 + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/features.h b/extrusion/lydia-print-head-v1/firmware/firmware/features.h new file mode 100644 index 0000000..702f802 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/features.h @@ -0,0 +1,113 @@ +#ifndef FEATURES_H +#define FEATURES_H + +#ifdef HAS_BRIDGE +#include "bridge.h" +#endif + +#ifdef HAS_SERIAL +#include "serial.h" +#endif + +#ifdef HAS_TEMPERTURE +#include "temperature.h" +#endif + +#ifdef HAS_EXTRUDER_TEMPERATUR +#include "ex_temperature.h" +#endif + +#ifdef HAS_SOUND +#include "alarm.h" +#endif + +#ifdef HAS_HALL +#include "hall.h" +#endif + +#ifdef HAS_STATUS +#include "addons/Status.h" +#endif + +#ifdef HAS_RESET +#include "reset.h" +#endif + +#ifdef HAS_AUTOREVERSE +#include "auto-reverse.h" +#ifdef HAS_IR +#include "IRSensor.h" +#endif +#endif + +#if defined(ENCLOSURE_SENSOR_PIN_1) || defined(ENCLOSURE_SENSOR_PIN_2) +#include "EnclosureSensor.h" +#define HAS_ENCLOSURE_SENSOR +#endif + +#if defined(POWER_0) || defined(POWER_1) +#include "addons/Power.h" +#define HAS_POWER +#endif + +#ifdef MOTOR_LOAD_PIN +#include "addons/MotorLoad.h" +#endif + +#ifdef MOTOR_HAS_TEMPERTURE +#include "addons/MotorTemperature.h" +#endif + +#ifdef HAS_DIP +#include "addons/_DipSwitch.h" +#endif + +#ifdef HAS_MOTOR_IR_SENSOR +#include "addons/MotorSpeed.h" +#endif + +#if defined(OP_MODE_1_PIN) +#include "addons/OperationModeSwitch.h" +#define HAS_OP_MODE_SWITCH +#endif + +#if defined(FWD_PIN) && defined(REV_PIN) +#include "addons/DirectionSwitch.h" +#define HAS_DIRECTION_SWITCH +#endif + +#if defined(FWD_PIN) && defined(REV_PIN) +#include "VFD.h" +#define HAS_VFD +#endif + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Plastic Hub - Addons +// + +// Plastic Hub Studio - remote control +#ifdef USE_FIRMATA +#include "firmata_link.h" +#endif + +#ifdef HAS_PLUNGER +#include "Plunger.h" +#endif + +#ifdef OMRON_MX2_SLAVE_ID +#include "OmronVFD.h" +#define HAS_MODBUS_BRIDGE +#define HAS_OMRON_VFD_MODBUS +#endif + +#if defined(OMRON_PID_SLAVE_START) +#include "OmronPID.h" +#define HAS_MODBUS_BRIDGE +#endif + +#ifdef HAS_MODBUS_BRIDGE +#include "ModbusBridge.h" +#endif + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/firmware.ino b/extrusion/lydia-print-head-v1/firmware/firmware/firmware.ino new file mode 100644 index 0000000..d0dd16c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/firmware.ino @@ -0,0 +1,11 @@ +#include "app.h" + +App app = App(); + +void setup(){ + app.setup(); + app.info(); +} +void loop(){ + app.loop(); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/package.json b/extrusion/lydia-print-head-v1/firmware/firmware/package.json new file mode 100644 index 0000000..acd50ba --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/package.json @@ -0,0 +1,26 @@ +{ + "name": "@plastichub/hydra", + "version": "0.0.4", + "description": "Extruder Firmware with serial/modbus interface", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://gitlab.com/plastichub/hydra.git" + }, + "keywords": [ + "preciousplastic" + ], + "author": "PlasticHub", + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://gitlab.com/plastichub/hydra/issues" + }, + "homepage": "https://gitlab.com/plastichub/hydra#readme", + "dependencies": { + "@plastichub/fs": "^0.13.19", + "simple-git": "^1.131.0" + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.cpp new file mode 100644 index 0000000..6ba5f40 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.cpp @@ -0,0 +1,93 @@ +#include "ppmath_statistics.h" + +Statistic::Statistic() +{ + clear(); +} + +// resets all counters +void Statistic::clear() +{ + _cnt = 0; + _sum = 0; + _min = 0; + _max = 0; +#ifdef STAT_USE_STDEV + _ssqdif = 0.0; // not _ssq but sum of square differences + // which is SUM(from i = 1 to N) of + // (f(i)-_ave_N)**2 +#endif +} + +// adds a new value to the data-set +void Statistic::add(const float value) +{ + if (_cnt == 0) + { + _min = value; + _max = value; + } + else + { + if (value < _min) + _min = value; + else if (value > _max) + _max = value; + } + _sum += value; + _cnt++; + +#ifdef STAT_USE_STDEV + if (_cnt > 1) + { + float _store = (_sum / _cnt - value); + _ssqdif = _ssqdif + _cnt * _store * _store / (_cnt - 1); + // ~10% faster but limits the amount of samples to 65K as _cnt*_cnt overflows + // float _store = _sum - _cnt * value; + // _ssqdif = _ssqdif + _store * _store / (_cnt*_cnt - _cnt); + } +#endif +} + +// returns the average of the data-set added sofar +float Statistic::average() const +{ + if (_cnt == 0) + return NAN; // original code returned 0 + return _sum / _cnt; +} + +// Population standard deviation = s = sqrt [ S ( Xi - � )2 / N ] +// http://www.suite101.com/content/how-is-standard-deviation-used-a99084 +#ifdef STAT_USE_STDEV + +float Statistic::variance() const +{ + if (_cnt == 0) + return NAN; // otherwise DIV0 error + return _ssqdif / _cnt; +} + +float Statistic::mean() const +{ + if (_cnt == 0) + return NAN; // otherwise DIV0 error + return this->sum() / _cnt; +} + +float Statistic::pop_stdev() const +{ + if (_cnt == 0) + return NAN; // otherwise DIV0 error + return sqrt(_ssqdif / _cnt); +} + +float Statistic::unbiased_stdev() const +{ + if (_cnt < 2) + return NAN; // otherwise DIV0 error + return sqrt(_ssqdif / (_cnt - 1)); +} + +#endif +// END OF FILE \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.h b/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.h new file mode 100644 index 0000000..df4edeb --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/ppmath_statistics.h @@ -0,0 +1,112 @@ +#ifndef PPMATH_STATISTICS_H +#define PPMATH_STATISTICS_H + +#include +#include + +#define STAT_USE_STDEV + +#ifdef __cplusplus + +// C++11 solution that is standards compliant. Return type is deduced automatically +template +static inline constexpr auto MIN(const L lhs, const R rhs) -> decltype(lhs + rhs) +{ + return lhs < rhs ? lhs : rhs; +} +template +static inline constexpr auto MAX(const L lhs, const R rhs) -> decltype(lhs + rhs) +{ + return lhs > rhs ? lhs : rhs; +} +template +static inline constexpr const T ABS(const T v) +{ + return v >= 0 ? v : -v; +} +#else +// Using GCC extensions, but Travis GCC version does not like it and gives +// "error: statement-expressions are not allowed outside functions nor in template-argument lists" +#define MIN(a, b) \ + ({__typeof__(a) _a = (a); \ + __typeof__(b) _b = (b); \ + _a < _b ? _a : _b; }) + +#define MAX(a, b) \ + ({__typeof__(a) _a = (a); \ + __typeof__(b) _b = (b); \ + _a > _b ? _a : _b; }) + +#define ABS(a) \ + ({__typeof__(a) _a = (a); \ + _a >= 0 ? _a : -_a; }) + +#endif + +class Statistic +{ +public: + Statistic(); // "switches on/off" stdev run time + void clear(); // "switches on/off" stdev run time + void add(const float); + + // returns the number of values added + uint32_t count() const { return _cnt; }; // zero if empty + float sum() const { return _sum; }; // zero if empty + float minimum() const { return _min; }; // zero if empty + float maximum() const { return _max; }; // zero if empty + float average() const; // NAN if empty + float mean() const; // zero if empty + +#ifdef STAT_USE_STDEV + float variance() const; // NAN if empty + float pop_stdev() const; // population stdev // NAN if empty + float unbiased_stdev() const; // NAN if empty +#endif + +protected: + uint32_t _cnt; + float _sum; + float _min; + float _max; +#ifdef STAT_USE_STDEV + float _ssqdif; // sum of squares difference +#endif +}; + +/** + * Returns the kth q-quantile. + * @link http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population + * ie: median is 1st 2-quantile + * ie: upper quartile is 3rd 4-quantile + * @return {Number} q-quantile of values. + */ +/* + +const quantile = (arr: number[], i: number, n: number) => { + if (i === 0) return Math.min.apply(null, arr); + if (i === n) return Math.max.apply(null, arr); + + let sorted = arr.slice(0); + sorted.sort((a, b) => a - b); + let index = sorted.length * i / n; + + if (index % 1 === 0) { + return 0.5 * sorted[index - 1] + 0.5 * sorted[index]; + } + + return sorted[~~index]; +}; + +export const median = (arr: number[]) => quantile(arr, 1, 2); + +export const sum = (arr: number[]) => arr.reduce((a, b) => a + b, 0); + +export const mean = (arr: number[]) => sum(arr) / arr.length; + +// sqare errors along mean +const sdiff = (arr: number[], mean: number) => arr.map((v) => Math.pow(v - mean, 2)); +export const standardDeviation = (arr: number[]) => Math.sqrt(mean(sdiff(arr, mean(arr)))); +*/ + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/serial.cpp b/extrusion/lydia-print-head-v1/firmware/firmware/serial.cpp new file mode 100644 index 0000000..1b06f2d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/serial.cpp @@ -0,0 +1,127 @@ +#include "serial.h" +#include +#include +#include "bridge.h" +#include "common/macros.h" + +#define START_STR "<<" +#define END_STR ">>" +#define START_LENGTH 2 +#define END_LENGTH 2 +#define SPLIT_STR ";" + +static PPSerial::Message *_messages[10]; + +short PPSerial::setup() +{ + messages.setStorage(_messages); +} + +short PPSerial::loop() +{ +} +PPSerial::Message *PPSerial::parse(const char *string) +{ + Message *msg = new Message(1, 2, 0, 3); + const char *strings[5]; + char *ptr = NULL; + byte index = 0; + + ptr = strtok(string, SPLIT_STR); + + while (ptr != NULL && index < 5) + { + + strings[index] = ptr; + index++; + ptr = strtok(NULL, SPLIT_STR); + } + + msg->id = atoi(strings[0]); + msg->verb = atoi(strings[1]); + msg->flags = atoi(strings[2]); + msg->flags = SBI(msg->flags, Bridge::NEW); + msg->version = atoi(strings[3]); + msg->payload = strings[4]; + return msg; +} +void PPSerial::readMessages() +{ + while (stream.available()) + { + String message = stream.readString(); + message.trim(); + + if (message.startsWith(START_STR) && message.endsWith(END_STR)) + { + String data = message.substring(START_LENGTH, message.length() - END_LENGTH); + char *ptr = NULL; + byte index = 0; + ptr = strtok(data.c_str(), '\n'); + while (ptr != NULL && index < 5) + { + if (strlen(ptr) > 4) + { + Message *msg = parse(String(ptr).c_str()); + if (msg != NULL) + { + messages.push_back(msg); + } + } + index++; + ptr = strtok(NULL, '\n'); + } + } + } +} + +PPSerial::Message *PPSerial::read() +{ + /* + readMessages(); + Message *m = messages.at(0); + if (m != NULL && messages.size()) + { + messages.remove(0); + return m; + } + return NULL; +*/ + while (stream.available()) + { + String message = stream.readString(); + message.trim(); + + if (message.startsWith(START_STR) && message.endsWith(END_STR)) + { + + msg->payload = NULL; + + String data = message.substring(START_LENGTH, message.length() - END_LENGTH); + const char *strings[5]; + char *ptr = NULL; + byte index = 0; + ptr = strtok(data.c_str(), SPLIT_STR); + while (ptr != NULL && index < 5) + { + + strings[index] = ptr; + index++; + ptr = strtok(NULL, SPLIT_STR); + } + + msg->id = atoi(strings[0]); + msg->verb = atoi(strings[1]); + msg->flags = atoi(strings[2]); + msg->version = atoi(strings[3]); + msg->payload = strings[4]; + return msg; + } + else + { + Serial.print(message); + Serial.println(" : invalid message"); + } + } + return NULL; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/serial.h b/extrusion/lydia-print-head-v1/firmware/firmware/serial.h new file mode 100644 index 0000000..8482341 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/serial.h @@ -0,0 +1,47 @@ +#ifndef PPSERIAL_H +#define PPSERIAL_H +#include +#include "Addon.h" + +// Message struct: << id,verb,flags,version,payload >> +// Example :<<1;2;0;1;Power:on:1>> + +class PPSerial : public Addon +{ + +public: + PPSerial(Stream &_stream) : stream(_stream), + Addon("Serial", SERIAL_BRIDGE), + msg(new Message(0, 0, 0, 0)) + { + flags = 0; + } + + struct Message + { + public: + int id; + uchar verb; + int flags; + uchar version; + char *payload; + millis_t ts; + Message(int _id, int _verb, int _flags, int _version) : id(_id), + verb(_verb), + flags(_flags), + version(_version) {} + }; + + short loop(); + Message *read(); + Message *msg; + Message *parse(const char *string); + Vector messages; + + void readMessages(); + short setup(); + +protected: + Stream &stream; +}; +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/types.h b/extrusion/lydia-print-head-v1/firmware/firmware/types.h new file mode 100644 index 0000000..c33a7a3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/types.h @@ -0,0 +1,11 @@ +#ifndef TYPES_H +#define TYPES_H + +#include + +typedef unsigned long millis_t; +typedef unsigned short ushort; +typedef unsigned char uchar; + + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/user_config.h b/extrusion/lydia-print-head-v1/firmware/firmware/user_config.h new file mode 100644 index 0000000..a0c1ec4 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/user_config.h @@ -0,0 +1,4 @@ +#ifndef USER_CONFIG_H +#define USER_CONFIG_H + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/util/crc16.h b/extrusion/lydia-print-head-v1/firmware/firmware/util/crc16.h new file mode 100644 index 0000000..3ed528e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/util/crc16.h @@ -0,0 +1,88 @@ +/** +@file +CRC Computations + +@defgroup util_crc16 "util/crc16.h": CRC Computations +@code#include "util/crc16.h"@endcode + +This header file provides functions for calculating +cyclic redundancy checks (CRC) using common polynomials. +Modified by Doc Walker to be processor-independent (removed inline +assembler to allow it to compile on SAM3X8E processors). + +@par References: +Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of @e +Embedded @e Systems @e Programming. This may be difficult to find, but it +explains CRC's in very clear and concise terms. Well worth the effort to +obtain a copy. + +*/ +/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz + Copyright (c) 2005, 2007 Joerg Wunsch + Copyright (c) 2013 Dave Hylands + Copyright (c) 2013 Frederic Nadeau + Copyright (c) 2015 Doc Walker + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + + +#ifndef _UTIL_CRC16_H_ +#define _UTIL_CRC16_H_ + + +/** @ingroup util_crc16 + Processor-independent CRC-16 calculation. + + Polynomial: x^16 + x^15 + x^2 + 1 (0xA001)
+ Initial value: 0xFFFF + + This CRC is normally used in disk-drive controllers. + + @param uint16_t crc (0x0000..0xFFFF) + @param uint8_t a (0x00..0xFF) + @return calculated CRC (0x0000..0xFFFF) +*/ +uint16_t crc16_update(uint16_t crc, uint8_t a); +/*{ + int i; + + crc ^= a; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; + else + crc = (crc >> 1); + } + + return crc; +} +*/ + +#endif /* _UTIL_CRC16_H_ */ diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/util/word.h b/extrusion/lydia-print-head-v1/firmware/firmware/util/word.h new file mode 100644 index 0000000..c72ad94 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/util/word.h @@ -0,0 +1,64 @@ +/** +@file +Utility Functions for Manipulating Words + +@defgroup util_word "util/word.h": Utility Functions for Manipulating Words +@code#include "util/word.h"@endcode + +This header file provides utility functions for manipulating words. + +*/ +/* + + word.h - Utility Functions for Manipulating Words + + This file is part of ModbusMaster. + + ModbusMaster is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ModbusMaster is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ModbusMaster. If not, see . + + Written by Doc Walker (Rx) + Copyright © 2009-2015 Doc Walker <4-20ma at wvfans dot net> + +*/ + + +#ifndef _UTIL_WORD_H_ +#define _UTIL_WORD_H_ + + +/** @ingroup util_word + Return low word of a 32-bit integer. + + @param uint32_t ww (0x00000000..0xFFFFFFFF) + @return low word of input (0x0000..0xFFFF) +*/ +static inline uint16_t lowWord(uint32_t ww) +{ + return (uint16_t) ((ww) & 0xFFFF); +} + + +/** @ingroup util_word + Return high word of a 32-bit integer. + + @param uint32_t ww (0x00000000..0xFFFFFFFF) + @return high word of input (0x0000..0xFFFF) +*/ +static inline uint16_t highWord(uint32_t ww) +{ + return (uint16_t) ((ww) >> 16); +} + + +#endif /* _UTIL_WORD_H_ */ diff --git a/extrusion/lydia-print-head-v1/firmware/firmware/version.js b/extrusion/lydia-print-head-v1/firmware/firmware/version.js new file mode 100644 index 0000000..262569d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/firmware/version.js @@ -0,0 +1,32 @@ +const read = require('@plastichub/fs/read'); +const write = require('@plastichub/fs/write'); +const path = require('path'); +const cwd = path.resolve('../../'); +const pkgVersion = read.sync('package.json', 'json').version; + +async function status(workingDir) { + const git = require('simple-git/promise'); + + let statusSummary = null; + try { + statusSummary = await git(workingDir).log(); + } + catch (e) { + // handle the error + } + + return statusSummary; +} + + +status(cwd).then((status) => { + const version = + `#ifndef VERSION_H \n + #define VERSION_H \n + #define VERSION '${pkgVersion}|${status.latest.hash}'\n + #endif`; + + write.sync('./Version.h', version); + console.log(version); +} +); \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/.gitignore b/extrusion/lydia-print-head-v1/firmware/node/.gitignore new file mode 100644 index 0000000..b363403 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/.gitignore @@ -0,0 +1,42 @@ +# Logs +logs +*.log +npm-debug.log* +yarn.lock +yarn-error.log +credentials.json +gcreds.json +token.json + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history diff --git a/extrusion/lydia-print-head-v1/firmware/node/.npmignore b/extrusion/lydia-print-head-v1/firmware/node/.npmignore new file mode 100644 index 0000000..47f35aa --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/.npmignore @@ -0,0 +1,5 @@ +datasets +gcreds.json +xcredentials.json +tests +src diff --git a/extrusion/lydia-print-head-v1/firmware/node/LICENSE b/extrusion/lydia-print-head-v1/firmware/node/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/extrusion/lydia-print-head-v1/firmware/node/README.md b/extrusion/lydia-print-head-v1/firmware/node/README.md new file mode 100644 index 0000000..af7bb4b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/README.md @@ -0,0 +1,35 @@ +# Precious Plastic Command Line Tools + +## Requirments + +- Please install [NodeJS](https://nodejs.org/en/download/) + +## Optional requirements + +- [GhostScript](https://www.ghostscript.com/download/gsdnld.html) (needed for converting PDF to JPG) +- [Imagick](https://imagemagick.org/script/download.php) (needed for resizing images) +- [PP Open Factory](https://gitlab.com/plastichub/factory) (needed for templates) +- [Your product folder](https://gitlab.com/plastichub/products) (needed to generate documentation and creating Bazar descriptions) + +
+ + +## Todos + +## Conversions + +- v3 forum to local MD +- [x] BOM to pretty local MD +- SVG annotation parser (schematic documentation) + +### Infrastructure + +- [x] cs-cart docker image for previews via API +- [x] github issue collector +- [x] onarmy crawler (->manuals,..) +- [ ] video converter & publisher for assembly animations (mark snapshots for manuals) + +### Discord Bot + +- [ ] to HTML +- [ ] Link collector & Verifier/Rating (as lib) diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js b/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js new file mode 100644 index 0000000..0368c1c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defaults = void 0; +// tweaks and handlers +exports.defaults = () => { + // default command + const DefaultCommand = 'summary'; + if (process.argv.length === 2) { + process.argv.push(DefaultCommand); + } + // currently no default handler, display only : + process.on('unhandledRejection', (reason) => { + console.error('Unhandled rejection, reason: ', reason); + }); +}; +//# sourceMappingURL=_cli.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js.map new file mode 100644 index 0000000..ec46ab4 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/_cli.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_cli.js","sourceRoot":"","sources":["../src/_cli.ts"],"names":[],"mappings":";;;AAAA,sBAAsB;AACT,QAAA,QAAQ,GAAG,GAAG,EAAE;IACzB,kBAAkB;IAClB,MAAM,cAAc,GAAG,SAAS,CAAC;IACjC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;KACrC;IAED,+CAA+C;IAC/C,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAc,EAAE,EAAE;QAChD,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js b/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js new file mode 100644 index 0000000..66b309a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js @@ -0,0 +1,66 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.register = void 0; +const debug = require("../../log"); +// Programmer for E5DC-QX2ASM-002 Omron +/** + * + * @link Modbus Docs https://www.npmjs.com/package/modbus-serial + * + * @link Serial Port CLI https://serialport.io/docs/guide-cli + */ +const defaultOptions = (yargs) => { + return yargs.option('port', { + default: 'COM7', + describe: 'serial port' + }); +}; +let options = (yargs) => defaultOptions(yargs); +// npm run build ; node ./build/main.js pid:program +exports.register = (cli) => { + return cli.command('pid:program', 'Omron PID programmer', options, (argv) => __awaiter(void 0, void 0, void 0, function* () { + if (argv.help) { + return; + } + const port = argv.port; + /* + const sp = new SerialPort(port,{ baudRate: 256000,parity:'even', dataBits:8 }); + parser.on('data', line => console.log(`> ${line}`))*/ + const ModbusRTU = require("modbus-serial"); + const client = new ModbusRTU(); + function end() { + console.log('read registers'); + client.close(); + } + function read() { + client.setID(1); + // on device number 1. + console.log('read registers'); + // 01 03 00 00 00 02 C4 0B + client.readHoldingRegisters(2, 0).then((v) => { + console.log('v', v); + end(); + }); + } + function write() { + console.log('write registers'); + // 01 03 20 00 00 01 8FCA + // write the values 0, 0xffff to registers starting at address 0 + // on device number 1. + // client.writeRegisters(1, [0]).then(read); + } + debug.info(`Connecting to ${argv.port}`); + // open connection to a serial port + client.connectRTU(argv.port, { baudRate: 9600, parity: 'even' }, read); + })); +}; +//# sourceMappingURL=program.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js.map new file mode 100644 index 0000000..674dfb3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/commands/pid/program.js.map @@ -0,0 +1 @@ +{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/commands/pid/program.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mCAAmC;AAWnC,uCAAuC;AAEvC;;;;;GAKG;AAGH,MAAM,cAAc,GAAG,CAAC,KAAe,EAAE,EAAE;IACvC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;QACxB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,aAAa;KAC1B,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,IAAI,OAAO,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEzD,oDAAoD;AACvC,QAAA,QAAQ,GAAG,CAAC,GAAa,EAAE,EAAE;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAO,IAAmB,EAAE,EAAE;QAC7F,IAAI,IAAI,CAAC,IAAI,EAAE;YAAE,OAAO;SAAE;QAG1B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAC;QAGjC;;6DAEqD;QACrD,MAAM,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAG/B,SAAS,GAAG;YACR,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC9B,MAAM,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;QAGD,SAAS,IAAI;YACT,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChB,sBAAsB;YACtB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC9B,0BAA0B;YAE1B,MAAM,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EACvC,EAAE;gBACA,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;gBACpB,GAAG,EAAE,CAAC;YACV,CAAC,CAAC,CAAC;QACP,CAAC;QAED,SAAS,KAAK;YAGV,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;YAC/B,yBAAyB;YACzB,gEAAgE;YAChE,sBAAsB;YACtB,4CAA4C;QAChD,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,mCAAmC;QACnC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/format.js b/extrusion/lydia-print-head-v1/firmware/node/build/format.js new file mode 100644 index 0000000..e37c474 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/format.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.render = void 0; +const types_1 = require("./types"); +const log_1 = require("./log"); +exports.render = (result, options) => { + switch (options.format) { + case types_1.OutputFormat.text: { + //@TODO: human readable format + return JSON.stringify(result, null, 2); + } + case types_1.OutputFormat.json: { + return JSON.stringify(result, null, 2); + } + default: { + //private, should never happen since options had to be sanitized + log_1.error('format::render Invalid value in options.format'); + return ''; + } + } +}; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/format.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/format.js.map new file mode 100644 index 0000000..a6843c1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":";;;AAAA,mCAAgD;AAChD,+BAA8B;AAEjB,QAAA,MAAM,GAAG,CAAC,MAAW,EAAE,OAAgB,EAAE,EAAE;IACpD,QAAQ,OAAO,CAAC,MAAM,EAAE;QACpB,KAAK,oBAAY,CAAC,IAAI,CAAC,CAAC;YACpB,8BAA8B;YAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;SAC1C;QACD,KAAK,oBAAY,CAAC,IAAI,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;SAC1C;QACD,OAAO,CAAC,CAAC;YACL,gEAAgE;YAChE,WAAK,CAAC,gDAAgD,CAAC,CAAC;YACxD,OAAO,EAAE,CAAC;SACb;KACJ;AACL,CAAC,CAAA"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js b/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js new file mode 100644 index 0000000..cde5fed --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sizeToString = void 0; +exports.sizeToString = (bytes, si = true) => { + var units; + var u; + var b = bytes; + var thresh = si ? 1000 : 1024; + if (Math.abs(b) < thresh) { + return b + ' B'; + } + units = si + ? ['kB', 'MB', 'GB', 'TB'] + : ['KiB', 'MiB', 'GiB', 'TiB']; + u = -1; + do { + b /= thresh; + ++u; + } while (Math.abs(b) >= thresh && u < units.length - 1); + return b.toFixed(1) + ' ' + units[u]; +}; +//# sourceMappingURL=formatter.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js.map new file mode 100644 index 0000000..c8412ae --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/formatter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,CAAC,KAAa,EAAE,KAAc,IAAI,EAAE,EAAE;IAC9D,IAAI,KAAK,CAAC;IACV,IAAI,CAAC,CAAC;IACN,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAI,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9B,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE;QACtB,OAAO,CAAC,GAAG,IAAI,CAAC;KACnB;IACD,KAAK,GAAG,EAAE;QACN,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC1B,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC,GAAG,CAAC,CAAC,CAAC;IACP,GAAG;QACC,CAAC,IAAI,MAAM,CAAC;QACZ,EAAE,CAAC,CAAC;KACP,QAAQ,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;IACxD,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/index.js b/extrusion/lydia-print-head-v1/firmware/node/build/index.js new file mode 100644 index 0000000..b0d788c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/index.js @@ -0,0 +1,19 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./paths"), exports); +__exportStar(require("./format"), exports); +__exportStar(require("./log"), exports); +__exportStar(require("./types"), exports); +__exportStar(require("./formatter"), exports); +__exportStar(require("./main"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/index.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/index.js.map new file mode 100644 index 0000000..2457369 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,wCAAsB;AACtB,0CAAwB;AACxB,8CAA4B;AAC5B,yCAAuB"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js new file mode 100644 index 0000000..0faaf22 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LOGGING_FLAGS = exports.LOGGING_SIGNAL = exports.COMMANDS = exports.EVENTS = void 0; +exports.EVENTS = {}; +var COMMANDS; +(function (COMMANDS) { + COMMANDS["RUN_FILE"] = "Run_File"; + COMMANDS["RUN_CLASS"] = "Run_Class"; + COMMANDS["RUN_APP_SERVER_CLASS"] = "Run_App_Server_Class"; + COMMANDS["RUN_APP_SERVER_CLASS_METHOD"] = "Run_App_Server_Class_Method"; + COMMANDS["RUN_APP_SERVER_COMPONENT_METHOD"] = "Run_App_Server_Component_Method"; + COMMANDS["CANCEL_APP_SERVER_COMPONENT_METHOD"] = "Cancel_App_Server_Component_Method"; + COMMANDS["ANSWER_APP_SERVER_COMPONENT_METHOD_INTERRUPT"] = "Answer_App_Server_Component_Method_Interrupt"; +})(COMMANDS = exports.COMMANDS || (exports.COMMANDS = {})); +var LOGGING_SIGNAL; +(function (LOGGING_SIGNAL) { +})(LOGGING_SIGNAL = exports.LOGGING_SIGNAL || (exports.LOGGING_SIGNAL = {})); +; +var LOGGING_FLAGS; +(function (LOGGING_FLAGS) { + /** + * No logging + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["NONE"] = 0] = "NONE"; + /** + * Log in the IDE's global console + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["GLOBAL_CONSOLE"] = 1] = "GLOBAL_CONSOLE"; + /** + * Log in the IDE's status bar + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["STATUS_BAR"] = 2] = "STATUS_BAR"; + /** + * Create notification popup in the IDE + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["POPUP"] = 4] = "POPUP"; + /** + * Log to file + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["FILE"] = 8] = "FILE"; + /** + * Log into the IDE's dev tool's console + * @constant + * @type int + */ + LOGGING_FLAGS[LOGGING_FLAGS["DEV_CONSOLE"] = 16] = "DEV_CONSOLE"; +})(LOGGING_FLAGS = exports.LOGGING_FLAGS || (exports.LOGGING_FLAGS = {})); +; +//# sourceMappingURL=enums.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js.map new file mode 100644 index 0000000..2e809d7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/enums.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/lib/common/enums.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,EAErB,CAAC;AAEF,IAAY,QAQX;AARD,WAAY,QAAQ;IAChB,iCAAqB,CAAA;IACrB,mCAAuB,CAAA;IACvB,yDAA6C,CAAA;IAC7C,uEAA2D,CAAA;IAC3D,+EAAmE,CAAA;IACnE,qFAAyE,CAAA;IACzE,yGAA6F,CAAA;AACjG,CAAC,EARW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAQnB;AAED,IAAY,cACX;AADD,WAAY,cAAc;AAC1B,CAAC,EADW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QACzB;AAAA,CAAC;AAEF,IAAY,aAqCX;AArCD,WAAY,aAAa;IACrB;;;;OAIG;IACH,iDAAiB,CAAA;IACjB;;;;OAIG;IACH,qEAA2B,CAAA;IAC3B;;;;OAIG;IACH,6DAAuB,CAAA;IACvB;;;;OAIG;IACH,mDAAkB,CAAA;IAClB;;;;OAIG;IACH,iDAAiB,CAAA;IACjB;;;;OAIG;IACH,gEAAwB,CAAA;AAC5B,CAAC,EArCW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAqCxB;AAAA,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js new file mode 100644 index 0000000..79ea321 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js @@ -0,0 +1,190 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.countToArray = exports.count = exports.create = exports.validateConstraint = exports.validateConstraints = exports.areFunctions = exports.isFunction = exports.isEmptyObject = exports.isUndefinedOrNull = exports.isUndefined = exports.isBoolean = exports.isNumber = exports.isObject = exports.isStringArray = exports.isString = exports.isArray = void 0; +const _typeof = { + number: 'number', + string: 'string', + undefined: 'undefined', + object: 'object', + function: 'function' +}; +/** + * @returns whether the provided parameter is a JavaScript Array or not. + */ +function isArray(array) { + if (Array.isArray) { + return Array.isArray(array); + } + if (array && typeof (array.length) === _typeof.number && array.constructor === Array) { + return true; + } + return false; +} +exports.isArray = isArray; +/** + * @returns whether the provided parameter is a JavaScript String or not. + */ +function isString(str) { + if (typeof (str) === _typeof.string || str instanceof String) { + return true; + } + return false; +} +exports.isString = isString; +/** + * @returns whether the provided parameter is a JavaScript Array and each element in the array is a string. + */ +function isStringArray(value) { + return isArray(value) && value.every(elem => isString(elem)); +} +exports.isStringArray = isStringArray; +/** + * + * @returns whether the provided parameter is of type `object` but **not** + * `null`, an `array`, a `regexp`, nor a `date`. + */ +function isObject(obj) { + // The method can't do a type cast since there are type (like strings) which + // are subclasses of any put not positvely matched by the function. Hence type + // narrowing results in wrong results. + return typeof obj === _typeof.object + && obj !== null + && !Array.isArray(obj) + && !(obj instanceof RegExp) + && !(obj instanceof Date); +} +exports.isObject = isObject; +/** + * In **contrast** to just checking `typeof` this will return `false` for `NaN`. + * @returns whether the provided parameter is a JavaScript Number or not. + */ +function isNumber(obj) { + if ((typeof (obj) === _typeof.number || obj instanceof Number) && !isNaN(obj)) { + return true; + } + return false; +} +exports.isNumber = isNumber; +/** + * @returns whether the provided parameter is a JavaScript Boolean or not. + */ +function isBoolean(obj) { + return obj === true || obj === false; +} +exports.isBoolean = isBoolean; +/** + * @returns whether the provided parameter is undefined. + */ +function isUndefined(obj) { + return typeof (obj) === _typeof.undefined; +} +exports.isUndefined = isUndefined; +/** + * @returns whether the provided parameter is undefined or null. + */ +function isUndefinedOrNull(obj) { + return isUndefined(obj) || obj === null; +} +exports.isUndefinedOrNull = isUndefinedOrNull; +const hasOwnProperty = Object.prototype.hasOwnProperty; +/** + * @returns whether the provided parameter is an empty JavaScript Object or not. + */ +function isEmptyObject(obj) { + if (!isObject(obj)) { + return false; + } + for (let key in obj) { + if (hasOwnProperty.call(obj, key)) { + return false; + } + } + return true; +} +exports.isEmptyObject = isEmptyObject; +/** + * @returns whether the provided parameter is a JavaScript Function or not. + */ +function isFunction(obj) { + return typeof obj === _typeof.function; +} +exports.isFunction = isFunction; +/** + * @returns whether the provided parameters is are JavaScript Function or not. + */ +function areFunctions(...objects) { + return objects && objects.length > 0 && objects.every(isFunction); +} +exports.areFunctions = areFunctions; +function validateConstraints(args, constraints) { + const len = Math.min(args.length, constraints.length); + for (let i = 0; i < len; i++) { + validateConstraint(args[i], constraints[i]); + } +} +exports.validateConstraints = validateConstraints; +function validateConstraint(arg, constraint) { + if (isString(constraint)) { + if (typeof arg !== constraint) { + throw new Error(`argument does not match constraint: typeof ${constraint}`); + } + } + else if (isFunction(constraint)) { + if (arg instanceof constraint) { + return; + } + if (arg && arg.constructor === constraint) { + return; + } + if (constraint.length === 1 && constraint.call(undefined, arg) === true) { + return; + } + throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`); + } +} +exports.validateConstraint = validateConstraint; +/** + * Creates a new object of the provided class and will call the constructor with + * any additional argument supplied. + */ +function create(ctor, ...args) { + let obj = Object.create(ctor.prototype); + ctor.apply(obj, args); + return obj; +} +exports.create = create; +function count(fromOrTo, toOrCallback, callback) { + var from, to; + if (isNumber(toOrCallback)) { + from = fromOrTo; + to = toOrCallback; + } + else { + from = 0; + to = fromOrTo; + callback = toOrCallback; + } + var op = from <= to ? (i) => i + 1 : (i) => i - 1; + var cmp = from <= to ? (a, b) => a < b : (a, b) => a > b; + for (var i = from; cmp(i, to); i = op(i)) { + callback(i); + } +} +exports.count = count; +function countToArray(fromOrTo, to) { + var result = []; + var fn = (i) => result.push(i); + if (isUndefined(to)) { + count(fromOrTo, fn); + } + else { + count(fromOrTo, to, fn); + } + return result; +} +exports.countToArray = countToArray; +//# sourceMappingURL=primitives.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js.map new file mode 100644 index 0000000..c794a9b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/primitives.js.map @@ -0,0 +1 @@ +{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../../src/lib/common/primitives.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,YAAY,CAAC;;;AAEb,MAAM,OAAO,GAAG;IACf,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACpB,CAAC;AAEF;;GAEG;AACH,SAAgB,OAAO,CAAC,KAAU;IACjC,IAAI,KAAK,CAAC,OAAO,EAAE;QAClB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC5B;IAED,IAAI,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,KAAK,EAAE;QACrF,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAVD,0BAUC;AAED;;GAEG;AACH,SAAgB,QAAQ,CAAC,GAAQ;IAChC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,IAAI,GAAG,YAAY,MAAM,EAAE;QAC7D,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAND,4BAMC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAU;IACvC,OAAO,OAAO,CAAC,KAAK,CAAC,IAAY,KAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,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GAAG,EAAE,CAAC,CAAC,CAAC,EAAE;QACzC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACZ;AACF,CAAC;AAlBD,sBAkBC;AAID,SAAgB,YAAY,CAAC,QAAgB,EAAE,EAAW;IACzD,IAAI,MAAM,GAAa,EAAE,CAAC;IAC1B,IAAI,EAAE,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE;QACpB,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACpB;SAAM;QACN,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;KACxB;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAXD,oCAWC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js new file mode 100644 index 0000000..b67a642 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js @@ -0,0 +1,437 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.utf8 = exports.hex = exports.base64 = exports.ascii = exports.substitute = exports.replace = exports.replaceAll = exports.multipleReplace = exports.findOcurrences = exports.escapeRegExp = exports.createUUID = exports.escapeXml = exports.escapeRegExpEx = exports.getJson = exports.capitalize = exports.LOW_SURROGATE_MAX = exports.LOW_SURROGATE_MIN = exports.HIGH_SURROGATE_MAX = exports.HIGH_SURROGATE_MIN = exports.disableFlag = exports.hasFlagHex = exports.hasFlag = exports.DefaultDelimiter = void 0; +const primitives_1 = require("./primitives"); +const lodash_1 = require("lodash"); +const escapeRegExpPattern = /[[\]{}()|\/\\^$.*+?]/g; +const escapeXmlPattern = /[&<]/g; +const escapeXmlForPattern = /[&<>'"]/g; +const escapeXmlMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''' +}; +exports.DefaultDelimiter = { + begin: '<%', + end: '%>' +}; +exports.hasFlag = (field, enumValue) => { + //noinspection JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage + // tslint:disable-next-line:no-bitwise + return ((1 << enumValue) & field) ? true : false; +}; +exports.hasFlagHex = (field, enumValue) => { + //noinspection JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage + // tslint:disable-next-line:no-bitwise + return enumValue & field ? true : false; +}; +exports.disableFlag = (enumValue, field) => { + enumValue &= ~(1 << field); + return enumValue; +}; +/** + * The minimum location of high surrogates + */ +exports.HIGH_SURROGATE_MIN = 0xD800; +/** + * The maximum location of high surrogates + */ +exports.HIGH_SURROGATE_MAX = 0xDBFF; +/** + * The minimum location of low surrogates + */ +exports.LOW_SURROGATE_MIN = 0xDC00; +/** + * The maximum location of low surrogates + */ +exports.LOW_SURROGATE_MAX = 0xDFFF; +const BASE64_KEYSTR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +exports.capitalize = (word) => { + return word.substring(0, 1).toUpperCase() + word.substring(1); +}; +exports.getJson = (inData, validOnly, ommit) => { + try { + return lodash_1.isString(inData) ? JSON.parse(inData) : validOnly === true ? null : inData; + } + catch (e) { + ommit !== false && console.error('error parsing json data ' + inData + ' error = ' + e); + } + return null; +}; +/** + * Escapes a string so that it can safely be passed to the RegExp constructor. + * @param text The string to be escaped + * @return The escaped string + */ +function escapeRegExpEx(text) { + return !text ? text : text.replace(escapeRegExpPattern, '\\$&'); +} +exports.escapeRegExpEx = escapeRegExpEx; +/** + * Sanitizes a string to protect against tag injection. + * @param xml The string to be escaped + * @param forAttribute Whether to also escape ', ", and > in addition to < and & + * @return The escaped string + */ +function escapeXml(xml, forAttribute = true) { + if (!xml) { + return xml; + } + const pattern = forAttribute ? escapeXmlForPattern : escapeXmlPattern; + return xml.replace(pattern, function (character) { + return escapeXmlMap[character]; + }); +} +exports.escapeXml = escapeXml; +function createUUID() { + const S4 = function () { + return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); + }; + return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4()); +} +exports.createUUID = createUUID; +function escapeRegExp(str) { + const special = ['[', ']', '(', ')', '{', '}', '*', '+', '.', '|', '||']; + for (let n = 0; n < special.length; n++) { + str = str.replace(special[n], '\\' + special[n]); + } + return str; +} +exports.escapeRegExp = escapeRegExp; +; +function findOcurrences(expression, delimiters) { + // tslint:disable-next-line:no-object-literal-type-assertion + const d = { + begin: escapeRegExp(delimiters.begin), + end: escapeRegExp(delimiters.end) + }; + return expression.match(new RegExp(d.begin + '([^' + d.end + ']*)' + d.end, 'g')); +} +exports.findOcurrences = findOcurrences; +; +function multipleReplace(str, hash) { + // to array + const a = []; + // tslint:disable-next-line:forin + for (let key in hash) { + a[a.length] = key; + } + return str.replace(new RegExp(a.join('\\b|\\b'), 'g'), function (m) { + return hash[m] || hash['\\' + m]; + }); +} +exports.multipleReplace = multipleReplace; +; +function replaceAll(find, replace, str) { + return str ? str.split(find).join(replace) : ''; +} +exports.replaceAll = replaceAll; +; +function replace(str, needle, what, delimiters) { + if (!str) { + return ''; + } + if (what && primitives_1.isObject(what) || primitives_1.isArray(what)) { + what = what; + if (!delimiters) { + // fast case + return multipleReplace(str, what); + } + const occurrence = findOcurrences(str, delimiters); + if (!occurrence) { + return str; + } + else { + for (let i = 0, j = occurrence.length; i < j; i++) { + const el = occurrence[i]; + // strip off delimiters + let _variableName = replaceAll(delimiters.begin, '', el); + _variableName = replaceAll(delimiters.end, '', _variableName); + str = replaceAll(el, (what[_variableName]), str); + } + } + return str; + } + // fast case + return replaceAll(needle, what, str); +} +exports.replace = replace; +; +exports.substitute = (template, map) => { + const transform = (k) => k || ''; + return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g, (match, key, format) => transform(map[key]).toString()); +}; +function decodeUtf8EncodedCodePoint(codePoint, validationRange = [0, Infinity], checkSurrogate) { + if (codePoint < validationRange[0] || codePoint > validationRange[1]) { + throw Error('Invalid continuation byte'); + } + if (checkSurrogate && codePoint >= exports.HIGH_SURROGATE_MIN && codePoint <= exports.LOW_SURROGATE_MAX) { + throw Error('Surrogate is not a scalar value'); + } + let encoded = ''; + if (codePoint > 0xFFFF) { + codePoint -= 0x010000; + encoded += String.fromCharCode(codePoint >>> 0x10 & 0x03FF | exports.HIGH_SURROGATE_MIN); + codePoint = exports.LOW_SURROGATE_MIN | codePoint & 0x03FF; + } + encoded += String.fromCharCode(codePoint); + return encoded; +} +function validateUtf8EncodedCodePoint(codePoint) { + if ((codePoint & 0xC0) !== 0x80) { + throw Error('Invalid continuation byte'); + } +} +/** + * Provides facilities for encoding a string into an ASCII-encoded byte buffer and + * decoding an ASCII-encoded byte buffer into a string. + */ +exports.ascii = { + /** + * Encodes a string into an ASCII-encoded byte buffer. + * + * @param data The text string to encode + */ + encode(data) { + if (data == null) { + return []; + } + const buffer = []; + for (let i = 0, length = data.length; i < length; i++) { + buffer[i] = data.charCodeAt(i); + } + return buffer; + }, + /** + * Decodes an ASCII-encoded byte buffer into a string. + * + * @param data The byte buffer to decode + */ + decode(data) { + if (data == null) { + return ''; + } + let decoded = ''; + for (let i = 0, length = data.length; i < length; i++) { + decoded += String.fromCharCode(data[i]); + } + return decoded; + } +}; +/** + * Provides facilities for encoding a string into a Base64-encoded byte buffer and + * decoding a Base64-encoded byte buffer into a string. + */ +exports.base64 = { + /** + * Encodes a Base64-encoded string into a Base64 byte buffer. + * + * @param data The Base64-encoded string to encode + */ + encode(data) { + if (data == null) { + return []; + } + const buffer = []; + let i = 0; + let length = data.length; + while (data[--length] === '=') { } + while (i < length) { + let encoded = BASE64_KEYSTR.indexOf(data[i++]) << 18; + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]) << 12; + } + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]) << 6; + } + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]); + } + buffer.push((encoded >>> 16) & 0xff); + buffer.push((encoded >>> 8) & 0xff); + buffer.push(encoded & 0xff); + } + while (buffer[buffer.length - 1] === 0) { + buffer.pop(); + } + return buffer; + }, + /** + * Decodes a Base64-encoded byte buffer into a Base64-encoded string. + * + * @param data The byte buffer to decode + */ + decode(data) { + if (data == null) { + return ''; + } + let decoded = ''; + let i = 0; + for (let length = data.length - (data.length % 3); i < length;) { + let encoded = data[i++] << 16 | data[i++] << 8 | data[i++]; + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3F); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3F); + decoded += BASE64_KEYSTR.charAt((encoded >>> 6) & 0x3F); + decoded += BASE64_KEYSTR.charAt(encoded & 0x3F); + } + if (data.length % 3 === 1) { + let encoded = data[i++] << 16; + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3f); + decoded += '=='; + } + else if (data.length % 3 === 2) { + let encoded = data[i++] << 16 | data[i++] << 8; + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 6) & 0x3f); + decoded += '='; + } + return decoded; + } +}; +/** + * Provides facilities for encoding a string into a hex-encoded byte buffer and + * decoding a hex-encoded byte buffer into a string. + */ +exports.hex = { + /** + * Encodes a string into a hex-encoded byte buffer. + * + * @param data The hex-encoded string to encode + */ + encode(data) { + if (data == null) { + return []; + } + const buffer = []; + for (let i = 0, length = data.length; i < length; i += 2) { + let encodedChar = parseInt(data.substr(i, 2), 16); + buffer.push(encodedChar); + } + return buffer; + }, + /** + * Decodes a hex-encoded byte buffer into a hex-encoded string. + * + * @param data The byte buffer to decode + */ + decode(data) { + if (data == null) { + return ''; + } + let decoded = ''; + for (let i = 0, length = data.length; i < length; i++) { + decoded += data[i].toString(16).toUpperCase(); + } + return decoded; + } +}; +/** + * Provides facilities for encoding a string into a UTF-8-encoded byte buffer and + * decoding a UTF-8-encoded byte buffer into a string. + * Inspired by the work of: https://github.com/mathiasbynens/utf8.js + */ +exports.utf8 = { + /** + * Encodes a string into a UTF-8-encoded byte buffer. + * + * @param data The text string to encode + */ + encode(data) { + if (data == null) { + return []; + } + const buffer = []; + for (let i = 0, length = data.length; i < length; i++) { + let encodedChar = data.charCodeAt(i); + /** + * Surrogates + * http://en.wikipedia.org/wiki/Universal_Character_Set_characters + */ + if (encodedChar >= exports.HIGH_SURROGATE_MIN && encodedChar <= exports.HIGH_SURROGATE_MAX) { + let lowSurrogate = data.charCodeAt(i + 1); + if (lowSurrogate >= exports.LOW_SURROGATE_MIN && lowSurrogate <= exports.LOW_SURROGATE_MAX) { + encodedChar = 0x010000 + (encodedChar - exports.HIGH_SURROGATE_MIN) * 0x0400 + (lowSurrogate - exports.LOW_SURROGATE_MIN); + i++; + } + } + if (encodedChar < 0x80) { + buffer.push(encodedChar); + } + else { + if (encodedChar < 0x800) { + buffer.push(((encodedChar >> 0x06) & 0x1F) | 0xC0); + } + else if (encodedChar < 0x010000) { + if (encodedChar >= exports.HIGH_SURROGATE_MIN && encodedChar <= exports.LOW_SURROGATE_MAX) { + throw Error('Surrogate is not a scalar value'); + } + buffer.push(((encodedChar >> 0x0C) & 0x0F) | 0xE0); + buffer.push(((encodedChar >> 0x06) & 0x3F) | 0x80); + } + else if (encodedChar < 0x200000) { + buffer.push(((encodedChar >> 0x12) & 0x07) | 0xF0); + buffer.push(((encodedChar >> 0x0C) & 0x3F) | 0x80); + buffer.push(((encodedChar >> 0x06) & 0x3F) | 0x80); + } + buffer.push((encodedChar & 0x3F) | 0x80); + } + } + return buffer; + }, + /** + * Decodes a UTF-8-encoded byte buffer into a string. + * + * @param data The byte buffer to decode + */ + decode(data) { + if (data == null) { + return ''; + } + let decoded = ''; + for (let i = 0, length = data.length; i < length; i++) { + let byte1 = data[i] & 0xFF; + if ((byte1 & 0x80) === 0) { + decoded += decodeUtf8EncodedCodePoint(byte1); + } + else if ((byte1 & 0xE0) === 0xC0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + let encodedByte = ((byte1 & 0x1F) << 0x06) | byte2; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x80, Infinity]); + } + else if ((byte1 & 0xF0) === 0xE0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + let byte3 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte3); + byte3 = byte3 & 0x3F; + let encodedByte = ((byte1 & 0x1F) << 0x0C) | (byte2 << 0x06) | byte3; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x0800, Infinity], true); + } + else if ((byte1 & 0xF8) === 0xF0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + let byte3 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte3); + byte3 = byte3 & 0x3F; + let byte4 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte4); + byte4 = byte4 & 0x3F; + let encodedByte = ((byte1 & 0x1F) << 0x0C) | (byte2 << 0x0C) | (byte3 << 0x06) | byte4; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x010000, 0x10FFFF]); + } + else { + validateUtf8EncodedCodePoint(byte1); + } + } + return decoded; + } +}; +//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js.map new file mode 100644 index 0000000..8a9c623 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/strings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../src/lib/common/strings.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAElD,mCAAkC;AAElC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AACpD,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACjC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AACvC,MAAM,YAAY,GAAiB;IAC/B,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,OAAO;CAChB,CAAC;AACW,QAAA,gBAAgB,GAAG;IAC5B,KAAK,EAAE,IAAI;IACX,GAAG,EAAE,IAAI;CACZ,CAAC;AACW,QAAA,OAAO,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;IACxC,sMAAsM;IACtM,sCAAsC;IACtC,OAAO,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC,CAAC;AACW,QAAA,UAAU,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;IAC3C,sMAAsM;IACtM,sCAAsC;IACtC,OAAO,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5C,CAAC,CAAC;AACW,QAAA,WAAW,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;IAC5C,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;IAC3B,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AACF;;GAEG;AACU,QAAA,kBAAkB,GAAG,MAAM,CAAC;AACzC;;GAEG;AACU,QAAA,kB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usion/lydia-print-head-v1/firmware/node/build/lib/common/types.js b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js new file mode 100644 index 0000000..370180e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js @@ -0,0 +1,14 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./enums"), exports); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js.map new file mode 100644 index 0000000..6290105 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/common/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/common/types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js b/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js new file mode 100644 index 0000000..a8dd70a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js @@ -0,0 +1,82 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = void 0; +const readline = require("readline"); +const googleapis_1 = require("googleapis"); +const path = require("path"); +const read_1 = require("@xblox/fs/read"); +const write_1 = require("@xblox/fs/write"); +// https://developers.google.com/sheets/api/quickstart/nodejs +// If modifying these scopes, delete token.json. +const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']; +// The file token.json stores the user's access and refresh tokens, and is +// created automatically when the authorization flow completes for the first +// time. +const TOKEN_PATH = 'token.json'; +/** + * Get and store new token after prompting for user authorization, and then + * execute the given callback with the authorized OAuth2 client. + * @param {google.auth.OAuth2} oAuth2Client The OAuth2 client to get token for. + * @param {getEventsCallback} callback The callback for the authorized client. + */ +const getNewToken = (oAuth2Client) => __awaiter(void 0, void 0, void 0, function* () { + const authUrl = oAuth2Client.generateAuthUrl({ + access_type: 'offline', + scope: SCOPES, + }); + console.log('Authorize this app by visiting this url:', authUrl); + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + rl.question('Enter the code from that page here: ', (code) => { + rl.close(); + oAuth2Client.getToken(code, (err, token) => { + if (err) + return console.error('Error while trying to retrieve access token', err); + oAuth2Client.setCredentials(token); + // Store the token to disk for later program executions + write_1.sync(TOKEN_PATH, JSON.stringify(token, null, 2)); + return oAuth2Client; + }); + }); +}); +const readSheet = (auth, sheet, range) => __awaiter(void 0, void 0, void 0, function* () { + const sheets = googleapis_1.google.sheets({ version: 'v4', auth }); + const res = yield sheets.spreadsheets.values.get({ + spreadsheetId: sheet, + range: range, + }); + return res.data.values; +}); +/** + * Create an OAuth2 client with the given credentials, and then execute the + * given callback function. + * @param {Object} credentials The authorization client credentials. + * @param {function} callback The callback to call with the authorized client. + */ +const authorize = (credentials) => __awaiter(void 0, void 0, void 0, function* () { + const { client_secret, client_id, redirect_uris } = credentials.installed; + const oAuth2Client = new googleapis_1.google.auth.OAuth2(client_id, client_secret, redirect_uris[0]); + const token = read_1.sync(TOKEN_PATH, 'string'); + if (!token) { + return getNewToken(oAuth2Client); + } + oAuth2Client.setCredentials(JSON.parse(token)); + return oAuth2Client; +}); +exports.read = (sheet, range) => __awaiter(void 0, void 0, void 0, function* () { + const creds = read_1.sync(path.resolve('credentials.json'), 'json'); + const client = yield authorize(creds); + return yield readSheet(client, sheet, range); +}); +//# sourceMappingURL=sheets.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js.map new file mode 100644 index 0000000..9b26cff --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/lib/net/sheets.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sheets.js","sourceRoot":"","sources":["../../../src/lib/net/sheets.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAqC;AACrC,2CAAoC;AACpC,6BAA6B;AAC7B,yCAAkD;AAClD,2CAAoD;AAEpD,6DAA6D;AAC7D,gDAAgD;AAEhD,MAAM,MAAM,GAAG,CAAC,uDAAuD,CAAC,CAAC;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,QAAQ;AACR,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAAO,YAAY,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC;QACzC,WAAW,EAAE,SAAS;QACtB,KAAK,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAChC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACzB,CAAC,CAAC;IACH,EAAE,CAAC,QAAQ,CAAC,sCAAsC,EA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,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;KACpC;IAED,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,YAAY,CAAC;AACxB,CAAC,CAAA,CAAA;AAEY,QAAA,IAAI,GAAG,CAAO,KAAa,EAAE,KAAa,EAAE,EAAE;IACvD,MAAM,KAAK,GAAG,WAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,MAAM,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC,CAAA,CAAA"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/log.js b/extrusion/lydia-print-head-v1/firmware/node/build/log.js new file mode 100644 index 0000000..dba7a82 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/log.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spinner = exports.inspect = exports.stack = exports.debug = exports.warn = exports.error = exports.info = exports.log = void 0; +const chalk_1 = require("chalk"); +const _ora = require("ora"); +// tslint:disable-next-line:no-var-requires +const jsome = require('jsome'); +jsome.level.show = true; +const glog = console.log; +exports.log = (msg, ...rest) => glog(chalk_1.default.magenta(msg), ...rest); +exports.info = (msg, ...rest) => glog(chalk_1.default.green(msg), ...rest); +exports.error = (msg, ...rest) => glog(chalk_1.default.red(msg), ...rest); +exports.warn = (msg, ...rest) => glog(chalk_1.default.yellow(msg), ...rest); +exports.debug = (msg, ...rest) => glog(chalk_1.default.blue(msg), ...rest); +exports.stack = (msg, ...rest) => glog(chalk_1.default.red(msg), new Error().stack); +exports.inspect = (msg, d = null) => { + glog(chalk_1.default.blue(msg)); + d && jsome(d); +}; +exports.spinner = (msg) => _ora(msg); +//# sourceMappingURL=log.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/log.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/log.js.map new file mode 100644 index 0000000..f76c8fc --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/log.js.map @@ -0,0 +1 @@ +{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAEzC,4BAA4B;AAC5B,2CAA2C;AAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;AACZ,QAAA,GAAG,GAAG,CAAC,GAAW,EAAE,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACzE,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACjE,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACvE,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAClE,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACjE,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AAC1E,QAAA,OAAO,GAAG,CAAC,GAAW,EAAE,IAAS,IAAI,EAAE,EAAE;IAClD,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtB,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AACW,QAAA,OAAO,GAAG,CAAC,GAAW,EAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/main.js b/extrusion/lydia-print-head-v1/firmware/node/build/main.js new file mode 100644 index 0000000..e8c9622 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/main.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const _cli_1 = require("./_cli"); +_cli_1.defaults(); +const cli = require("yargs"); +const program_1 = require("./commands/pid/program"); +program_1.register(cli); +var ModbusRTU = require("modbus-serial"); +const argv = cli.argv; +if (argv.h || argv.help) { + cli.showHelp(); + process.exit(); +} +else if (argv.v || argv.version) { + // tslint:disable-next-line:no-var-requires + var client = new ModbusRTU(); + process.exit(); +} +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/main.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/main.js.map new file mode 100644 index 0000000..42ac06b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,iCAAkC;AAAC,eAAQ,EAAE,CAAC;AAC9C,6BAA6B;AAC7B,oDAAwE;AAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;AACjG,IAAI,SAAS,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEzC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;AAEtB,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;IACrB,GAAG,CAAC,QAAQ,EAAE,CAAC;IACf,OAAO,CAAC,IAAI,EAAE,CAAC;CAClB;KAAM,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;IAC/B,2CAA2C;IAE3C,IAAI,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;IAE7B,OAAO,CAAC,IAAI,EAAE,CAAC;CAClB"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/paths.js b/extrusion/lydia-print-head-v1/firmware/node/build/paths.js new file mode 100644 index 0000000..5e0c675 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/paths.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default_trace_path = exports.default_path = exports.TRACE_SUFFIX = exports.STATS_SUFFIX = void 0; +const path = require("path"); +const url_1 = require("url"); +exports.STATS_SUFFIX = '_stats.json'; +exports.TRACE_SUFFIX = '_trace.json'; +// utils to create output file name for url, format : hostname_time.json +const _url_short = (url) => new url_1.URL(url).hostname; +const _date_suffix = () => new Date().toLocaleTimeString().replace(/:/g, '_'); +const _default_filename = (url) => `${_url_short(url)}_${_date_suffix()}`; +exports.default_path = (cwd, url) => `${path.join(cwd, _default_filename(url))}${exports.STATS_SUFFIX}`; +exports.default_trace_path = (cwd, url) => `${path.join(cwd, _default_filename(url))}${exports.TRACE_SUFFIX}`; +//# sourceMappingURL=paths.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/paths.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/paths.js.map new file mode 100644 index 0000000..6301e40 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/paths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,6BAA0B;AACb,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,YAAY,GAAG,aAAa,CAAC;AAC1C,wEAAwE;AACxE,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CAC/B,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AAE1B,MAAM,YAAY,GAAG,GAAG,EAAE,CACtB,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEvD,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CACtC,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,EAAE,EAAE,CAAC;AAE9B,QAAA,YAAY,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CACrD,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,oBAAY,EAAE,CAAC;AAElD,QAAA,kBAAkB,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CAC3D,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,oBAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/types.js b/extrusion/lydia-print-head-v1/firmware/node/build/types.js new file mode 100644 index 0000000..013b6fa --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/types.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OutputFormat = exports.OutputTarget = void 0; +///////////////////////////////////////////////////// +// +// Application types +// +var OutputTarget; +(function (OutputTarget) { + OutputTarget["STDOUT"] = "console"; + OutputTarget["FILE"] = "file"; +})(OutputTarget = exports.OutputTarget || (exports.OutputTarget = {})); +var OutputFormat; +(function (OutputFormat) { + OutputFormat["text"] = "text"; + OutputFormat["json"] = "json"; +})(OutputFormat = exports.OutputFormat || (exports.OutputFormat = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/build/types.js.map b/extrusion/lydia-print-head-v1/firmware/node/build/types.js.map new file mode 100644 index 0000000..a8faf19 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/build/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAAA,qDAAqD;AACrD,EAAE;AACF,qBAAqB;AACrB,EAAE;AACF,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,kCAAkB,CAAA;IAClB,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,6BAAa,CAAA;IACb,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB"} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/package-lock.json b/extrusion/lydia-print-head-v1/firmware/node/package-lock.json new file mode 100644 index 0000000..4a6aa29 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/package-lock.json @@ -0,0 +1,6157 @@ +{ + "name": "@plastichub/cli", + "version": "1.0.10", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@apify/http-request": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@apify/http-request/-/http-request-1.1.5.tgz", + "integrity": "sha512-wnT95dZKMbSl3K/K4hdDEnzGt/9cmf216jp3S3yDrAzlIA4eB3kDanI4gClaZ+yOsY3BRe8WNUPMIeCgWfksqQ==", + "requires": { + "apify-shared": "^0.1.67", + "got": "^9.6.0", + "proxy-agent": "^3.1.1" + } + }, + "@apify/ps-tree": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@apify/ps-tree/-/ps-tree-1.1.3.tgz", + "integrity": "sha512-+hIr8EaTRd9fsOiNNzf1Fi8Tm9qs8cdPBZjuq5fXDV6SOCdi2ZyQlcQSzc8lY0hb+UhBib1WPixtCdKLL169WA==", + "requires": { + "event-stream": "3.3.4" + } + }, + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/runtime-corejs2": { + "version": "7.7.7", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.7.7.tgz", + "integrity": "sha512-P91T3dFYQL7aj44PxOMIAbo66Ag3NbmXG9fseSYaXxapp3K9XTct5HU9IpTOm2D0AoktKusgqzN5YcSxZXEKBQ==", + "requires": { + "core-js": "^2.6.5", + "regenerator-runtime": "^0.13.2" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", + "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "requires": { + "@nodelib/fs.stat": "2.0.3", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", + "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==" + }, + "@nodelib/fs.walk": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", + "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "requires": { + "@nodelib/fs.scandir": "2.1.3", + "fastq": "^1.6.0" + } + }, + "@serialport/binding-abstract": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/binding-abstract/-/binding-abstract-9.0.1.tgz", + "integrity": "sha512-ncUFSRyVdpyCRuah2dzrs99UfEWWMAhV31ae2FT6j4f8TypQ8OgAF8KkcHiD4M3wORDh3UKCCTS7n8aJWge1RA==", + "requires": { + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@serialport/binding-mock": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/binding-mock/-/binding-mock-9.0.1.tgz", + "integrity": "sha512-C01T6iX+nNKB7S6BhQEy5nfk4lUk/CkdFEfen9DDPYhtFtIsm5GCGvRB3Fjnp+8oDrGWJOrZfxFf3kWOOx665A==", + "requires": { + "@serialport/binding-abstract": "^9.0.1", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@serialport/bindings": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/bindings/-/bindings-9.0.1.tgz", + "integrity": "sha512-O5QuwCdnHuZygBKw7tVq2wHysfOnCbOyKtR/k9T9zHqptd89Tzy6xJQNtnrcbV/2D22noKX6yWj+1wqvNe6NRA==", + "requires": { + "@serialport/binding-abstract": "^9.0.1", + "@serialport/parser-readline": "^9.0.1", + "bindings": "^1.5.0", + "debug": "^4.1.1", + "nan": "^2.14.1", + "prebuild-install": "^5.3.5" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@serialport/parser-byte-length": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-byte-length/-/parser-byte-length-9.0.1.tgz", + "integrity": "sha512-1Ikv4lgCNw8OMf35yCpgzjHwkpgBEkhBuXFXIdWZk+ixaHFLlAtp03QxGPZBmzHMK58WDmEQoBHC1V5BkkAKSQ==" + }, + "@serialport/parser-cctalk": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-cctalk/-/parser-cctalk-9.0.1.tgz", + "integrity": "sha512-GtMda2DeJ+23bNqOc79JYV06dax2n3FLLFM3zA7nfReCOi98QbuDj4TUbFESMOnp4DB0oMO0GYHCR9gHOedTkg==" + }, + "@serialport/parser-delimiter": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-delimiter/-/parser-delimiter-9.0.1.tgz", + "integrity": "sha512-+oaSl5zEu47OlrRiF5p5tn2qgGqYuhVcE+NI+Pv4E1xsNB/A0fFxxMv/8XUw466CRLEJ5IESIB9qbFvKE6ltaQ==" + }, + "@serialport/parser-readline": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-readline/-/parser-readline-9.0.1.tgz", + "integrity": "sha512-38058gxvyfgdeLpg3aUyD98NuWkVB9yyTLpcSdeQ3GYiupivwH6Tdy/SKPmxlHIw3Ml2qil5MR2mtW2fLPB5CQ==", + "requires": { + "@serialport/parser-delimiter": "^9.0.1" + } + }, + "@serialport/parser-ready": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-ready/-/parser-ready-9.0.1.tgz", + "integrity": "sha512-lgzGkVJaaV1rJVx26WwI2UKyPxc0vu1rsOeldzA3VVbF+ABrblUQA06+cRPpT6k96GY+X4+1fB1rWuPpt8HbgQ==" + }, + "@serialport/parser-regex": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/parser-regex/-/parser-regex-9.0.1.tgz", + "integrity": "sha512-BHTV+Lkl+J8hSecFtDRENaR4fgA6tw44J+dmA1vEKEyum0iDN4bihbu8yvztYyo4PhBGUKDfm/PnD5EkJm0dPA==" + }, + "@serialport/stream": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/@serialport/stream/-/stream-9.0.1.tgz", + "integrity": "sha512-S1xaf99vygbrMDNS/9GHYZYskWJHXJy6dCksW+ME2dzNXEXpz64vF0iug1tC1EIAhME9oD/s3ky2C9CUAd/GUg==", + "requires": { + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "@sindresorhus/df": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-2.1.0.tgz", + "integrity": "sha1-0gjPJ+BvC7R20U197M19cm6ao4k=", + "requires": { + "execa": "^0.2.2" + }, + "dependencies": { + "execa": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.2.2.tgz", + "integrity": "sha1-4urUcsLDGq1vc/GslW7vReEjIMs=", + "requires": { + "cross-spawn-async": "^2.1.1", + "npm-run-path": "^1.0.0", + "object-assign": "^4.0.1", + "path-key": "^1.0.0", + "strip-eof": "^1.0.0" + } + }, + "npm-run-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-1.0.0.tgz", + "integrity": "sha1-9cMr9ZX+ga6Sfa7FLoL4sACsPI8=", + "requires": { + "path-key": "^1.0.0" + } + }, + "path-key": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-1.0.0.tgz", + "integrity": "sha1-XVPVeAGWRsDWiADbThRua9wqx68=" + } + } + }, + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "@types/bluebird": { + "version": "3.5.29", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.29.tgz", + "integrity": "sha512-kmVtnxTuUuhCET669irqQmPAez4KFnFVKvpleVRyfC3g+SHD1hIkFZcWLim9BVcwUBLO59o8VZE4yGCmTif8Yw==" + }, + "@types/chalk": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@types/chalk/-/chalk-2.2.0.tgz", + "integrity": "sha512-1zzPV9FDe1I/WHhRkf9SNgqtRJWZqrBWgu7JGveuHmmyR9CnAPCie2N/x+iHrgnpYBIcCJWHBoMRv2TRWktsvw==", + "requires": { + "chalk": "*" + } + }, + "@types/cheerio": { + "version": "0.22.15", + "resolved": "https://registry.npmjs.org/@types/cheerio/-/cheerio-0.22.15.tgz", + "integrity": "sha512-UGiiVtJK5niCqMKYmLEFz1Wl/3L5zF/u78lu8CwoUywWXRr9LDimeYuOzXVLXBMO758fcTdFtgjvqlztMH90MA==", + "requires": { + "@types/node": "*" + } + }, + "@types/chokidar": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@types/chokidar/-/chokidar-2.1.3.tgz", + "integrity": "sha512-6qK3xoLLAhQVTucQGHTySwOVA1crHRXnJeLwqK6KIFkkKa2aoMFXh+WEi8PotxDtvN6MQJLyYN9ag9P6NLV81w==", + "requires": { + "chokidar": "*" + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" + }, + "@types/inline-css": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/inline-css/-/inline-css-0.0.32.tgz", + "integrity": "sha512-/QLPW0Tu2o5iq5B6fepkwT5J4xMPLaA/xnUi/jFDdRbT/ECVrpKB20X/4rM8BrIKkV/Z83anIBF8I4pbJhU1aw==", + "requires": { + "@types/bluebird": "*" + } + }, + "@types/js-beautify": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@types/js-beautify/-/js-beautify-1.8.2.tgz", + "integrity": "sha512-mOJgFuIN8HPbcTXXp50yKQIZo+/lzRL6pezQ4leEA0p3JXIbc0afYJq4MoDcJWIS8ibWBBjykvHpO58d+Y3dhQ==" + }, + "@types/lodash": { + "version": "4.14.149", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.149.tgz", + "integrity": "sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ==" + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" + }, + "@types/moment": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@types/moment/-/moment-2.13.0.tgz", + "integrity": "sha1-YE69GJvDvDShVIaJQE5hoqSqyJY=", + "requires": { + "moment": "*" + } + }, + "@types/node": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.1.tgz", + "integrity": "sha512-hx6zWtudh3Arsbl3cXay+JnkvVgCKzCWKv42C9J01N2T2np4h8w5X8u6Tpz5mj38kE3M9FM0Pazx8vKFFMnjLQ==" + }, + "@types/ora": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/ora/-/ora-1.3.5.tgz", + "integrity": "sha512-CZe3oXbO1XylJT1feg+/aCzNt6tfR4XO+IkLetc85O/yaZRw271cZtS8LL/2mknd+PoR5IKAjFLzo4KWZXxung==", + "requires": { + "@types/node": "*" + } + }, + "@types/pretty": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/pretty/-/pretty-2.0.0.tgz", + "integrity": "sha512-nojaE6CV03swMxoHnAisV2Rl0Ma6WPUtQo87hUmaotu/YPugPlmiRB60sthbyppXdMFTdJV3wm6zCENY4q1tKA==" + }, + "@types/puppeteer": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-1.20.3.tgz", + "integrity": "sha512-U1H7E4wHDsPe2s7wa2fpUD4kPYmu3n4hYRmlFK4WgKQxXE1ctY2h9Exely8GXs7743gLvrnzuX7aJuyG0SEMIQ==", + "requires": { + "@types/node": "*" + } + }, + "@types/ramda": { + "version": "0.25.51", + "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.25.51.tgz", + "integrity": "sha512-xcmtfHIgF9SYjhGdsZR1nQslxG4hu0cIpFfLQ4CWdw3KzHvl7ki1AzFLQUkbDTG42ZN3ZsQfdRzXRlkAvbIy5Q==" + }, + "@types/serialport": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@types/serialport/-/serialport-8.0.1.tgz", + "integrity": "sha512-IcKHq6b/ynKSF/x4al/Ce8+a0hpbYIEaIcK9Z3l4koLvQqAPSODZ37/hgemQx8dTu7fPZDMHN4bKmu89B3UaGA==", + "requires": { + "@types/node": "*" + } + }, + "@types/showdown": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-1.9.3.tgz", + "integrity": "sha512-akvzSmrvY4J5d3tHzUUiQr0xpjd4Nb3uzWW6dtwzYJ+qW/KdWw5F8NLatnor5q/1LURHnzDA1ReEwCVqcatRnw==" + }, + "@types/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=" + }, + "@types/strip-json-comments": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz", + "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==" + }, + "@types/which": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.2.tgz", + "integrity": "sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==" + }, + "@types/yargs": { + "version": "13.0.4", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-13.0.4.tgz", + "integrity": "sha512-Ke1WmBbIkVM8bpvsNEcGgQM70XcEh/nbpxQhW7FhrsbCsXSY9BmLB1+LHtD7r9zrsOcFlLiF+a/UeJsdfw3C5A==", + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-13.1.0.tgz", + "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==" + }, + "@xblox/core": { + "version": "0.0.19", + "resolved": "https://registry.npmjs.org/@xblox/core/-/core-0.0.19.tgz", + "integrity": "sha512-bKakmLx63E8YNYjD2bgSOAicGRIAZs7toyJWto1aqPb+36eEYIQ/RUkfHWGdKAZg1z+N5OtU8O/RDOL4f13b0w==", + "requires": { + "base-64": "^0.1.0", + "jsonpath": "^0.2.11", + "qs": "^6.4.0", + "reflect-metadata": "^0.1.10" + } + }, + "@xblox/fs": { + "version": "0.13.19", + "resolved": "https://registry.npmjs.org/@xblox/fs/-/fs-0.13.19.tgz", + "integrity": "sha512-211yh3Zkm0AIMjNfhOhGzw+vTWH+O4zMivktjW0M+l5mJkyM2f92Pw/GBvxFAOWR2Fryn2NfCIF1GiQIRYdTEQ==", + "requires": { + "@types/minimatch": "^3.0.3", + "@xblox/core": "0.0.18", + "denodeify": "^1.2.1", + "errno": "^0.1.4", + "mime": "^2.0.3", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "progress-stream": "^1.2.0", + "q": "^1.4.1", + "rimraf": "^2.6.2", + "throttle": "^1.0.3", + "trash": "^4.0.1", + "write-file-atomic": "^1.3.1" + }, + "dependencies": { + "@xblox/core": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/@xblox/core/-/core-0.0.18.tgz", + "integrity": "sha1-ZROAe6KYLGsnSz45cr7DEt+yyNo=", + "requires": { + "base-64": "^0.1.0", + "jsonpath": "^0.2.11", + "qs": "^6.4.0", + "reflect-metadata": "^0.1.10" + } + } + } + }, + "JSONSelect": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", + "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=" + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "add": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/add/-/add-2.0.6.tgz", + "integrity": "sha1-JI8Kn25aUo7yKV2+7DBTITCuIjU=" + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", + "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "apify": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/apify/-/apify-0.17.0.tgz", + "integrity": "sha512-3hezEF7tK1DMipTUpYaGgJeeq/XyIbbFgUZMdldRG5MgkdF5a/jjx+NmgD2sBlWpVf/Oa8Lk2vejVYqv4B/z/g==", + "requires": { + "@apify/http-request": "^1.1.5", + "@apify/ps-tree": "^1.1.3", + "apify-client": "^0.5.25", + "apify-shared": "^0.1.66", + "cheerio": "^1.0.0-rc.3", + "content-type": "^1.0.4", + "express": "^4.17.1", + "fs-extra": "^8.1.0", + "htmlparser2": "^3.10.1", + "iconv-lite": "^0.5.0", + "jquery": "^3.4.1", + "mime-types": "^2.1.24", + "proxy-chain": "^0.2.7", + "puppeteer": "2.0.0", + "request": "^2.88.0", + "request-promise-native": "^1.0.5", + "rimraf": "^2.7.1", + "semver": "^6.3.0", + "socket.io": "^2.2.0", + "underscore": "^1.9.1", + "ws": "^6.2.1", + "xregexp": "^4.2.4" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + } + } + }, + "apify-client": { + "version": "0.5.26", + "resolved": "https://registry.npmjs.org/apify-client/-/apify-client-0.5.26.tgz", + "integrity": "sha512-hixiYU1u9GzWXfMgy+tQAZNv/xQTwgCOFoNcvGBtPHmFmBonw5uK4wwK6hcAyCMymfFxSNay948lVF6h2Ydp/g==", + "requires": { + "apify-shared": "^0.1.45", + "content-type": "^1.0.4", + "request": "^2.88.0", + "request-promise-native": "^1.0.7", + "type-check": "^0.3.2", + "underscore": "^1.9.1" + }, + "dependencies": { + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + } + } + }, + "apify-shared": { + "version": "0.1.68", + "resolved": "https://registry.npmjs.org/apify-shared/-/apify-shared-0.1.68.tgz", + "integrity": "sha512-mxfR8Zcs0IE9QHhVUk01nzgwv+nLnef+XU39inj/4A2pBBn5E/aDvGH03TLPOfnDT/dzu/eDgAPsRwgM2PSzSg==", + "requires": { + "bluebird": "^3.7.2", + "clone": "^2.1.1", + "is-buffer": "^2.0.3", + "request": "^2.88.0", + "slugg": "^1.2.1", + "underscore": "^1.9.1", + "url": "^0.11.0" + }, + "dependencies": { + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + } + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "arg": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz", + "integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==" + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==" + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "ast-types": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.2.tgz", + "integrity": "sha512-uWMHxJxtfj/1oZClOxDEV1sQ1HCDkA4MG8Gr69KKeBjEVH0R84WlejZ0y2DcwyBlpAEMltmVYkVgqfLFb2oyiA==" + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.0.tgz", + "integrity": "sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==" + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base-64": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base-64/-/base-64-0.1.0.tgz", + "integrity": "sha1-eAqZyE59YAJgNhURxId2E78k9rs=" + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" + }, + "base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==" + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, + "bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==" + }, + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==" + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bl": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz", + "integrity": "sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==" + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "dependencies": { + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + } + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "buffer": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", + "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" + }, + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" + } + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" + } + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cheerio": { + "version": "1.0.0-rc.3", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz", + "integrity": "sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.1", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash": "^4.15.0", + "parse5": "^3.0.1" + } + }, + "chokidar": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", + "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.3.0" + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "cjson": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/cjson/-/cjson-0.2.1.tgz", + "integrity": "sha1-c82KrWXZ4VBfmvF0TTt5wVJ2gqU=" + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-spinners": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-1.3.1.tgz", + "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==" + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=" + }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "colors": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", + "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=" + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "optional": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "optional": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "optional": true + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "condense-newlines": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/condense-newlines/-/condense-newlines-0.2.1.tgz", + "integrity": "sha1-PemFVTE5R10yUCyDsC9gaE0kxV8=", + "requires": { + "extend-shallow": "^2.0.1", + "is-whitespace": "^0.3.0", + "kind-of": "^3.0.2" + } + }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "requires": { + "safe-buffer": "5.1.2" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "core-js": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", + "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "cross-spawn-async": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz", + "integrity": "sha1-hF/wwINKPe2dFg2sptOQkGuyiMw=", + "requires": { + "lru-cache": "^4.0.0", + "which": "^1.2.8" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "css-rules": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/css-rules/-/css-rules-1.0.9.tgz", + "integrity": "sha512-HU0mZu0RFIjRRWn4QIAO8MaE1W7q+JSCIiiKE9g2s3b0xgDEAYXG/F9n35xAkaU9NpvUbxBTMJWx1quRRPXbjg==", + "requires": { + "cssom": "^0.4.4" + } + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.3.tgz", + "integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==" + }, + "cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==" + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "data-uri-to-buffer": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-1.2.0.tgz", + "integrity": "sha512-vKQ9DTQPN1FLYiiEEOQ6IBGFqvjCa5rSK3cWMy/Nespm5d/x3dGFT9UBZnkLxCwua/IXBi2TYnwTEpsOvhC4UQ==" + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "requires": { + "get-stdin": "^4.0.1", + "meow": "^3.3.0" + } + }, + "debounce": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz", + "integrity": "sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "requires": { + "clone": "^1.0.2" + } + }, + "defer-to-connect": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.1.tgz", + "integrity": "sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==" + }, + "degenerator": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-1.0.4.tgz", + "integrity": "sha1-/PSQo37OJmRk2cxDGrmMWBnO0JU=", + "requires": { + "ast-types": "0.x.x", + "escodegen": "1.x.x", + "esprima": "3.x.x" + }, + "dependencies": { + "escodegen": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.12.1.tgz", + "integrity": "sha512-Q8t2YZ+0e0pc7NRVj3B4tSQ9rim1oi4Fh46k2xhJ2qOiEwhQfdjyEQddWdj7ZFaKmU+5104vn1qrcjEPWq+bgQ==", + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + } + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "denodeify": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/denodeify/-/denodeify-1.2.1.tgz", + "integrity": "sha1-OjYof1A05pnnV3kBBSwubJQlFjE=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + }, + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==" + }, + "dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "requires": { + "path-type": "^3.0.0" + } + }, + "dom-serializer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", + "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + }, + "domhandler": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", + "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, + "dynamic-dedupe": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/dynamic-dedupe/-/dynamic-dedupe-0.3.0.tgz", + "integrity": "sha1-BuRMIj9eTpTXjvnbI6ZRXOL5YqE=", + "requires": { + "xtend": "^4.0.0" + }, + "dependencies": { + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } + }, + "ebnf-parser": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz", + "integrity": "sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "engine.io": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.0.tgz", + "integrity": "sha512-XCyYVWzcHnK5cMz7G4VTu2W7zJS7SM1QkcelghyIk/FmobWBtXE7fwhBusEKvCSqc3bMh8fNFMlUkCKTFRxH2w==", + "requires": { + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" + }, + "dependencies": { + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "ws": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.1.tgz", + "integrity": "sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A==" + } + } + }, + "engine.io-client": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.0.tgz", + "integrity": "sha512-a4J5QO2k99CM2a0b12IznnyQndoEvtA4UAldhGzKqnHf42I3Qs2W5SPnDvatZRcMaNZs4IevVicBPayxYt6FwA==", + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", + "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-applescript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-applescript/-/escape-string-applescript-2.0.0.tgz", + "integrity": "sha1-dgvKg4Zo5Aj+XuUs5CyvfLRsUnM=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "escodegen": { + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-0.0.21.tgz", + "integrity": "sha1-U9ZSz6EDA4gnlFilJmxf/HCcY8M=", + "requires": { + "esprima": "~1.0.2", + "estraverse": "~0.0.4", + "source-map": ">= 0.1.2" + }, + "dependencies": { + "esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + } + } + }, + "esprima": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz", + "integrity": "sha1-dqD9Zvz+FU/SkmZ9wmQBl1CxZXs=" + }, + "estraverse": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-0.0.4.tgz", + "integrity": "sha1-AaCTLf7ldGhKWYr1pnw7+bZCjbI=" + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "requires": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" + }, + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, + "extract-css": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/extract-css/-/extract-css-1.5.4.tgz", + "integrity": "sha512-HRwKPAqBkykCxGcYn1Zdp23uVLNXj2xuqCOqcEv+hGmExqwjspiGpyh8S+E/nvL3jNe/xyH1Vu6XdVND4LP8/w==", + "requires": { + "batch": "^0.6.1", + "href-content": "^1.2.3", + "list-stylesheets": "^1.2.7", + "style-data": "^1.4.5" + } + }, + "extract-zip": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.7.tgz", + "integrity": "sha1-qEC0uK9kAyZMjbV/Txp0Mz74H+k=", + "optional": true, + "requires": { + "concat-stream": "1.6.2", + "debug": "2.6.9", + "mkdirp": "0.5.1", + "yauzl": "2.4.1" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-glob": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.1.1.tgz", + "integrity": "sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, + "fast-text-encoding": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz", + "integrity": "sha512-R9bHCvweUxxwkDwhjav5vxpFvdPGlVngtqmx4pIZfSUhM/Q4NiIUHB456BAf+Q1Nwu3HEZYONtu+Rya+af4jiQ==" + }, + "fastq": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", + "integrity": "sha512-jmxqQ3Z/nXoeyDmWAzF9kH1aGZSis6e/SbfPmJpUnyZ0ogr6iscHQaml4wsEepEWSdtmpy+eVXmCRIMpxaXqOA==", + "requires": { + "reusify": "^1.0.0" + } + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "optional": true, + "requires": { + "pend": "~1.2.0" + } + }, + "figlet": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/figlet/-/figlet-1.2.4.tgz", + "integrity": "sha512-mv8YA9RruB4C5QawPaD29rEVx3N97ZTyNrE4DAfbhuo6tpcMdKnPVo8MlyT3RP5uPcg5M14bEJBq7kjFf4kAWg==" + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=" + }, + "filenamify": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.1.0.tgz", + "integrity": "sha512-KQV/uJDI9VQgN7sHH1Zbk6+42cD6mnQ2HONzkXUfPJ+K2FC8GZ1dpewbbHw0Sz8Tf5k3EVdHVayM4DoAwWlmtg==", + "requires": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + } + }, + "filewatcher": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/filewatcher/-/filewatcher-3.0.1.tgz", + "integrity": "sha1-9KGVc1Xdr0Q8zXiolfPVXiPIoDQ=", + "requires": { + "debounce": "^1.0.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-util": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/flat-util/-/flat-util-1.0.5.tgz", + "integrity": "sha512-g5xOslxIpeTfLGsxTcztBS325qJH9zNqU7FZP+3zHFfIOcQIRbhDh/5EoM+50PZrgbkdLpDsvMCc29LWcRgbOw==" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "formidable": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz", + "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg==" + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=" + }, + "fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" + }, + "fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fsevents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.2.tgz", + "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", + "optional": true + }, + "ftp": { + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz", + "integrity": "sha1-kZfYYa2BQvPmPVqDv+TFn3MwiF0=", + "requires": { + "readable-stream": "1.1.x", + "xregexp": "2.0.0" + }, + "dependencies": { + "xregexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", + "integrity": "sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=" + } + } + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "gaxios": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-1.8.4.tgz", + "integrity": "sha512-BoENMnu1Gav18HcpV9IleMPZ9exM+AvUjrAOV4Mzs/vfz2Lu/ABv451iEXByKiMPn2M140uul1txXCg83sAENw==", + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.3.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "gcp-metadata": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-1.0.0.tgz", + "integrity": "sha512-Q6HrgfrCQeEircnNP3rCcEgiDv7eF9+1B+1MMgpE190+/+0mjQR8PxeOaRgxZWmdDAF9EIryHB9g1moPiw1SbQ==", + "requires": { + "gaxios": "^1.0.2", + "json-bigint": "^0.3.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + }, + "get-uri": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-2.0.4.tgz", + "integrity": "sha512-v7LT/s8kVjs+Tx0ykk1I+H/rbpzkHvuIq87LmeXptcf5sNWm9uQiwjNAt94SJPA1zOlCntmnOlJvVWKmzsxG8Q==", + "requires": { + "data-uri-to-buffer": "1", + "debug": "2", + "extend": "~3.0.2", + "file-uri-to-path": "1", + "ftp": "~0.3.10", + "readable-stream": "2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", + "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "dependencies": { + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=" + } + } + }, + "google-auth-library": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-3.1.2.tgz", + "integrity": "sha512-cDQMzTotwyWMrg5jRO7q0A4TL/3GWBgO7I7q5xGKNiiFf9SmGY/OJ1YsLMgI2MVHHsEGyrqYnbnmV1AE+Z6DnQ==", + "requires": { + "base64-js": "^1.3.0", + "fast-text-encoding": "^1.0.0", + "gaxios": "^1.2.1", + "gcp-metadata": "^1.0.0", + "gtoken": "^2.3.2", + "https-proxy-agent": "^2.2.1", + "jws": "^3.1.5", + "lru-cache": "^5.0.0", + "semver": "^5.5.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } + }, + "google-p12-pem": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-1.0.4.tgz", + "integrity": "sha512-SwLAUJqUfTB2iS+wFfSS/G9p7bt4eWcc2LyfvmUXe7cWp6p3mpxDo6LLI29MXdU6wvPcQ/up298X7GMC5ylAlA==", + "requires": { + "node-forge": "^0.8.0", + "pify": "^4.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "googleapis": { + "version": "39.2.0", + "resolved": "https://registry.npmjs.org/googleapis/-/googleapis-39.2.0.tgz", + "integrity": "sha512-66X8TG1B33zAt177sG1CoKoYHPP/B66tEpnnSANGCqotMuY5gqSQO8G/0gqHZR2jRgc5CHSSNOJCnpI0SuDxMQ==", + "requires": { + "google-auth-library": "^3.0.0", + "googleapis-common": "^0.7.0" + } + }, + "googleapis-common": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/googleapis-common/-/googleapis-common-0.7.2.tgz", + "integrity": "sha512-9DEJIiO4nS7nw0VE1YVkEfXEj8x8MxsuB+yZIpOBULFSN9OIKcUU8UuKgSZFU4lJmRioMfngktrbkMwWJcUhQg==", + "requires": { + "gaxios": "^1.2.2", + "google-auth-library": "^3.0.0", + "pify": "^4.0.0", + "qs": "^6.5.2", + "url-template": "^2.0.8", + "uuid": "^3.2.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "dependencies": { + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=" + }, + "gtoken": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-2.3.3.tgz", + "integrity": "sha512-EaB49bu/TCoNeQjhCYKI/CurooBKkGxIqFHsWABW0b25fobBYVTMe84A8EBVVZhl8emiUdNypil9huMOTmyAnw==", + "requires": { + "gaxios": "^1.0.4", + "google-p12-pem": "^1.0.0", + "jws": "^3.1.5", + "mime": "^2.2.0", + "pify": "^4.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + } + } + }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "hosted-git-info": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz", + "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==" + }, + "href-content": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/href-content/-/href-content-1.2.3.tgz", + "integrity": "sha512-Ap8D5Bw0e0IpRMxw6vX6+w6TRie5Jpto92529WxfZLDSpwB0u0cuX7xuRXSSvy/M1vvPRluvME2ktK5n0znoAA==", + "requires": { + "remote-content": "^1.2.3" + } + }, + "htmlparser2": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", + "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "http-cache-semantics": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" + }, + "http-errors": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.3.tgz", + "integrity": "sha512-ZTTX0MWrsQ2ZAhA1cejAwDLycFsd7I7nVtnkT3Ol0aqodaKW+0CTZDQ1uBv5whptCnc8e8HeRRJxRs0kmm/Qfw==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "requires": { + "agent-base": "4", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz", + "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "iconv-lite": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.0.tgz", + "integrity": "sha512-NnEhI9hIEKHOzJ4f697DMz9IQEXr/MMJ5w64vN2/4Ai+wRnvV7SBrL0KLoRlwaKVghOc7LQ5YkPLuX146b6Ydw==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==" + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "requires": { + "repeating": "^2.0.0" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, + "infestines": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/infestines/-/infestines-0.4.11.tgz", + "integrity": "sha512-09nHagZLOYUaXKHqdV+nxEaYaD0hRlKyhQMhgTMwfbvWpMkowXf4XLZzAkLq6Y90wZ7Wqm6aMoL2trBsNNKGeg==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "inline-css": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/inline-css/-/inline-css-2.6.2.tgz", + "integrity": "sha512-ab89e3My8nZ2RUb4ICsNmuxrLiCHgP8BrPpTDpFGEAdh9X/FWEnkdIgSFc4dvVsP8eV74Kqpj+ZLLqgUtRYzlQ==", + "requires": { + "cheerio": "^0.22.0", + "css-rules": "^1.0.9", + "extend": "^3.0.2", + "extract-css": "^1.5.4", + "flat-util": "^1.0.1", + "object.pick": "^1.3.0", + "slick": "^1.12.2", + "specificity": "^0.4.1" + }, + "dependencies": { + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + } + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, + "ipaddr.js": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", + "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" + }, + "is-whitespace": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-whitespace/-/is-whitespace-0.3.0.tgz", + "integrity": "sha1-Fjnssb4DauxppUy7QBz77XEUq38=" + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jison": { + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.13.tgz", + "integrity": "sha1-kEFwfWIkE2f1iDRTK58ZwsNvrHg=", + "requires": { + "JSONSelect": "0.4.0", + "cjson": "~0.2.1", + "ebnf-parser": "~0.1.9", + "escodegen": "0.0.21", + "esprima": "1.0.x", + "jison-lex": "0.2.x", + "lex-parser": "~0.1.3", + "nomnom": "1.5.2" + }, + "dependencies": { + "esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + } + } + }, + "jison-lex": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/jison-lex/-/jison-lex-0.2.1.tgz", + "integrity": "sha1-rEuBXozOUTLrErXfz+jXB7iETf4=", + "requires": { + "lex-parser": "0.1.x", + "nomnom": "1.5.2" + } + }, + "jquery": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.0.tgz", + "integrity": "sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ==" + }, + "js-beautify": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.11.0.tgz", + "integrity": "sha512-a26B+Cx7USQGSWnz9YxgJNMmML/QG2nqIaL7VVYPCXbqiKz8PN0waSNvroMtvAK6tY7g/wPdNWGEP+JTNIBr6A==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "mkdirp": "~1.0.3", + "nopt": "^4.0.3" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + } + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jsome": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/jsome/-/jsome-2.5.0.tgz", + "integrity": "sha1-XkF+70NB/+uD7ov6kmWzbVb+Se0=", + "requires": { + "chalk": "^2.3.0", + "json-stringify-safe": "^5.0.1", + "yargs": "^11.0.0" + }, + "dependencies": { + "yargs": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.1.tgz", + "integrity": "sha512-PRU7gJrJaXv3q3yQZ/+/X6KBswZiaQ+zOmdprZcouPYtQgvNU35i+68M4b1ZHLZtYFT5QObFLV+ZkmJYcwKdiw==", + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.1.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + } + } + }, + "json-bigint": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-0.3.0.tgz", + "integrity": "sha1-DM2RLEuCcNBfBW+9E4FLU9OCWx4=", + "requires": { + "bignumber.js": "^7.0.0" + } + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonpath": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/jsonpath/-/jsonpath-0.2.12.tgz", + "integrity": "sha1-W/nZEftGFsHjNwvs658NskrjTNI=", + "requires": { + "esprima": "1.2.2", + "jison": "0.4.13", + "static-eval": "0.2.3", + "underscore": "1.7.0" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "requires": { + "json-buffer": "3.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "requires": { + "is-buffer": "^1.1.5" + } + }, + "klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=", + "requires": { + "graceful-fs": "^4.1.9" + } + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "lex-parser": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", + "integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=" + }, + "list-stylesheets": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/list-stylesheets/-/list-stylesheets-1.2.7.tgz", + "integrity": "sha512-KjH7/HwD1C3bsoEoZiGACpi2qIiVf4aHChP58StF+hCJnNQcuxKcaGZuKmy3h4DhbecDn/j81fQY/ixuG/yT6A==", + "requires": { + "cheerio": "^0.22.0", + "extend": "^3.0.2", + "object.pick": "^1.3.0" + }, + "dependencies": { + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + } + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + }, + "lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "requires": { + "chalk": "^2.0.1" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==" + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "requires": { + "p-defer": "^1.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" + }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=" + }, + "markdown-table": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz", + "integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==", + "requires": { + "repeat-string": "^1.0.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "mediaquery-text": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/mediaquery-text/-/mediaquery-text-1.1.5.tgz", + "integrity": "sha512-T27sUGebV4BhxKpvBThwlZHnMR5elqw4hDSXs0ohHBRGh7k79LaR3lmJHJlIjrNa+LHTl35OWUW56dSGtMNzXQ==", + "requires": { + "cssom": "^0.4.4" + } + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "merge2": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.3.0.tgz", + "integrity": "sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mime": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz", + "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA==" + }, + "mime-db": { + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" + }, + "mime-types": { + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", + "requires": { + "mime-db": "1.42.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" + }, + "modbus-serial": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/modbus-serial/-/modbus-serial-8.0.1.tgz", + "integrity": "sha512-WcN5nuQOMxpMcywCa9tABzktXK60t/zrZLHW7lWfqdXCljBMkQ4QWxuljm5+ayDaBeDgh/0iOIhzfDQ0O7i2KA==", + "requires": { + "debug": "^4.1.1", + "serialport": "^9.0.0" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "moment": { + "version": "2.26.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.26.0.tgz", + "integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw==" + }, + "monocle-ts": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/monocle-ts/-/monocle-ts-1.7.2.tgz", + "integrity": "sha512-F08hPUzQ14vOtac2vOagnvXPr0R0MRKWXF6Bwd3gQ4XnV2qfU0MzPL+L18kX4dXBkat74pxbL88V1BjAj3YOWg==" + }, + "mount-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mount-point/-/mount-point-3.0.0.tgz", + "integrity": "sha1-Zly57evoDREOZY21bDHQrvUaj5c=", + "requires": { + "@sindresorhus/df": "^1.0.1", + "pify": "^2.3.0", + "pinkie-promise": "^2.0.1" + }, + "dependencies": { + "@sindresorhus/df": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/df/-/df-1.0.1.tgz", + "integrity": "sha1-xptm9S9vzdKHyAffIQMF2694UA0=" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", + "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==" + }, + "napi-build-utils": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", + "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==" + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + }, + "netmask": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz", + "integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU=" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-abi": { + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.19.1.tgz", + "integrity": "sha512-HbtmIuByq44yhAzK7b9j/FelKlHYISKQn0mtvcBrU5QBkhoCMp5bu8Hv5AI34DcKfOAcJBcOEMwLlwO62FFu9A==", + "requires": { + "semver": "^5.4.1" + } + }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "node-forge": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.8.5.tgz", + "integrity": "sha512-vFMQIWt+J/7FLNyKouZ9TazT74PRV3wgv9UT4cRjC8BffxFbKXkgIWR42URCPSnHm/QDz6BOlb2Q0U4+VQT67Q==" + }, + "node-notifier": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.3.tgz", + "integrity": "sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q==", + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "nomnom": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", + "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=", + "requires": { + "colors": "0.5.x", + "underscore": "1.1.x" + }, + "dependencies": { + "underscore": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz", + "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=" + } + } + }, + "noop-logger": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", + "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=" + }, + "nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==" + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "requires": { + "boolbase": "~1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=" + }, + "object-keys": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz", + "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=" + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "requires": { + "isobject": "^3.0.1" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "requires": { + "mimic-fn": "^1.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + } + } + }, + "optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + } + }, + "ora": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-2.1.0.tgz", + "integrity": "sha512-hNNlAd3gfv/iPmsNxYoAPLvxg7HuPozww7fFonMZvL84tP6Ox5igfk5j/+a9rtJJwqMgKK+JgWsAQik5o0HTLA==", + "requires": { + "chalk": "^2.3.1", + "cli-cursor": "^2.1.0", + "cli-spinners": "^1.1.0", + "log-symbols": "^2.2.0", + "strip-ansi": "^4.0.0", + "wcwidth": "^1.0.1" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "dependencies": { + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + } + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==" + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==" + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "pac-proxy-agent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-3.0.1.tgz", + "integrity": "sha512-44DUg21G/liUZ48dJpUSjZnFfZro/0K5JTyFYLBcmh9+T6Ooi4/i4efwUiEy0+4oQusCBqWdhv16XohIj1GqnQ==", + "requires": { + "agent-base": "^4.2.0", + "debug": "^4.1.1", + "get-uri": "^2.0.0", + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^3.0.0", + "pac-resolver": "^3.0.0", + "raw-body": "^2.2.0", + "socks-proxy-agent": "^4.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "pac-resolver": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-3.0.0.tgz", + "integrity": "sha512-tcc38bsjuE3XZ5+4vP96OfhOugrX+JcnpUbhfuc4LuXBLQhoTthOstZeoQJBDnQUDYzYmdImKsbz0xSl1/9qeA==", + "requires": { + "co": "^4.6.0", + "degenerator": "^1.0.4", + "ip": "^1.1.5", + "netmask": "^1.0.6", + "thunkify": "^2.1.2" + } + }, + "parent-require": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parent-require/-/parent-require-1.0.0.tgz", + "integrity": "sha1-dGoWdjgIOoYLDu9nMssn7UbDKXc=" + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "requires": { + "@types/node": "*" + } + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "partial.lenses": { + "version": "13.16.0", + "resolved": "https://registry.npmjs.org/partial.lenses/-/partial.lenses-13.16.0.tgz", + "integrity": "sha512-SOhz+LPCL8Pa4vvckd7gGkEG5Vlt1ML3bw8n9LDBF0NzXD6jk9PgD9FmFOVydnn8XRvYeea1vpmamEiVEBprow==", + "requires": { + "infestines": "^0.4.9" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "requires": { + "pify": "^3.0.0" + } + }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "requires": { + "through": "~2.3" + } + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "optional": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "picomatch": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.1.1.tgz", + "integrity": "sha512-OYMyqkKzK7blWO/+XZYP6w8hH0LDvkBvdvKukti+7kqYFCiEAk+gI3DWnryapc0Dau05ugGTy0foQ6mqn4AHYA==" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "portastic": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/portastic/-/portastic-1.0.1.tgz", + "integrity": "sha1-HJgF1D+uj2pAzw28d5QJGi6dDSo=", + "requires": { + "bluebird": "^2.9.34", + "commander": "^2.8.1", + "debug": "^2.2.0" + }, + "dependencies": { + "bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=" + } + } + }, + "prebuild-install": { + "version": "5.3.5", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.5.tgz", + "integrity": "sha512-YmMO7dph9CYKi5IR/BzjOJlRzpxGGVo1EsLSUZ0mt/Mq0HWZIHOKHHcHdT69yG54C9m6i45GpItwRHpk0Py7Uw==", + "requires": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp": "^0.5.1", + "napi-build-utils": "^1.0.1", + "node-abi": "^2.7.0", + "noop-logger": "^0.1.1", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^3.0.3", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + } + } + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" + }, + "pretty": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pretty/-/pretty-2.0.0.tgz", + "integrity": "sha1-rbx5YLe7/iiaVX3F9zdhmiINBqU=", + "requires": { + "condense-newlines": "^0.2.1", + "extend-shallow": "^2.0.1", + "js-beautify": "^1.6.12" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "optional": true + }, + "progress-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/progress-stream/-/progress-stream-1.2.0.tgz", + "integrity": "sha1-LNPP6jO6OonJwSHsM0er6asSX3c=", + "requires": { + "speedometer": "~0.1.2", + "through2": "~0.2.3" + } + }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, + "proxy-addr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", + "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.0" + } + }, + "proxy-agent": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-3.1.1.tgz", + "integrity": "sha512-WudaR0eTsDx33O3EJE16PjBRZWcX8GqCEeERw1W3hZJgH/F2a46g7jty6UGty6NeJ4CKQy8ds2CJPMiyeqaTvw==", + "requires": { + "agent-base": "^4.2.0", + "debug": "4", + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^3.0.0", + "lru-cache": "^5.1.1", + "pac-proxy-agent": "^3.0.1", + "proxy-from-env": "^1.0.0", + "socks-proxy-agent": "^4.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + } + }, + "proxy-chain": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/proxy-chain/-/proxy-chain-0.2.7.tgz", + "integrity": "sha512-e0s94WDfooeC3zQkvIJ/Eudiy/AywTQK4K6PMYbZdBE2m/eug54ThgCPdBE4txHvzi0A0gAVbX04Kt4RygTlRQ==", + "requires": { + "bluebird": "^3.5.1", + "portastic": "^1.0.1", + "underscore": "^1.9.1" + }, + "dependencies": { + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + } + } + }, + "proxy-from-env": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", + "integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4=" + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, + "psl": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.7.0.tgz", + "integrity": "sha512-5NsSEDv8zY70ScRnOTn7bK7eanl2MvFrOrS/R6x+dBt5g1ghnj9Zv90kO8GwT8gxcu2ANyFprnFYB85IogIJOQ==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "puppeteer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-2.0.0.tgz", + "integrity": "sha512-t3MmTWzQxPRP71teU6l0jX47PHXlc4Z52sQv4LJQSZLq1ttkKS2yGM3gaI57uQwZkNaoGd0+HPPMELZkcyhlqA==", + "optional": true, + "requires": { + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^3.0.0", + "mime": "^2.0.3", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "optional": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "optional": true + } + } + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" + }, + "qs": { + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz", + "integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" + }, + "ramda": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz", + "integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==" + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.1.tgz", + "integrity": "sha512-9WmIKF6mkvA0SLmA2Knm9+qj89e+j1zqgyn8aXGd7+nAduPoqgI9lO57SAZNn/Byzo5P7JhXTyg9PzaJbH73bA==", + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.3", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + } + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "dependencies": { + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "requires": { + "pinkie-promise": "^2.0.0" + } + } + } + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "readdirp": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", + "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "requires": { + "picomatch": "^2.0.7" + } + }, + "readline": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz", + "integrity": "sha1-xYDXfvLPyHUrEySYBg3JeTp6wBw=" + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + }, + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" + }, + "remote-content": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/remote-content/-/remote-content-1.2.3.tgz", + "integrity": "sha512-cxyyyURneyIeUHWLdQ+G3BLT9LP4KY0lljsuUHYh9XBVOB1R+ChmgjirEQKKE4CV9VlbqvtGZ2qOafufenoT+A==", + "requires": { + "proxy-from-env": "^1.0.0", + "superagent": "^5.2.1", + "superagent-proxy": "^2.0.0" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + } + } + }, + "request-promise-core": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", + "requires": { + "lodash": "^4.17.15" + } + }, + "request-promise-native": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", + "requires": { + "request-promise-core": "1.1.3", + "stealthy-require": "^1.1.1", + "tough-cookie": "^2.3.3" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" + }, + "resolve": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.1.tgz", + "integrity": "sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg==", + "requires": { + "path-parse": "^1.0.6" + } + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "requires": { + "lowercase-keys": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + }, + "run-applescript": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-3.2.0.tgz", + "integrity": "sha512-Ep0RsvAjnRcBX1p5vogbaBdAGu/8j/ewpvGqnQYunnLd9SM0vWcPJewPKNnWFggf0hF0pwIgwV5XK7qQ7UZ8Qg==", + "requires": { + "execa": "^0.10.0" + } + }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==" + }, + "safe-buffer": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", + "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "serialport": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/serialport/-/serialport-9.0.1.tgz", + "integrity": "sha512-35Ms8dqjtAb73lptfEZG2l/nFZOxHt3hUjCHvl+g3Mu737gzFLDpSBrRywBJw4G4eS5ozZ3YcthwYnop1WO+ng==", + "requires": { + "@serialport/binding-mock": "^9.0.1", + "@serialport/bindings": "^9.0.1", + "@serialport/parser-byte-length": "^9.0.1", + "@serialport/parser-cctalk": "^9.0.1", + "@serialport/parser-delimiter": "^9.0.1", + "@serialport/parser-readline": "^9.0.1", + "@serialport/parser-ready": "^9.0.1", + "@serialport/parser-regex": "^9.0.1", + "@serialport/stream": "^9.0.1", + "debug": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" + }, + "showdown": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/showdown/-/showdown-1.9.1.tgz", + "integrity": "sha512-9cGuS382HcvExtf5AHk7Cb4pAeQQ+h0eTr33V1mu+crYWV4KvWAw6el92bDrqGEk5d46Ai/fhbEUwqJ/mTCNEA==", + "requires": { + "yargs": "^14.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yargs": { + "version": "14.2.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.2.tgz", + "integrity": "sha512-/4ld+4VV5RnrynMhPZJ/ZpOCGSCeghMykZ3BhdFBDa9Wy/RH6uEGNWDJog+aUlq+9OM1CFTgtYRW5Is1Po9NOA==", + "requires": { + "cliui": "^5.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^15.0.0" + } + }, + "yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + }, + "simple-get": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", + "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", + "requires": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "requires": { + "mimic-response": "^2.0.0" + } + }, + "mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" + } + } + }, + "simple-git": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-2.6.0.tgz", + "integrity": "sha512-eplWRfu6RTfoAzGl7I0+g06MvYauXaNpjeuhFiOYZO9hevnH54RkkStOkEevWwqBWfdzWNO9ocffbdtxFzBqXQ==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "slick": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/slick/-/slick-1.12.2.tgz", + "integrity": "sha1-vQSN23TefRymkV+qSldXCzVQwtc=" + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=" + }, + "slugg": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/slugg/-/slugg-1.2.1.tgz", + "integrity": "sha1-51KvIkGvPycURjxd4iXOpHYIdAo=" + }, + "slugify": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.3.6.tgz", + "integrity": "sha512-wA9XS475ZmGNlEnYYLPReSfuz/c3VQsEMoU43mi6OnKMCdbnFXd4/Yg7J0lBv8jkPolacMpOrWEaoYxuE1+hoQ==" + }, + "smart-buffer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz", + "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==" + }, + "socket.io": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", + "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "requires": { + "debug": "~4.1.0", + "engine.io": "~3.4.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.3.0", + "socket.io-parser": "~3.4.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "socket.io-adapter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", + "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==" + }, + "socket.io-client": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "socket.io-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + } + } + }, + "socket.io-parser": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.0.tgz", + "integrity": "sha512-/G/VOI+3DBp0+DJKW4KesGnQkQPFmUCbA/oO2QGT6CWxU7hLGWqU3tyuzeSK/dqcyeHsQg1vTe9jiZI8GU9SCQ==", + "requires": { + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "socks": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz", + "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==", + "requires": { + "ip": "1.1.5", + "smart-buffer": "^4.1.0" + } + }, + "socks-proxy-agent": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz", + "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==", + "requires": { + "agent-base": "~4.2.1", + "socks": "~2.3.2" + }, + "dependencies": { + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "requires": { + "es6-promisify": "^5.0.0" + } + } + } + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "optional": true + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==" + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==" + }, + "specificity": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/specificity/-/specificity-0.4.1.tgz", + "integrity": "sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==" + }, + "speedometer": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-0.1.4.tgz", + "integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=" + }, + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "requires": { + "through": "2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "static-eval": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-0.2.3.tgz", + "integrity": "sha1-Aj8XrJ/uQm6niMEuo5IG3Bdfiyo=", + "requires": { + "escodegen": "~0.0.24" + }, + "dependencies": { + "escodegen": { + "version": "0.0.28", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-0.0.28.tgz", + "integrity": "sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M=", + "requires": { + "esprima": "~1.0.2", + "estraverse": "~1.3.0", + "source-map": ">= 0.1.2" + } + }, + "esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + }, + "estraverse": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.3.2.tgz", + "integrity": "sha1-N8K4k+8T1yPydth41g2FNRUqbEI=" + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "requires": { + "duplexer": "~0.1.1" + } + }, + "stream-parser": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", + "integrity": "sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=", + "requires": { + "debug": "2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "requires": { + "get-stdin": "^4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, + "style-data": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/style-data/-/style-data-1.4.5.tgz", + "integrity": "sha512-N58OWmDNTBIXS9fUwqHv79Zn+sD4mrkwNCqnbM01eS6/FBhpUvO3Ux/ldMV87AY8I9is7Mw6dQZbNi+Eq4dEzw==", + "requires": { + "cheerio": "^0.22.0", + "extend": "^3.0.2", + "mediaquery-text": "^1.1.5", + "object.pick": "^1.3.0" + }, + "dependencies": { + "cheerio": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + } + } + }, + "superagent": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.2.1.tgz", + "integrity": "sha512-46b4Lkwnlz7Ebdv2FBbfuqb3kVkG1jV/SK3EW6NnwL9a3T4h5hHtegNEQfbXvTFbDoUZXId4W3dMgap2f6ic1g==", + "requires": { + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.2", + "debug": "^4.1.1", + "fast-safe-stringify": "^2.0.7", + "form-data": "^3.0.0", + "formidable": "^1.2.1", + "methods": "^1.1.2", + "mime": "^2.4.4", + "qs": "^6.9.1", + "readable-stream": "^3.4.0", + "semver": "^6.3.0" + }, + "dependencies": { + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "requires": { + "ms": "^2.1.1" + } + }, + "form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "readable-stream": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz", + "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "superagent-proxy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/superagent-proxy/-/superagent-proxy-2.0.0.tgz", + "integrity": "sha512-TktJma5jPdiH1BNN+reF/RMW3b8aBTCV7KlLFV0uYcREgNf3pvo7Rdt564OcFHwkGb3mYEhHuWPBhSbOwiNaYw==", + "requires": { + "debug": "^3.1.0", + "proxy-agent": "3" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "tar-fs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.0.tgz", + "integrity": "sha512-9uW5iDvrIMCVpvasdFHW0wJPez0K4JnMZtsuIeDI7HyMGJNxmDZDOCQROr7lXyS+iL/QMpj07qcjGYTSdRFXUg==", + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.0.0" + } + }, + "tar-stream": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", + "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, + "throttle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/throttle/-/throttle-1.0.3.tgz", + "integrity": "sha1-ijLkoV8XY9mXlIMXxevjrYpB5Lc=", + "requires": { + "readable-stream": ">= 0.3.0", + "stream-parser": ">= 0.0.2" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "through2": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", + "requires": { + "readable-stream": "~1.1.9", + "xtend": "~2.1.1" + } + }, + "thunkify": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/thunkify/-/thunkify-2.1.2.tgz", + "integrity": "sha1-+qDp0jDFGsyVyhOjYawFyn4EVT0=" + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=" + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "trash": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/trash/-/trash-4.3.0.tgz", + "integrity": "sha512-f36TKwIaBiXm63xSrn8OTNghg5CYHBsFVJvcObMo76LRpgariuRi2CqXQHw1VzfeximD0igdGaonOG6N760BtQ==", + "requires": { + "escape-string-applescript": "^2.0.0", + "fs-extra": "^0.30.0", + "globby": "^7.1.1", + "p-map": "^1.2.0", + "p-try": "^1.0.0", + "pify": "^3.0.0", + "run-applescript": "^3.0.0", + "uuid": "^3.1.0", + "xdg-trashdir": "^2.1.1" + } + }, + "tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==" + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" + }, + "trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "requires": { + "escape-string-regexp": "^1.0.2" + } + }, + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha1-QFkjkJWS1W94pYGENLC3hInKXys=", + "requires": { + "utf8-byte-length": "^1.0.1" + } + }, + "ts-node": { + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.5.4.tgz", + "integrity": "sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw==", + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^3.0.0" + } + }, + "ts-node-dev": { + "version": "1.0.0-pre.44", + "resolved": "https://registry.npmjs.org/ts-node-dev/-/ts-node-dev-1.0.0-pre.44.tgz", + "integrity": "sha512-M5ZwvB6FU3jtc70i5lFth86/6Qj5XR5nMMBwVxZF4cZhpO7XcbWw6tbNiJo22Zx0KfjEj9py5DANhwLOkPPufw==", + "requires": { + "dateformat": "~1.0.4-1.2.3", + "dynamic-dedupe": "^0.3.0", + "filewatcher": "~3.0.0", + "minimist": "^1.1.3", + "mkdirp": "^0.5.1", + "node-notifier": "^5.4.0", + "resolve": "^1.0.0", + "rimraf": "^2.6.1", + "source-map-support": "^0.5.12", + "tree-kill": "^1.2.1", + "ts-node": "*", + "tsconfig": "^7.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + } + } + }, + "tsconfig": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz", + "integrity": "sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==", + "requires": { + "@types/strip-bom": "^3.0.0", + "@types/strip-json-comments": "0.0.30", + "strip-bom": "^3.0.0", + "strip-json-comments": "^2.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + } + } + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" + }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "requires": { + "tslib": "^1.8.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "optional": true + }, + "typescript": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", + "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==" + }, + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + } + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "requires": { + "prepend-http": "^2.0.0" + } + }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" + }, + "user-home": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", + "requires": { + "os-homedir": "^1.0.0" + } + }, + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha1-9F8VDExm7uloGGUFq5P8u4rWv2E=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "requires": { + "defaults": "^1.0.3" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=" + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write-file-atomic": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xdg-basedir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-2.0.0.tgz", + "integrity": "sha1-7byQPMOF/ARSPZZqM1UEtVBNG9I=", + "requires": { + "os-homedir": "^1.0.0" + } + }, + "xdg-trashdir": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/xdg-trashdir/-/xdg-trashdir-2.1.1.tgz", + "integrity": "sha512-KcVhPaOu2ZurYNHSRTf1+ZHORkTZGCQ+u0JHN17QixRISJq4pXOnjt/lQcehvtHL5QAKhSzKgyjrcNnPdkPBHA==", + "requires": { + "@sindresorhus/df": "^2.1.0", + "mount-point": "^3.0.0", + "pify": "^2.2.0", + "user-home": "^2.0.0", + "xdg-basedir": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + } + } + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=" + }, + "xregexp": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.2.4.tgz", + "integrity": "sha512-sO0bYdYeJAJBcJA8g7MJJX7UrOZIfJPd8U2SC7B2Dd/J24U0aQNoGp33shCaBSWeb0rD5rh6VBUIXOkGal1TZA==", + "requires": { + "@babel/runtime-corejs2": "^7.2.0" + } + }, + "xtend": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-2.1.2.tgz", + "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=", + "requires": { + "object-keys": "~0.4.0" + } + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + }, + "yargonaut": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/yargonaut/-/yargonaut-1.1.4.tgz", + "integrity": "sha512-rHgFmbgXAAzl+1nngqOcwEljqHGG9uUZoPjsdZEs1w5JW9RXYzrSvH/u70C1JE5qFi0qjsdhnUX/dJRpWqitSA==", + "requires": { + "chalk": "^1.1.1", + "figlet": "^1.1.1", + "parent-require": "^1.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" + } + } + }, + "yargs": { + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.0.2.tgz", + "integrity": "sha512-GH/X/hYt+x5hOat4LMnCqMd8r5Cv78heOMIJn1hr7QPPBqfeC6p89Y78+WB9yGDvfpCvgasfmWLzNzEioOUD9Q==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^16.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "ansi-styles": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.0.tgz", + "integrity": "sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==", + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", + "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yargs-parser": { + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "requires": { + "camelcase": "^4.1.0" + } + }, + "yauzl": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz", + "integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=", + "optional": true, + "requires": { + "fd-slicer": "~1.0.1" + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=" + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + } + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/package.json b/extrusion/lydia-print-head-v1/firmware/node/package.json new file mode 100644 index 0000000..a40d02b --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/package.json @@ -0,0 +1,83 @@ +{ + "name": "@plastichub/cli", + "version": "1.0.10", + "description": "", + "main": "./build/main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "dev": "ts-node-dev --debug src/main.ts", + "help": "node build/main.js --help", + "build": "tsc -p .", + "summary": "yarn build; node ./build/main.js summary --target=file", + "ls-com": "npx @serialport/list" + }, + "repository": { + "type": "git", + "url": "git+https://gitlab.com/plastichub/lang.git" + }, + "author": "", + "bin": { + "ph-cli": "build/main.js" + }, + "license": "ISC", + "bugs": { + "url": "https://gitlab.com/plastichub/lang/issues" + }, + "homepage": "https://gitlab.com/plastichub/lang#readme", + "dependencies": { + "@types/bluebird": "^3.5.29", + "@types/chalk": "^2.2.0", + "@types/cheerio": "^0.22.15", + "@types/chokidar": "^2.1.3", + "@types/inline-css": "0.0.32", + "@types/js-beautify": "^1.8.2", + "@types/lodash": "^4.14.110", + "@types/moment": "^2.13.0", + "@types/node": "^13.1.1", + "@types/ora": "^1.3.4", + "@types/pretty": "^2.0.0", + "@types/puppeteer": "^1.5.0", + "@types/ramda": "^0.25.51", + "@types/serialport": "^8.0.1", + "@types/showdown": "^1.9.3", + "@types/which": "^1.3.2", + "@types/yargs": "^13.0.4", + "@xblox/core": "^0.0.19", + "@xblox/fs": "^0.13.19", + "add": "^2.0.6", + "apify": "^0.17.0", + "bluebird": "^3.7.2", + "chalk": "^2.4.1", + "cheerio": "^1.0.0-rc.3", + "chokidar": "^3.3.1", + "fast-glob": "^3.1.1", + "filenamify": "^4.1.0", + "googleapis": "^39.2.0", + "inline-css": "^2.6.2", + "js-beautify": "^1.11.0", + "jsome": "^2.5.0", + "lodash": "^4.17.10", + "markdown-table": "^2.0.0", + "modbus-serial": "^8.0.1", + "moment": "^2.26.0", + "monocle-ts": "^1.2.0", + "ora": "^2.1.0", + "partial.lenses": "^13.13.2", + "pretty": "^2.0.0", + "ramda": "^0.25.0", + "readline": "^1.3.0", + "sanitize-filename": "^1.6.3", + "serialport": "^9.0.1", + "showdown": "^1.9.1", + "simple-git": "^2.6.0", + "slash": "^3.0.0", + "slugify": "^1.3.6", + "source-map-support": "^0.5.16", + "ts-node-dev": "^1.0.0-pre.44", + "tslint": "^5.10.0", + "typescript": "^3.7.4", + "which": "^2.0.2", + "yargonaut": "^1.1.4", + "yargs": "^15.0.2" + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/_cli.ts b/extrusion/lydia-print-head-v1/firmware/node/src/_cli.ts new file mode 100644 index 0000000..07eda1d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/_cli.ts @@ -0,0 +1,13 @@ +// tweaks and handlers +export const defaults = () => { + // default command + const DefaultCommand = 'summary'; + if (process.argv.length === 2) { + process.argv.push(DefaultCommand); + } + + // currently no default handler, display only : + process.on('unhandledRejection', (reason: string) => { + console.error('Unhandled rejection, reason: ', reason); + }); +}; \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/argv.ts b/extrusion/lydia-print-head-v1/firmware/node/src/argv.ts new file mode 100644 index 0000000..c4e1ba8 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/argv.ts @@ -0,0 +1,55 @@ +import * as CLI from 'yargs'; +import { + warn, error, + default_path, + Options, OutputFormat, OutputTarget, inspect +} from './'; + + +const LIGHT = 'http://google.co.uk'; +const HEAVY = 'http://0.0.0.0:5555/app/xcf?debug=true&xblox=debug&xgrid=debug&davinci=debug&userDirectory=/PMaster/x4mm/user;' + +// default options for all commands +export const defaultOptions = (yargs: CLI.Argv) => { + return yargs.option('url', { + default: LIGHT, + describe: 'The URL to analyze' + }).option('format', { + default: 'text', + describe: 'Normal human readable text or JSON [text|json]' + }).option('target', { + default: 'console', + describe: 'Output target [console|file]' + }).option('path', { + default: '', + describe: 'The target location on the local filesystem for --target=file' + }).option('debug', { + default: 'false', + describe: 'Enable internal debug message' + }) +}; + +// Sanitizes faulty user argv options for all commands. +export const sanitize = (argv: CLI.Arguments): Options => { + const args = argv as Options; + args.cwd = args.cwd || process.cwd(); + if (!args.url) { + // internal user error, should never happen! + error('Invalid url, abort'); + return process.exit(); + } + // path given but target is not file, correct to file + if (args.path && args.target !== OutputTarget.FILE) { + args.target = OutputTarget.FILE; + } + // target is file but no path given, correct to default file + if (args.target === OutputTarget.FILE && !args.path) { + args.path = default_path(args.cwd, args.url); + } + // format string not valid + if (!(argv.format in OutputFormat)) { + warn(`Unknown output format ${argv.format}! Default to ${OutputFormat.text}`); + args.format = OutputFormat.text; + } + return args; +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/commands/clean.ts b/extrusion/lydia-print-head-v1/firmware/node/src/commands/clean.ts new file mode 100644 index 0000000..bcb6705 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/commands/clean.ts @@ -0,0 +1,15 @@ +import * as CLI from 'yargs'; +import { defaultOptions, sanitize } from '../argv'; +import { Options } from '../'; +import { render as output } from '../output'; +// no extra options, using defaults +const options = (yargs: CLI.Argv) => defaultOptions(yargs); + +export const register = (cli: CLI.Argv) => { + return cli.command('clean', 'Clean all trace and data files', options, async (argv: CLI.Arguments) => { + //@TODO: this guard might not be necessary + if (argv.help) { return; } + const args = sanitize(argv) as Options; + output({}, args); + }); +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/commands/index.ts b/extrusion/lydia-print-head-v1/firmware/node/src/commands/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/commands/pid/program.ts b/extrusion/lydia-print-head-v1/firmware/node/src/commands/pid/program.ts new file mode 100644 index 0000000..8ad3bfe --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/commands/pid/program.ts @@ -0,0 +1,81 @@ +import * as CLI from 'yargs'; +import * as debug from '../../log'; +import * as utils from '../../lib/common/strings'; +import { read as readSheet } from '../../lib/net/sheets'; +import * as path from 'path'; +import { sync as read } from '@xblox/fs/read'; +import { sync as exists } from '@xblox/fs/exists'; +import { sync as dir } from '@xblox/fs/dir'; +import { sync as write } from '@xblox/fs/write'; +import { Converter } from 'showdown'; +import * as SerialPort from 'serialport'; + +// Programmer for E5DC-QX2ASM-002 Omron + +/** + * + * @link Modbus Docs https://www.npmjs.com/package/modbus-serial + * + * @link Serial Port CLI https://serialport.io/docs/guide-cli + */ + + +const defaultOptions = (yargs: CLI.Argv) => { + return yargs.option('port', { + default: 'COM7', + describe: 'serial port' + }); +}; + +let options = (yargs: CLI.Argv) => defaultOptions(yargs); + +// npm run build ; node ./build/main.js pid:program +export const register = (cli: CLI.Argv) => { + return cli.command('pid:program', 'Omron PID programmer', options, async (argv: CLI.Arguments) => { + if (argv.help) { return; } + + + const port = argv.port as string; + + + /* + const sp = new SerialPort(port,{ baudRate: 256000,parity:'even', dataBits:8 }); + parser.on('data', line => console.log(`> ${line}`))*/ + const ModbusRTU = require("modbus-serial"); + const client = new ModbusRTU(); + + + function end() { + console.log('read registers'); + client.close(); + } + + + function read() { + client.setID(1); + // on device number 1. + console.log('read registers'); + // 01 03 00 00 00 02 C4 0B + + client.readHoldingRegisters(2, 0).then((v + ) => { + console.log('v', v); + end(); + }); + } + + function write() { + + + console.log('write registers'); + // 01 03 20 00 00 01 8FCA + // write the values 0, 0xffff to registers starting at address 0 + // on device number 1. + // client.writeRegisters(1, [0]).then(read); + } + + debug.info(`Connecting to ${argv.port}`); + // open connection to a serial port + client.connectRTU(argv.port, { baudRate: 9600, parity: 'even' }, read); + }); +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/commands/tests.ts b/extrusion/lydia-print-head-v1/firmware/node/src/commands/tests.ts new file mode 100644 index 0000000..d8d9b06 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/commands/tests.ts @@ -0,0 +1,36 @@ +import * as CLI from 'yargs'; +import { debug } from '..'; +import * as utils from '../lib/common/strings'; +import { read as readSheet } from '../lib/net/sheets'; +import * as path from 'path'; +import { sync as read } from '@xblox/fs/read'; +import { sync as exists } from '@xblox/fs/exists'; +import { sync as dir } from '@xblox/fs/dir'; +import { sync as write } from '@xblox/fs/write'; +import { Converter } from 'showdown'; + + +const defaultOptions = (yargs: CLI.Argv) => { + return yargs.option('input', { + default: './', + describe: 'The sources' + }).option('output', { + default: './', + describe: 'The output' + }).option('debug', { + default: 'false', + describe: 'Enable internal debug message' + }) +}; + +let options = (yargs: CLI.Argv) => defaultOptions(yargs); + +// npm run build ; node ./build/main.js test +export const register = (cli: CLI.Argv) => { + return cli.command('test', 'test command', options, async (argv: CLI.Arguments) => { + if (argv.help) { return; } + + readSheet('1oVEiGH4o3SV-mAA3Mb-WNVJMyYl4VMxLjWjrSw_ipJY', 'ElenaMargin'); + + }); +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/commands/watch.ts b/extrusion/lydia-print-head-v1/firmware/node/src/commands/watch.ts new file mode 100644 index 0000000..3955c91 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/commands/watch.ts @@ -0,0 +1,79 @@ +import * as CLI from 'yargs'; +import { sanitize } from '../argv'; +import { Options } from '..'; +import { render as output } from '../output'; +import * as chokidar from 'chokidar'; +import * as path from 'path'; +import { debug } from '..'; +import { convert, convertFiles } from './markdown'; +import * as utils from '../lib/common/strings'; +import { sync as read } from '@xblox/fs/read'; +import { sync as exists } from '@xblox/fs/exists'; +import { sync as dir } from '@xblox/fs/dir'; +import { sync as write } from '@xblox/fs/write'; +import * as cheerio from 'cheerio'; +const pretty = require('pretty'); + +const defaultOptions = (yargs: CLI.Argv) => { + return yargs.option('input', { + default: './', + describe: 'The sources' + }).option('debug', { + default: 'false', + describe: 'Enable internal debug message' + }).option('tsx', { + default: 'true', + describe: 'Update tsx file' + }) +}; + +export const parseHTML = (input: string) => { + const $ = cheerio.load(input as string, { + xmlMode: true + }); + + $('meta').remove(); + $('templates').remove(); + + input = $.html(); + input = pretty(input,{ocd: true}); + return input; +} + +export const updateTSX = (mdPath: string) => { + const parts = path.parse(mdPath); + + let html = read(`${parts.dir}/${parts.name}.html`, 'string'); + const tsxin = read(`${parts.dir}/${parts.name}.tsxin`, 'string'); + html = parseHTML(html as string); + + const output = utils.replace(tsxin as string, null, { + CONTENT: html + }, { + begin: '<%', + end: '%>' + }); + + write(`${parts.dir}/${parts.name}.tsx`, output); +} + +let options = (yargs: CLI.Argv) => defaultOptions(yargs); +// npm run build ; node ./build/main.js watch --input=../pages +export const register = (cli: CLI.Argv) => { + return cli.command('watch', '', options, async (argv: CLI.Arguments) => { + if (argv.help) { return; } + const src = path.resolve('' + argv.input); + const watcher = chokidar.watch(`${src}/**/*.md`, { + ignored: /(^|[\/\\])\../, // ignore dotfiles + persistent: true + }); + if (argv.debug) { + debug(`Watching ${src}`); + } + watcher + .on('change', path => { + convertFiles([path]); + updateTSX(path); + }) + }); +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/constants.ts b/extrusion/lydia-print-head-v1/firmware/node/src/constants.ts new file mode 100644 index 0000000..5fa8e9e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/constants.ts @@ -0,0 +1,2 @@ +export const GIT_CHANGELOG_MESSAGE_PREFIX = 'ChangeLog:'; +export const GIT_REPO = 'https://gitlab.com/plastichub/products' \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/format.ts b/extrusion/lydia-print-head-v1/firmware/node/src/format.ts new file mode 100644 index 0000000..a721fb1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/format.ts @@ -0,0 +1,19 @@ +import { Options, OutputFormat } from "./types"; +import { error } from "./log"; + +export const render = (result: any, options: Options) => { + switch (options.format) { + case OutputFormat.text: { + //@TODO: human readable format + return JSON.stringify(result, null, 2); + } + case OutputFormat.json: { + return JSON.stringify(result, null, 2); + } + default: { + //private, should never happen since options had to be sanitized + error('format::render Invalid value in options.format'); + return ''; + } + } +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/formatter.ts b/extrusion/lydia-print-head-v1/firmware/node/src/formatter.ts new file mode 100644 index 0000000..dd96231 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/formatter.ts @@ -0,0 +1,18 @@ +export const sizeToString = (bytes: number, si: boolean = true) => { + var units; + var u; + var b = bytes; + var thresh = si ? 1000 : 1024; + if (Math.abs(b) < thresh) { + return b + ' B'; + } + units = si + ? ['kB', 'MB', 'GB', 'TB'] + : ['KiB', 'MiB', 'GiB', 'TiB']; + u = -1; + do { + b /= thresh; + ++u; + } while (Math.abs(b) >= thresh && u < units.length - 1); + return b.toFixed(1) + ' ' + units[u]; +}; \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/index.ts b/extrusion/lydia-print-head-v1/firmware/node/src/index.ts new file mode 100644 index 0000000..8c2ccaf --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/index.ts @@ -0,0 +1,6 @@ +export * from './paths'; +export * from './format'; +export * from './log'; +export * from './types'; +export * from './formatter'; +export * from './main'; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/array.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/array.ts new file mode 100644 index 0000000..8924fc7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/array.ts @@ -0,0 +1,15 @@ +/** + * Return last element + * @private + * @param {(Array)} array + * @returns object | undefined + */ +export const lastOf = (array: Array) => array[array.length - 1]; + +/** + * Return first element + * @private + * @param {(Array)} array + * @returns object | undefined + */ +export const firstOf = (array: Array) => array[0]; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ci.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ci.ts new file mode 100644 index 0000000..a2126db --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ci.ts @@ -0,0 +1,360 @@ +/** + * A 'Configurable Information's ("CI") processing state during post or pre-processing. + * + * @enum {int} module:xide/types/CI_STATE + * @memberOf module:xide/types + */ +export const CI_STATE = { + /** + * Nothing done, could also mean there is nothing to do all + * @constant + * @type int + */ + NONE: 0x00000000, + /** + * In pending state. At that time the compiler has accepted additional work and ci flag processing is queued + * but not scheduled yet. + * @constant + * @type int + */ + PENDING: 0x00000001, + /** + * The processing state. + * @constant + * @type int + */ + PROCESSING: 0x00000002, + /** + * The CI has been processed but it failed. + * @constant + * @type int + */ + FAILED: 0x00000004, + /** + * The CI was successfully processed. + * @constant + * @type int + */ + SUCCESSED: 0x00000008, + /** + * The CI has been processed. + * @constant + * @type int + */ + PROCESSED: 0x00000010, + /** + * The CI left the post/pre processor entirly but has not been accepted by the originating source. + * This state can happen when the source became invalid and so its sort of orphan. + * @constant + * @type int + */ + DEQUEUED: 0x00000020, + /** + * The CI fully resolved and no references except by the source are around. + * @constant + * @type int + */ + SOLVED: 0x00000040, + /** + * Flag to mark the core's end of this bitmask, from here its user land + * @constant + * @type int + */ + END: 0x00000080 +}; +/** + * A 'Configurable Information's ("CI") type flags for post and pre-processing a value. + * @enum {string} CIFLAGS + * @global + * @memberOf module:xide/types + */ +export const CIFLAG = { + /** + * Instruct for no additional extra processing + * @constant + * @type int + */ + NONE: 0x00000000, + /** + * Will instruct the pre/post processor to base-64 decode or encode + * @constant + * @type int + */ + BASE_64: 0x00000001, + /** + * Post/Pre process the value with a user function + * @constant + * @type int + */ + USE_FUNCTION: 0x00000002, + /** + * Replace variables with local scope's variables during the post/pre process + * @constant + * @type int + */ + REPLACE_VARIABLES: 0x00000004, + /** + * Replace variables with local scope's variables during the post/pre process but evaluate the whole string + * as Javascript + * @constant + * @type int + */ + REPLACE_VARIABLES_EVALUATED: 0x00000008, + /** + * Will instruct the pre/post processor to escpape evaluated or replaced variables or expressions + * @constant + * @type int + */ + ESCAPE: 0x00000010, + /** + * Will instruct the pre/post processor to replace block calls with oridinary vanilla script + * @constant + * @type int + */ + REPLACE_BLOCK_CALLS: 0x00000020, + /** + * Will instruct the pre/post processor to remove variable delimitters/placeholders from the final string + * @constant + * @type int + */ + REMOVE_DELIMTTERS: 0x00000040, + /** + * Will instruct the pre/post processor to remove "[" ,"]" , "(" , ")" , "{", "}" , "*" , "+" , "." + * @constant + * @type int + */ + ESCAPE_SPECIAL_CHARS: 0x00000080, + /** + * Will instruct the pre/post processor to use regular expressions over string substitution + * @constant + * @type int + */ + USE_REGEX: 0x00000100, + /** + * Will instruct the pre/post processor to use Filtrex (custom bison parser, needs xexpression) over string substitution + * @constant + * @type int + */ + USE_FILTREX: 0x00000200, + /** + * Cascade entry. There are cases where #USE_FUNCTION is not enough or we'd like to avoid further type checking. + * @constant + * @type int + */ + CASCADE: 0x00000400, + /** + * Cascade entry. There are cases where #USE_FUNCTION is not enough or we'd like to avoid further type checking. + * @constant + * @type int + */ + EXPRESSION: 0x00000800, + /** + * Dont parse anything + * @constant + * @type int + */ + DONT_PARSE: 0x000001000, + /** + * Convert to hex + * @constant + * @type int + */ + TO_HEX: 0x000002000, + /** + * Convert to hex + * @constant + * @type int + */ + REPLACE_HEX: 0x000004000, + /** + * Wait for finish + * @constant + * @type int + */ + WAIT: 0x000008000, + /** + * Wait for finish + * @constant + * @type int + */ + DONT_ESCAPE: 0x000010000, + /** + * Flag to mark the maximum core bit mask, after here its user land + * @constant + * @type int + */ + END: 0x000020000 +}; +/** + * A 'Configurable Information's ("CI") type information. Every CI has this information. You can + * re-composite new types with ECIType.STRUCTURE. However all 'beans' (rich objects) in the system all displayed through a set of CIs, + * also called the CIS (Configurable Information Set). There are many types already : + * + * Each ECIType has mapped widgets, BOOL : checkbox, STRING: Text-Areay and so forth. + * + * @enum {string} module:xide/types/ECIType + * @memberOf module:xide/types + */ +export const ECIType = { + /** + * @const + * @type { int} + */ + BOOL: 0, + /** + * @const + * @type { int} + */ + BOX: 1, + /** + * @const + * @type { int} + */ + COLOUR: 2, + /** + * @const + * @type { int} + */ + ENUMERATION: 3, + /** + * @const + * @type { int} + */ + FILE: 4, + /** + * @const + * @type { int} + */ + FLAGS: 5, + /** + * @const + * @type { int} + */ + FLOAT: 6, + /** + * @const + * @type { int} + */ + INTEGER: 7, + /** + * @const + * @type { int} + */ + MATRIX: 8, + /** + * @const + * @type { int} + */ + OBJECT: 9, + /** + * @const + * @type { int} + */ + REFERENCE: 10, + /** + * @const + * @type { int} + */ + QUATERNION: 11, + /** + * @const + * @type { int} + */ + RECTANGLE: 12, + /** + * @const + * @type { int} + */ + STRING: 13, + /** + * @const + * @type { int} + */ + VECTOR: 14, + /** + * @const + * @type { int} + */ + VECTOR2D: 15, + /** + * @const + * @type { int} + */ + VECTOR4D: 16, + /** + * @const + * @type { int} + */ + ICON: 17, + /** + * @const + * @type { int} + */ + IMAGE: 18, + /** + * @const + * @type { int} + */ + STRUCTURE: 21, + /** + * @const + * @type { int} + */ + BANNER2: 22, + /** + * @const + * @type { int} + */ + SCRIPT: 24, + /** + * @const + * @type { int} + */ + EXPRESSION: 25, + /** + * @const + * @type { int} + */ + ARGUMENT: 27, + /** + * @const + * @type { int} + */ + JSON_DATA: 28, + /** + * @const + * @type { int} + */ + EXPRESSION_EDITOR: 29, + /** + * @const + * @type { int} + */ + WIDGET_REFERENCE: 30, + /** + * @const + * @type { int} + */ + DOM_PROPERTIES: 31, + /** + * @const + * @type { int} + */ + BLOCK_REFERENCE: 32, + /** + * @const + * @type { int} + */ + BLOCK_SETTINGS: 33, + /** + * user land from here + * @const + * @type { int} + */ + END: 35, + /** + * @const + * @type { int} + */ + UNKNOWN: -1 +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/enums.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/enums.ts new file mode 100644 index 0000000..b81ca58 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/enums.ts @@ -0,0 +1,55 @@ +export const EVENTS = { + +}; + +export enum COMMANDS { + RUN_FILE = 'Run_File', + RUN_CLASS = 'Run_Class', + RUN_APP_SERVER_CLASS = 'Run_App_Server_Class', + RUN_APP_SERVER_CLASS_METHOD = 'Run_App_Server_Class_Method', + RUN_APP_SERVER_COMPONENT_METHOD = 'Run_App_Server_Component_Method', + CANCEL_APP_SERVER_COMPONENT_METHOD = 'Cancel_App_Server_Component_Method', + ANSWER_APP_SERVER_COMPONENT_METHOD_INTERRUPT = 'Answer_App_Server_Component_Method_Interrupt' +} + +export enum LOGGING_SIGNAL { +}; + +export enum LOGGING_FLAGS { + /** + * No logging + * @constant + * @type int + */ + NONE = 0x00000000, + /** + * Log in the IDE's global console + * @constant + * @type int + */ + GLOBAL_CONSOLE = 0x00000001, + /** + * Log in the IDE's status bar + * @constant + * @type int + */ + STATUS_BAR = 0x00000002, + /** + * Create notification popup in the IDE + * @constant + * @type int + */ + POPUP = 0x00000004, + /** + * Log to file + * @constant + * @type int + */ + FILE = 0x00000008, + /** + * Log into the IDE's dev tool's console + * @constant + * @type int + */ + DEV_CONSOLE = 0x00000010 +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/platform.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/platform.ts new file mode 100644 index 0000000..a07fe43 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/platform.ts @@ -0,0 +1,12 @@ +import { platform, arch } from 'os'; + +export const os = () => { + if (platform() === 'win32') { + return 'windows'; + } else if (platform() === 'darwin') { + return 'osx'; + } else if (arch() === 'arm') { + return 'arm'; + } + return 'linux'; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/primitives.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/primitives.ts new file mode 100644 index 0000000..8f92969 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/primitives.ts @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; + +const _typeof = { + number: 'number', + string: 'string', + undefined: 'undefined', + object: 'object', + function: 'function' +}; + +/** + * @returns whether the provided parameter is a JavaScript Array or not. + */ +export function isArray(array: any): array is any[] { + if (Array.isArray) { + return Array.isArray(array); + } + + if (array && typeof (array.length) === _typeof.number && array.constructor === Array) { + return true; + } + + return false; +} + +/** + * @returns whether the provided parameter is a JavaScript String or not. + */ +export function isString(str: any): str is string { + if (typeof (str) === _typeof.string || str instanceof String) { + return true; + } + + return false; +} + +/** + * @returns whether the provided parameter is a JavaScript Array and each element in the array is a string. + */ +export function isStringArray(value: any): value is string[] { + return isArray(value) && (value).every(elem => isString(elem)); +} + +/** + * + * @returns whether the provided parameter is of type `object` but **not** + * `null`, an `array`, a `regexp`, nor a `date`. + */ +export function isObject(obj: any): boolean { + // The method can't do a type cast since there are type (like strings) which + // are subclasses of any put not positvely matched by the function. Hence type + // narrowing results in wrong results. + return typeof obj === _typeof.object + && obj !== null + && !Array.isArray(obj) + && !(obj instanceof RegExp) + && !(obj instanceof Date); +} + +/** + * In **contrast** to just checking `typeof` this will return `false` for `NaN`. + * @returns whether the provided parameter is a JavaScript Number or not. + */ +export function isNumber(obj: any): obj is number { + if ((typeof (obj) === _typeof.number || obj instanceof Number) && !isNaN(obj)) { + return true; + } + + return false; +} + +/** + * @returns whether the provided parameter is a JavaScript Boolean or not. + */ +export function isBoolean(obj: any): obj is boolean { + return obj === true || obj === false; +} + +/** + * @returns whether the provided parameter is undefined. + */ +export function isUndefined(obj: any): boolean { + return typeof (obj) === _typeof.undefined; +} + +/** + * @returns whether the provided parameter is undefined or null. + */ +export function isUndefinedOrNull(obj: any): boolean { + return isUndefined(obj) || obj === null; +} + + +const hasOwnProperty = Object.prototype.hasOwnProperty; + +/** + * @returns whether the provided parameter is an empty JavaScript Object or not. + */ +export function isEmptyObject(obj: any): obj is any { + if (!isObject(obj)) { + return false; + } + + for (let key in obj) { + if (hasOwnProperty.call(obj, key)) { + return false; + } + } + + return true; +} + +/** + * @returns whether the provided parameter is a JavaScript Function or not. + */ +export function isFunction(obj: any): obj is Function { + return typeof obj === _typeof.function; +} + +/** + * @returns whether the provided parameters is are JavaScript Function or not. + */ +export function areFunctions(...objects: any[]): boolean { + return objects && objects.length > 0 && objects.every(isFunction); +} + +export type TypeConstraint = string | Function; + +export function validateConstraints(args: any[], constraints: TypeConstraint[]): void { + const len = Math.min(args.length, constraints.length); + for (let i = 0; i < len; i++) { + validateConstraint(args[i], constraints[i]); + } +} + +export function validateConstraint(arg: any, constraint: TypeConstraint): void { + + if (isString(constraint)) { + if (typeof arg !== constraint) { + throw new Error(`argument does not match constraint: typeof ${constraint}`); + } + } else if (isFunction(constraint)) { + if (arg instanceof constraint) { + return; + } + if (arg && arg.constructor === constraint) { + return; + } + if (constraint.length === 1 && constraint.call(undefined, arg) === true) { + return; + } + throw new Error(`argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true`); + } +} + +/** + * Creates a new object of the provided class and will call the constructor with + * any additional argument supplied. + */ +export function create(ctor: Function, ...args: any[]): any { + let obj = Object.create(ctor.prototype); + ctor.apply(obj, args); + + return obj; +} + +export interface IFunction0 { + (): T; +} +export interface IFunction1 { + (a1: A1): T; +} +export interface IFunction2 { + (a1: A1, a2: A2): T; +} +export interface IFunction3 { + (a1: A1, a2: A2, a3: A3): T; +} +export interface IFunction4 { + (a1: A1, a2: A2, a3: A3, a4: A4): T; +} +export interface IFunction5 { + (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5): T; +} +export interface IFunction6 { + (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6): T; +} +export interface IFunction7 { + (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7): T; +} +export interface IFunction8 { + (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8): T; +} + +export interface IAction0 extends IFunction0 { } +export interface IAction1 extends IFunction1 { } +export interface IAction2 extends IFunction2 { } +export interface IAction3 extends IFunction3 { } +export interface IAction4 extends IFunction4 { } +export interface IAction5 extends IFunction5 { } +export interface IAction6 extends IFunction6 { } +export interface IAction7 extends IFunction7 { } +export interface IAction8 extends IFunction8 { } + +export type NumberCallback = (index: number) => void; + +export function count(to: number, callback: NumberCallback): void; +export function count(from: number, to: number, callback: NumberCallback): void; +export function count(fromOrTo: number, toOrCallback?: NumberCallback | number, callback?: NumberCallback): any { + var from: number, to: number; + + if (isNumber(toOrCallback)) { + from = fromOrTo; + to = toOrCallback; + } else { + from = 0; + to = fromOrTo; + callback = toOrCallback; + } + + var op = from <= to ? (i: number) => i + 1 : (i: number) => i - 1; + var cmp = from <= to ? (a: number, b: number) => a < b : (a: number, b: number) => a > b; + + for (var i = from; cmp(i, to); i = op(i)) { + callback(i); + } +} + +export function countToArray(to: number): number[]; +export function countToArray(from: number, to: number): number[]; +export function countToArray(fromOrTo: number, to?: number): number[] { + var result: number[] = []; + var fn = (i: number) => result.push(i); + + if (isUndefined(to)) { + count(fromOrTo, fn); + } else { + count(fromOrTo, to, fn); + } + + return result; +} + diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/readme.md b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/readme.md new file mode 100644 index 0000000..45a3e78 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/readme.md @@ -0,0 +1,6 @@ +### Type API + +- [ ] registerStruct +- [ ] registerEnum +- [ ] registerFlags +- [ ] registerUsertype diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/strings.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/strings.ts new file mode 100644 index 0000000..f9299f3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/strings.ts @@ -0,0 +1,487 @@ +import { isArray, isObject, } from './primitives'; +import { Hash } from './types'; +import { isString } from 'lodash'; + +const escapeRegExpPattern = /[[\]{}()|\/\\^$.*+?]/g; +const escapeXmlPattern = /[&<]/g; +const escapeXmlForPattern = /[&<>'"]/g; +const escapeXmlMap: Hash = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''' +}; +export const DefaultDelimiter = { + begin: '<%', + end: '%>' +}; +export const hasFlag = (field, enumValue) => { + //noinspection JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage + // tslint:disable-next-line:no-bitwise + return ((1 << enumValue) & field) ? true : false; +}; +export const hasFlagHex = (field, enumValue) => { + //noinspection JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage,JSBitwiseOperatorUsage + // tslint:disable-next-line:no-bitwise + return enumValue & field ? true : false; +}; +export const disableFlag = (enumValue, field) => { + enumValue &= ~(1 << field); + return enumValue; +}; +/** + * The minimum location of high surrogates + */ +export const HIGH_SURROGATE_MIN = 0xD800; +/** + * The maximum location of high surrogates + */ +export const HIGH_SURROGATE_MAX = 0xDBFF; +/** + * The minimum location of low surrogates + */ +export const LOW_SURROGATE_MIN = 0xDC00; +/** + * The maximum location of low surrogates + */ +export const LOW_SURROGATE_MAX = 0xDFFF; + +const BASE64_KEYSTR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + +export const capitalize = (word) => { + return word.substring(0, 1).toUpperCase() + word.substring(1); +}; + +export const getJson = (inData, validOnly, ommit) => { + try { + return isString(inData) ? JSON.parse(inData) : validOnly === true ? null : inData; + } catch (e) { + ommit !== false && console.error('error parsing json data ' + inData + ' error = ' + e); + } + return null; +}; + +/** + * Escapes a string so that it can safely be passed to the RegExp constructor. + * @param text The string to be escaped + * @return The escaped string + */ +export function escapeRegExpEx(text: string): string { + return !text ? text : text.replace(escapeRegExpPattern, '\\$&'); +} + +/** + * Sanitizes a string to protect against tag injection. + * @param xml The string to be escaped + * @param forAttribute Whether to also escape ', ", and > in addition to < and & + * @return The escaped string + */ +export function escapeXml(xml: string, forAttribute: boolean = true): string { + if (!xml) { + return xml; + } + + const pattern = forAttribute ? escapeXmlForPattern : escapeXmlPattern; + + return xml.replace(pattern, function (character: string): string { + return escapeXmlMap[character]; + }); +} + +export function createUUID(): string { + const S4 = function () { + return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); + }; + return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4()); +} + +export function escapeRegExp(str: string): string { + const special = ['[', ']', '(', ')', '{', '}', '*', '+', '.', '|', '||']; + for (let n = 0; n < special.length; n++) { + str = str.replace(special[n], '\\' + special[n]); + } + return str; +}; + +export function findOcurrences(expression: string, delimiters: IDelimiter): Array { + // tslint:disable-next-line:no-object-literal-type-assertion + const d = { + begin: escapeRegExp(delimiters.begin), + end: escapeRegExp(delimiters.end) + } as IDelimiter; + return expression.match(new RegExp(d.begin + '([^' + d.end + ']*)' + d.end, 'g')); +}; + +export function multipleReplace(str: string, hash: any): string { + // to array + const a = []; + // tslint:disable-next-line:forin + for (let key in hash) { + a[a.length] = key; + } + return str.replace(new RegExp(a.join('\\b|\\b'), 'g'), function (m) { + return hash[m] || hash['\\' + m]; + }); +}; + +export function replaceAll(find: string, replace: string, str: string): string { + return str ? str.split(find).join(replace) : ''; +}; + +export interface IDelimiter { + begin: string; + end: string; +} + +export function replace(str: string, needle: any | null, what: string | any, delimiters: IDelimiter): string { + if (!str) { + return ''; + } + if (what && isObject(what) || isArray(what)) { + what = what as any; + if (!delimiters) { + // fast case + return multipleReplace(str, what); + } + const occurrence = findOcurrences(str, delimiters); + if (!occurrence) { + return str; + } else { + for (let i = 0, j = occurrence.length; i < j; i++) { + const el = occurrence[i]; + // strip off delimiters + let _variableName = replaceAll(delimiters.begin, '', el); + _variableName = replaceAll(delimiters.end, '', _variableName); + str = replaceAll(el, (what[_variableName]), str); + } + } + return str; + } + // fast case + return replaceAll(needle, what as string, str); +}; + +export const substitute = (template, map ) => { + const transform = (k) => k || ''; + return template.replace(/\$\{([^\s\:\}]+)(?:\:([^\s\:\}]+))?\}/g, + (match, key, format) => transform(map[key]).toString()); +}; + +function decodeUtf8EncodedCodePoint(codePoint: number, validationRange: number[] = [0, Infinity], checkSurrogate?: boolean): string { + if (codePoint < validationRange[0] || codePoint > validationRange[1]) { + throw Error('Invalid continuation byte'); + } + + if (checkSurrogate && codePoint >= HIGH_SURROGATE_MIN && codePoint <= LOW_SURROGATE_MAX) { + throw Error('Surrogate is not a scalar value'); + } + + let encoded = ''; + + if (codePoint > 0xFFFF) { + codePoint -= 0x010000; + encoded += String.fromCharCode(codePoint >>> 0x10 & 0x03FF | HIGH_SURROGATE_MIN); + codePoint = LOW_SURROGATE_MIN | codePoint & 0x03FF; + } + + encoded += String.fromCharCode(codePoint); + + return encoded; +} + +function validateUtf8EncodedCodePoint(codePoint: number): void { + if ((codePoint & 0xC0) !== 0x80) { + throw Error('Invalid continuation byte'); + } +} + +export type ByteBuffer = Uint16Array | Uint8Array | Buffer | number[]; + +export interface Codec { + encode(data: string): number[]; + decode(data: ByteBuffer): string; +} + +/** + * Provides facilities for encoding a string into an ASCII-encoded byte buffer and + * decoding an ASCII-encoded byte buffer into a string. + */ +export const ascii: Codec = { + /** + * Encodes a string into an ASCII-encoded byte buffer. + * + * @param data The text string to encode + */ + encode(data: string): number[] { + if (data == null) { + return []; + } + + const buffer: number[] = []; + + for (let i = 0, length = data.length; i < length; i++) { + buffer[i] = data.charCodeAt(i); + } + + return buffer; + }, + /** + * Decodes an ASCII-encoded byte buffer into a string. + * + * @param data The byte buffer to decode + */ + decode(data: ByteBuffer): string { + if (data == null) { + return ''; + } + + let decoded = ''; + + for (let i = 0, length = data.length; i < length; i++) { + decoded += String.fromCharCode(data[i]); + } + + return decoded; + } +}; + +/** + * Provides facilities for encoding a string into a Base64-encoded byte buffer and + * decoding a Base64-encoded byte buffer into a string. + */ +export const base64: Codec = { + /** + * Encodes a Base64-encoded string into a Base64 byte buffer. + * + * @param data The Base64-encoded string to encode + */ + encode(data: string): number[] { + if (data == null) { + return []; + } + + const buffer: number[] = []; + + let i = 0; + let length = data.length; + + while (data[--length] === '=') { } + while (i < length) { + let encoded = BASE64_KEYSTR.indexOf(data[i++]) << 18; + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]) << 12; + } + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]) << 6; + } + if (i <= length) { + encoded |= BASE64_KEYSTR.indexOf(data[i++]); + } + + buffer.push((encoded >>> 16) & 0xff); + buffer.push((encoded >>> 8) & 0xff); + buffer.push(encoded & 0xff); + } + + while (buffer[buffer.length - 1] === 0) { + buffer.pop(); + } + + return buffer; + }, + /** + * Decodes a Base64-encoded byte buffer into a Base64-encoded string. + * + * @param data The byte buffer to decode + */ + decode(data: ByteBuffer): string { + if (data == null) { + return ''; + } + + let decoded = ''; + let i = 0; + + for (let length = data.length - (data.length % 3); i < length;) { + let encoded = data[i++] << 16 | data[i++] << 8 | data[i++]; + + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3F); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3F); + decoded += BASE64_KEYSTR.charAt((encoded >>> 6) & 0x3F); + decoded += BASE64_KEYSTR.charAt(encoded & 0x3F); + } + + if (data.length % 3 === 1) { + let encoded = data[i++] << 16; + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3f); + decoded += '=='; + } else if (data.length % 3 === 2) { + let encoded = data[i++] << 16 | data[i++] << 8; + decoded += BASE64_KEYSTR.charAt((encoded >>> 18) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 12) & 0x3f); + decoded += BASE64_KEYSTR.charAt((encoded >>> 6) & 0x3f); + decoded += '='; + } + + return decoded; + } +}; + +/** + * Provides facilities for encoding a string into a hex-encoded byte buffer and + * decoding a hex-encoded byte buffer into a string. + */ +export const hex: Codec = { + /** + * Encodes a string into a hex-encoded byte buffer. + * + * @param data The hex-encoded string to encode + */ + encode(data: string): number[] { + if (data == null) { + return []; + } + + const buffer: number[] = []; + + for (let i = 0, length = data.length; i < length; i += 2) { + let encodedChar = parseInt(data.substr(i, 2), 16); + + buffer.push(encodedChar); + } + + return buffer; + }, + /** + * Decodes a hex-encoded byte buffer into a hex-encoded string. + * + * @param data The byte buffer to decode + */ + decode(data: ByteBuffer): string { + if (data == null) { + return ''; + } + + let decoded = ''; + + for (let i = 0, length = data.length; i < length; i++) { + decoded += data[i].toString(16).toUpperCase(); + } + + return decoded; + } +}; + +/** + * Provides facilities for encoding a string into a UTF-8-encoded byte buffer and + * decoding a UTF-8-encoded byte buffer into a string. + * Inspired by the work of: https://github.com/mathiasbynens/utf8.js + */ +export const utf8: Codec = { + /** + * Encodes a string into a UTF-8-encoded byte buffer. + * + * @param data The text string to encode + */ + encode(data: string): number[] { + if (data == null) { + return []; + } + + const buffer: number[] = []; + + for (let i = 0, length = data.length; i < length; i++) { + let encodedChar = data.charCodeAt(i); + /** + * Surrogates + * http://en.wikipedia.org/wiki/Universal_Character_Set_characters + */ + if (encodedChar >= HIGH_SURROGATE_MIN && encodedChar <= HIGH_SURROGATE_MAX) { + let lowSurrogate = data.charCodeAt(i + 1); + if (lowSurrogate >= LOW_SURROGATE_MIN && lowSurrogate <= LOW_SURROGATE_MAX) { + encodedChar = 0x010000 + (encodedChar - HIGH_SURROGATE_MIN) * 0x0400 + (lowSurrogate - LOW_SURROGATE_MIN); + i++; + } + } + + if (encodedChar < 0x80) { + buffer.push(encodedChar); + } else { + if (encodedChar < 0x800) { + buffer.push(((encodedChar >> 0x06) & 0x1F) | 0xC0); + } else if (encodedChar < 0x010000) { + if (encodedChar >= HIGH_SURROGATE_MIN && encodedChar <= LOW_SURROGATE_MAX) { + throw Error('Surrogate is not a scalar value'); + } + + buffer.push(((encodedChar >> 0x0C) & 0x0F) | 0xE0); + buffer.push(((encodedChar >> 0x06) & 0x3F) | 0x80); + } else if (encodedChar < 0x200000) { + buffer.push(((encodedChar >> 0x12) & 0x07) | 0xF0); + buffer.push(((encodedChar >> 0x0C) & 0x3F) | 0x80); + buffer.push(((encodedChar >> 0x06) & 0x3F) | 0x80); + } + buffer.push((encodedChar & 0x3F) | 0x80); + } + } + + return buffer; + }, + /** + * Decodes a UTF-8-encoded byte buffer into a string. + * + * @param data The byte buffer to decode + */ + decode(data: ByteBuffer): string { + if (data == null) { + return ''; + } + + let decoded = ''; + + for (let i = 0, length = data.length; i < length; i++) { + let byte1 = data[i] & 0xFF; + + if ((byte1 & 0x80) === 0) { + decoded += decodeUtf8EncodedCodePoint(byte1); + } else if ((byte1 & 0xE0) === 0xC0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + let encodedByte = ((byte1 & 0x1F) << 0x06) | byte2; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x80, Infinity]); + } else if ((byte1 & 0xF0) === 0xE0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + + let byte3 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte3); + byte3 = byte3 & 0x3F; + + let encodedByte = ((byte1 & 0x1F) << 0x0C) | (byte2 << 0x06) | byte3; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x0800, Infinity], true); + } else if ((byte1 & 0xF8) === 0xF0) { + let byte2 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte2); + byte2 = byte2 & 0x3F; + + let byte3 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte3); + byte3 = byte3 & 0x3F; + + let byte4 = data[++i] & 0xFF; + validateUtf8EncodedCodePoint(byte4); + byte4 = byte4 & 0x3F; + + let encodedByte = ((byte1 & 0x1F) << 0x0C) | (byte2 << 0x0C) | (byte3 << 0x06) | byte4; + decoded += decodeUtf8EncodedCodePoint(encodedByte, [0x010000, 0x10FFFF]); + } else { + validateUtf8EncodedCodePoint(byte1); + } + } + return decoded; + } +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/types.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/types.ts new file mode 100644 index 0000000..2d5e65e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/types.ts @@ -0,0 +1,35 @@ +export * from './enums'; + +// tslint:disable-next-line:interface-name +export interface Hash { + [id: string]: T; +} +// tslint:disable-next-line:interface-name +export interface List { + [index: number]: T; + length: number; +} +/** + * Interface of the simple literal object with any string keys. + */ +export interface IObjectLiteral { + [key: string]: any; +} +/** + * Represents some Type of the Object. + */ +// tslint:disable-next-line:ban-types +export type ObjectType = { new(): T } | (Function); +/** + * Same as Partial but goes deeper and makes Partial all its properties and sub-properties. + */ +export type DeepPartial = { + [P in keyof T]?: DeepPartial; +}; + +export interface IDelimitter { + begin: string; + end: string; +} + +export type JSONPathExpression = string; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ve.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ve.ts new file mode 100644 index 0000000..8519240 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/common/ve.ts @@ -0,0 +1,14 @@ +/** + * WIDGET_REFERENCE_MODE enumerates possible modes to resolve a string expression + * into instances. There are a few CI based widgets subclassed from xide/widgets/Referenced. + * The reference structure consist out of this mode and that expression. + * + * @constant {Array.} + * module:xide/types~WIDGET_REFERENCE_MODE + */ +export const WIDGET_REFERENCE_MODE = { + BY_ID: 'byid', + BY_CLASS: 'byclass', + BY_CSS: 'bycss', + BY_EXPRESSION: 'expression' +}; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/front.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/front.ts new file mode 100644 index 0000000..68de809 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/front.ts @@ -0,0 +1,57 @@ +import { capitalize } from "../common/strings"; + +export const howto_header = (title, category, image, description: string = "", tagline: string = "", config: string = "") => { + return `--- +image: ${image} +category: "${category}" +title: "${title}" +tagline: ${tagline || '""' } +description: ${description || `"Precious Plastic - Howto : ${category} :: ${title} "` } +${config} +---\n`; +} + +export const gallery_image = (path, title= "", alt ="") =>{ + return ` + - url: "${path}" + image_path: "${path}" + alt: "${alt}" + title: "${title}"`; +} + +export const drawing_image = (path, pdf, title= "", alt ="") =>{ + return ` + - url: "${pdf}" + image_path: "${path}" + alt: "${alt}" + title: "${title}"`; +} + + +export const machine_header = (title, category, image, slug, rel, description: string = "", tagline: string = "", config: string = "") => { + return `--- +image: ${image} +category: "${category}" +title: "${title}" +product_rel: "/${rel}" +tagline: ${tagline || '""'} +description: ${description || `"Precious Plastic - Machine : ${capitalize(category)} :: ${title}"` } +${config} +sidebar: + nav: "machines" +---\n`; +} + +export const projects_header = (title, category, image, slug, rel, description: string = "", tagline: string = "", config: string = "") => { + return `--- +image: ${image} +category: "${category}" +title: "${title}" +product_rel: "/${rel}" +tagline: ${tagline || '""'} +description: ${description || `"Precious Plastic - ${capitalize(category)} :: ${title}"` } +${config} +sidebar: + nav: "projects" +---\n`; +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/html.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/html.ts new file mode 100644 index 0000000..d398d82 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/html.ts @@ -0,0 +1,26 @@ +import { GIT_REPO } from '../../constants'; +import { html_beautify } from 'js-beautify'; +export const img = (file, label, id = '') => { + return `
+ + + + ${label} +
`; +} + +export const changelog_entry = (e) => { + return `
+
${e.date} 
${e.msg} +
    + ${e.files.map((f) => { + return `
  • ${f.path}
  • ` + })} +
+
+ ` +} + +export const changelog = (log: any[]) => { + return html_beautify(log.map(changelog_entry).join('
')); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/md.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/md.ts new file mode 100644 index 0000000..a5bdbfb --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/md.ts @@ -0,0 +1,54 @@ +import * as debug from '../..'; +import * as path from 'path'; +import { isArray, isString } from 'util'; + +import { files, read, csvToMarkdown, toHTML, md2html, exists } from '../../lib/'; +import { html_beautify } from 'js-beautify'; + +const md_tables = require('markdown-table'); + +export const parse_config = (config, root) => { + if (Object.keys(config)) { + for (const key in config) { + let val = config[key]; + if (isArray(val)) { + config[key] = md2html(md_tables(val)); + } else if (isString(val)) { + if (val.endsWith('.csv')) { + debug.info("parsing CSV " + val); + const parsed = path.parse(root); + let csv = path.resolve(`${parsed.dir}/${parsed.base}/${val}`) as any; + if (exists(csv)) { + csv = read(csv) || ""; + try { + csv = md2html(csvToMarkdown(csv)); + config[key] = csv; + } catch (e) { + debug.error(`Error converting csv to md ${val}`); + } + }else{ + debug.error(`Can't find CSV file at ${csv}`,parsed); + } + } + } + } + } +} + +export const md_edit_wrap = (content, f, prefix = '', context = '') => { + return html_beautify(`
${content}
`); +} + +export const read_fragments = (src, config, prefix = '', context = '') => { + + let fragments = files(src, '*.html'); + fragments.map((f) => { + config[path.parse(f).name] = md_edit_wrap(toHTML(f, true), f, prefix, context); + }); + + fragments = files(src, '*.md'); + fragments.map((f) => { + config[path.parse(f).name] = md_edit_wrap(toHTML(f, false), f, prefix, context); + }); + return config; +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/tables.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/tables.ts new file mode 100644 index 0000000..8637f48 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/content/tables.ts @@ -0,0 +1,76 @@ +/** + * Converts CSV to Markdown Table + * + * @param {string} csvContent - The string content of the CSV + * @param {string} delimiter - The character(s) to use as the CSV column delimiter + * @param {boolean} hasHeader - Whether to use the first row of Data as headers + * @returns {string} + */ +export function csvToMarkdown(csvContent: string, delimiter: string = ",", hasHeader: boolean = true): string { + if (delimiter != "\t") { + csvContent = csvContent.replace(/\t/g, " "); + } + + const columns = csvContent.split(/\r?\n/); + + const tabularData: string[][] = []; + const maxRowLen: number[] = []; + + columns.forEach((e, i) => { + if (typeof tabularData[i] == "undefined") { + tabularData[i] = []; + } + const regex = new RegExp(delimiter + '(?![^"]*"\\B)'); + const row = e.split(regex); + row.forEach((ee, ii) => { + if (typeof maxRowLen[ii] == "undefined") { + maxRowLen[ii] = 0; + } + + // escape pipes and backslashes + ee = ee.replace(/(\||\\)/g, "\\$1"); + + maxRowLen[ii] = Math.max(maxRowLen[ii], ee.length); + tabularData[i][ii] = ee; + }); + }); + + let headerOutput = ""; + let seperatorOutput = ""; + + maxRowLen.forEach((len) => { + const sizer = Array(len + 1 + 2); + + seperatorOutput += "|" + sizer.join("-"); + headerOutput += "|" + sizer.join(" "); + }); + + headerOutput += "| \n"; + seperatorOutput += "| \n"; + + if (hasHeader) { + headerOutput = ""; + } + + let rowOutput = ""; + tabularData.forEach((col, i) => { + maxRowLen.forEach((len, y) => { + const row = typeof col[y] == "undefined" ? "" : col[y]; + const spacing = Array((len - row.length) + 1).join(" "); + const out = `| ${row}${spacing} `; + if (hasHeader && i === 0) { + headerOutput += out; + } else { + rowOutput += out; + } + }); + + if (hasHeader && i === 0) { + headerOutput += "| \n"; + } else { + rowOutput += "| \n"; + } + }); + + return `\n\n ${headerOutput}${seperatorOutput}${rowOutput} \n\n`; +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/fs/index.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/fs/index.ts new file mode 100644 index 0000000..35ed448 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/fs/index.ts @@ -0,0 +1,88 @@ +const fg = require('fast-glob'); + +import * as path from 'path'; +import * as bluebird from 'bluebird'; +import { Converter } from 'showdown'; +import { sync as read } from '@xblox/fs/read'; +import { sync as exists } from '@xblox/fs/exists'; +import { html_beautify } from 'js-beautify'; + +export { sync as read } from '@xblox/fs/read'; +export { sync as exists } from '@xblox/fs/exists'; +export { sync as dir } from '@xblox/fs/dir'; +export { sync as write } from '@xblox/fs/write'; + +import { sync as write } from '@xblox/fs/write'; + +import { Helper } from '../process/index'; +import { firstOf, lastOf } from '../common/array'; +import { img } from '../content/html'; + +const IMAGES_GLOB = '*.+(JPG|jpg|png|PNG|gif)'; + +export const files = (dir, glob) => fg.sync(glob, { dot: true, cwd: dir, absolute: true }) as []; +export const images = (source) => files(source, IMAGES_GLOB) as any[]; +export const head_image = (_images) => firstOf(_images); +export const tail_image = (_images) => lastOf(_images); + +export async function resize_images(files) { + return bluebird.mapSeries(files, (file: string) => { + const inParts = path.parse(file); + const promise = Helper.run(inParts.dir, 'convert', + [ + `"${inParts.base}"`, + '-quality 70', + '-resize 1980', + '-sharpen 0x1.0', + `"${inParts.name}${inParts.ext}"` + ]); + return promise; + }); +} + +export const md2html = (content) => { + let converter = new Converter({ tables: true }); + converter.setOption('literalMidWordUnderscores', 'true'); + return converter.makeHtml(content); +} + + +export const toHTML = (path, markdown) => { + const content = read(path, 'string') as string; + if (!markdown) { + let converter = new Converter({ tables: true }); + converter.setOption('literalMidWordUnderscores', 'true'); + return converter.makeHtml(content); + } else { + return content; + } +} + +const jekyllNop = "---\n#jekyll\n---\n"; +const frontMatter = /^---[.\r\n]*---/; + +export const thumbs = (source: string, meta: boolean = true, sep: string = "
") => { + let pictures = images(source); + let content = ""; + pictures.forEach((f, i) => { + if (meta) { + let picMD = path.resolve(path.join(path.parse(f).dir, path.sep, path.parse(f).name + '.md')); + if (exists(picMD)) { + const picMDContent = read(picMD, "string") as string; + if (picMDContent.length > 3 && picMDContent !== jekyllNop) { + content += picMDContent.substr(picMDContent.lastIndexOf('---') + 3, picMDContent.length) + content += "\n"; + } else { + write(picMD, jekyllNop); + } + } else { + write(picMD, jekyllNop); + } + } + + content += img(`./${path.parse(f).base}`, `${i + 1}. `, path.parse(f).base); + content += "\n"; + content += sep; + }); + return html_beautify(content); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/git/log.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/git/log.ts new file mode 100644 index 0000000..2555513 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/git/log.ts @@ -0,0 +1,39 @@ +import { write, exists, read, thumbs, images, resize_images, tail_image, howto_header, substitute, toHTML, parse_config, read_fragments } from '../../lib/'; +import * as debug from '../..'; +import { GIT_CHANGELOG_MESSAGE_PREFIX } from '../../constants'; +import * as path from 'path'; + +import * as simpleGit from 'simple-git/promise'; +import { SimpleGit, ListLogSummary } from 'simple-git'; +import * as moment from 'moment'; + +export async function git_status(cwd, dir) { + + const git: SimpleGit = simpleGit(cwd); + let statusSummary: ListLogSummary = null; + try { + statusSummary = await git.log(['--stat', path.resolve(dir)]); + } + catch (e) { + debug.error('Error Git', e); + } + return statusSummary; +} + +export async function git_log(cwd, dir) { + const stats = await git_status(cwd, dir); + let changelogs = stats.all.filter((e) => e.message.trim().toLowerCase().startsWith(GIT_CHANGELOG_MESSAGE_PREFIX.toLowerCase())); + if (!changelogs.length) { + return []; + } + let pretty = changelogs.map((e) => + { + return { + files: e.diff.files.map((f)=>{ return {path:f.file}}), + msg: e.message.toLowerCase().replace(GIT_CHANGELOG_MESSAGE_PREFIX.toLowerCase(), '').trim(), + hash: e.hash, + date: moment(e.date).format('LLLL') + } + }); + return pretty; +}; \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/index.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/index.ts new file mode 100644 index 0000000..dff7983 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/index.ts @@ -0,0 +1,9 @@ +export * from './fs'; +export * from './content/html'; +export * from './content/front'; + +export * from './content/md'; +export * from './common/strings'; +export * from './content/tables'; +export * from './common/array'; +export * from './git/log'; diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/lang/README.md b/extrusion/lydia-print-head-v1/firmware/node/src/lib/lang/README.md new file mode 100644 index 0000000..49509a7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/lang/README.md @@ -0,0 +1,48 @@ +### Simple interface for *filtrex*, a bison and Javascript based expression parser + + +This is packaged as AMD module. + + +```js + + /1. Simple version, just evaluate one expression two times with different variables + + // Input from user (e.g. search filter) + var expression = 'transactions <= 5 and abs(profit) > 20.5'; + + var parser = new Expression(); + + var aResult = parser.parse(expression,null,{ + variables:{ + transactions: 3, + profit:-40.5 + } + }); //returns 1 + + var aResult = parser.parse(expression,null,{ + variables :{ + transactions: 3, + profit:-14.5 + } + }); //returns 1 + + 2. more advanced example, thing of a console input with real time feedback and autocompletion + + var expression = 'send{{Volume+4}} my garbage string {{transactions*2/Volume}}'; + + var parser = new Expression(); + + + var aResult = parser.parse(expression, null, { + variables: { + Volume: 2, + transactions: 3 + }, + delimiters: { + begin: '{{', + end: '}}' + } + });//returns 'send6 my garbage string 3' neat ? + +``` diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/crawler.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/crawler.ts new file mode 100644 index 0000000..9e180fb --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/crawler.ts @@ -0,0 +1,172 @@ +import { debug } from "../../log"; + +/** + * This example demonstrates how to use [`PuppeteerCrawler`](../api/puppeteercrawler) + * in combination with [`RequestQueue`](../api/requestqueue) to recursively scrape the + * Hacker News website using headless Chrome / Puppeteer. + * The crawler starts with a single URL, finds links to next pages, + * enqueues them and continues until no more desired links are available. + * The results are stored to the default dataset. In local configuration, the results are stored as JSON files in `./apify_storage/datasets/default` + * + * To run this example on the Apify Platform, select the `Node.js 10 + Chrome on Debian (apify/actor-node-chrome)` base image + * on the source tab of your actor configuration. + */ + +const Apify = require('apify'); +// https://davehakkens.nl/community/forums/topic/arbor-press-v14/ +// post with pics & videos : https://davehakkens.nl/community/forums/topic/launching-kickstarter-campaign-rwristwatches/ +export async function crawler(url: string = 'https://davehakkens.nl/community/forums/topic/the-big-electronics-topic/') { + // Apify.openRequestQueue() is a factory to get a preconfigured RequestQueue instance. + // We add our first request to it - the initial page the crawler will visit. + const requestQueue = await Apify.openRequestQueue(); + await requestQueue.addRequest({ url: url }); + + // Create an instance of the PuppeteerCrawler class - a crawler + // that automatically loads the URLs in headless Chrome / Puppeteer. + const crawler = new Apify.PuppeteerCrawler({ + requestQueue, + + // Here you can set options that are passed to the Apify.launchPuppeteer() function. + launchPuppeteerOptions: { + // For example, by adding "slowMo" you'll slow down Puppeteer operations to simplify debugging + slowMo: 500, + headless: false, + devtools: true + }, + + // Stop crawling after several pages + maxRequestsPerCrawl: 2, + + // This function will be called for each URL to crawl. + // Here you can write the Puppeteer scripts you are familiar with, + // with the exception that browsers and pages are automatically managed by the Apify SDK. + // The function accepts a single parameter, which is an object with the following fields: + // - request: an instance of the Request class with information such as URL and HTTP method + // - page: Puppeteer's Page object (see https://pptr.dev/#show=api-class-page) + handlePageFunction: async ({ request, page }) => { + console.log(`Processing ${request.url}...`); + + // A function to be evaluated by Puppeteer within the browser context. + + const t = new Promise((resolve) => { + const pageFunction = ($posts) => { + const data = []; + const $ = window['jQuery']; + const jQuery = $; + const otherReplies = $('.bbp-reply-topic-title'); + let title; + let authorLink; + let postDate; + let postBody; + let authorName; + try { + title = $('#bbpress-forums > div.topic-lead > div.author > h1')[0].innerText; + } catch (e) { + debugger; + } + try { + + authorLink = $('#bbpress-forums > div.topic-lead > div.author > a:nth-child(5)')[0]; + authorName = authorLink.innerText; + } catch (e) { + authorName = "fucking G"; + authorLink = "ban G" + + } + + postDate = $('#bbpress-forums > div.topic-lead > div.author > div.date')[0].innerText.split(' at')[0]; + postBody = $('#bbpress-forums > div.topic-lead > div.content').html(); + const likes = parseInt(jQuery('#bbpress-forums > div.topic-lead > div.actions > div > div.dav_topic_like')[0].innerText.split(' ')[0]); + const saved = parseInt(jQuery('#bbpress-forums > div.topic-lead > div.actions > div > div.dav_topic_favorit > span')[0].innerText.split(' ')[0]); + const nbReplies = parseInt(jQuery('#bbpress-forums > div.topic-lead > div.actions > div > div.dav_reply_topic > span')[0].innerText.split(' ')[0]); + const pics = []; + jQuery('.d4p-bbp-attachment > a').each((i, a) => { + pics.push(jQuery(a).attr('href').replace('?ssl=1', '')); + }); + console.log('page function'); + + const replies = []; + + jQuery('#bbpress-forums > div.list-replies-container > div.list-replies > div.topic-reply').each((i, e) => { + try { + const authorLogo = jQuery('.author > a > img').attr('srcset').replace(' 2x'); + const authorName = jQuery('.content .replyheader .smallusername', e)[0].innerText || 'anonymous'; + const replyDate = jQuery('.content .replyheader .reply-date', e)[0].innerText; + const nbLikes = parseInt(jQuery('.content > div.wpulike.wpulike-heart > div > span', e)[0].innerText) || 0; + jQuery('.content > div.wpulike.wpulike-heart',e).remove(); + jQuery('.content .replyheader',e).remove(); + let replyBody = jQuery('.content',e).html(); + const replyPics = []; + jQuery('.d4p-bbp-attachment > a',e).each((i, a) => { + replyPics.push(jQuery(a).attr('href').replace('?ssl=1', '')); + }); + jQuery('.content .bbp-attachments',e).remove(); + replyBody = jQuery('.content',e).html(); + replies.push({ + authorLogo, + authorName, + replyDate, + nbLikes, + replyBody, + replyPics + }) + } catch (e) { + console.error('mah',e); + debugger; + } + }) + + + debugger; + /* + + // We're getting the title, rank and URL of each post on Hacker News. + $posts.forEach(($post) => { + data.push({ + title: $post.querySelector('.title a').innerText, + rank: $post.querySelector('.rank').innerText, + href: $post.querySelector('.title a').href, + }); + }); + */ + return data; + }; + page.$$eval('return window', pageFunction); + }); + return t; + + // Store the results to the default dataset. + // await Apify.pushData(data); + + // Find a link to the next page and enqueue it if it exists. + /* + const infos = await Apify.utils.enqueueLinks({ + page, + requestQueue, + selector: '.morelink', + }); + + if (infos.length === 0) { + console.log(`${request.url} is the last page!`); + }*/ + + }, + + // This function is called if the page processing failed more than maxRequestRetries+1 times. + handleFailedRequestFunction: async ({ request }) => { + console.log(`Request ${request.url} failed too many times`); + await Apify.pushData({ + '#debug': Apify.utils.createRequestDebugInfo(request), + }); + }, + gotoFunction: async ({ session, page, request }) => { + console.log('goto ' + request.url); + return page.goto(request.url, { + waitUntil: 'domcontentloaded' + }); + } + }); + + // Run the crawler and wait for it to finish. + await crawler.run(); +}; \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/github.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/github.ts new file mode 100644 index 0000000..3291e90 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/github.ts @@ -0,0 +1,10 @@ +const jsdeliver = 'https://cdn.jsdelivr.net/' + +const user = 'plastichub'; +const repo = 'products'; +const branch = 'master'; + +const _gh_raw = (path) => `${jsdeliver}/gh/${user}/${repo}@${branch}/${path}`; + +export const gh_raw = (path) => _gh_raw(path); + diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/sheets.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/sheets.ts new file mode 100644 index 0000000..88f4adc --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/net/sheets.ts @@ -0,0 +1,77 @@ +import * as readline from 'readline'; +import { google } from 'googleapis'; +import * as path from 'path'; +import { sync as readFile } from '@xblox/fs/read'; +import { sync as writeFile } from '@xblox/fs/write'; + +// https://developers.google.com/sheets/api/quickstart/nodejs +// If modifying these scopes, delete token.json. + +const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']; +// The file token.json stores the user's access and refresh tokens, and is +// created automatically when the authorization flow completes for the first +// time. +const TOKEN_PATH = 'token.json'; + +/** + * Get and store new token after prompting for user authorization, and then + * execute the given callback with the authorized OAuth2 client. + * @param {google.auth.OAuth2} oAuth2Client The OAuth2 client to get token for. + * @param {getEventsCallback} callback The callback for the authorized client. + */ +const getNewToken = async (oAuth2Client) => { + const authUrl = oAuth2Client.generateAuthUrl({ + access_type: 'offline', + scope: SCOPES, + }); + console.log('Authorize this app by visiting this url:', authUrl); + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + rl.question('Enter the code from that page here: ', (code) => { + rl.close(); + oAuth2Client.getToken(code, (err, token) => { + if (err) return console.error('Error while trying to retrieve access token', err); + oAuth2Client.setCredentials(token); + // Store the token to disk for later program executions + writeFile(TOKEN_PATH, JSON.stringify(token, null, 2)); + return oAuth2Client; + }); + }); +} + +const readSheet = async (auth, sheet, range) => { + const sheets = google.sheets({ version: 'v4', auth }); + + const res = await sheets.spreadsheets.values.get({ + spreadsheetId: sheet, + range: range, + }); + return res.data.values; +} + +/** + * Create an OAuth2 client with the given credentials, and then execute the + * given callback function. + * @param {Object} credentials The authorization client credentials. + * @param {function} callback The callback to call with the authorized client. + */ +const authorize = async (credentials: any) => { + const { client_secret, client_id, redirect_uris } = credentials.installed; + const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]); + + const token = readFile(TOKEN_PATH, 'string') as string; + if (!token) { + return getNewToken(oAuth2Client); + } + + oAuth2Client.setCredentials(JSON.parse(token)); + return oAuth2Client; +} + +export const read = async (sheet: string, range: string) => { + const creds = readFile(path.resolve('credentials.json'), 'json'); + const client = await authorize(creds); + return await readSheet(client, sheet, range); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/lib/process/index.ts b/extrusion/lydia-print-head-v1/firmware/node/src/lib/process/index.ts new file mode 100644 index 0000000..afe4983 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/lib/process/index.ts @@ -0,0 +1,136 @@ +import * as debug from '../../log'; +import * as stream from 'stream'; +import { ChildProcess, exec, spawn, spawnSync } from 'child_process'; +import { sync as which } from 'which'; +import * as path from 'path'; +import { os } from '../common/platform'; + +export enum STATUS { + OK, + ERROR, + PENDING +} + +const fatalHandler = (message: string, fn: (msg: string) => void): boolean => { + if (message.startsWith('fatal:')) { + fn('\t\ ' + message); + return true; + } + return false; +}; + +// tslint:disable-next-line:no-empty +const subscribe = (signal: stream.Readable, collector: (data: any) => void = () => { }) => { + const buffer: string[] = []; + signal.on('message', (message) => debug.debug('message', message)); + signal.on('error', (error) => debug.error('std-error', error)); + signal.on('data', (data) => { + const message = data.toString(); + buffer.push(message); // .replace(/[\x00-\x1F\x7F-\x9F]/g, "") + collector(buffer); + }); +}; +const merge = (buffer: string[], data: any): string[] => buffer.concat(data); +const hook = (process: ChildProcess, resolve: any, reject: any, cmd: string) => { + let buffer: string[] = []; + const collector = (data: any) => { buffer = buffer.concat(data); }; + const stdout = subscribe(process.stdout, collector); + const stderr = subscribe(process.stderr, collector); + process.on('exit', (code, signal) => { + if (code) { + resolve({ + code: STATUS.ERROR, + command: cmd, + error: code, + messages: buffer + }); + } else { + resolve({ + code: STATUS.OK, + command: cmd, + messages: buffer + }); + } + }); + return process; +}; + +export class Process { + public binary = 'magick'; + public cwd: string = ''; + public args: string = ''; + constructor(options: any = {}) { + this.binary = options.binary || this.binary; + //this.binary = path.resolve(which(this.binary)); + this.cwd = options.cwd || process.cwd(); + } + public optionsToString(options: any): string { + const args: any[] = []; + // tslint:disable-next-line:forin + for (const k in options) { + const val = options[k]; + if (k.length === 1) { + // val is true, add '-k' + if (val === true) { + args.push('-' + k); + } else if (val !== false) { + // if val is not false, add '-k val' + args.push('-' + k + ' ' + val); + } + } else { + if (val === true) { + args.push('--' + k); + } else if (val !== false) { + args.push('--' + k + '=' + val); + } + } + } + return args.join(' '); + } + public optionsToArray(options: any): string[] { + const args: any[] = []; + // tslint:disable-next-line:forin + for (const k in options) { + const val = options[k]; + if (k.length === 1) { + // val is true, add '-k' + if (val === true) { + args.push('-' + k); + } else if (val !== false) { + // if val is not false, add '-k val' + args.push('-' + k + ' ' + val); + } + } else { + if (val === true) { + args.push('--' + k); + } else if (val !== false) { + args.push('--' + k + '=' + val); + } + } + } + return args; + } + public async exec(command: string, options: any = {}, args: any[] = []): Promise { + args = [command].concat(args); + return new Promise((resolve, reject) => { + const p = exec(this.binary + ' ' + args.join(' '), { + cwd: this.cwd + }); + return hook(p, resolve, reject, this.binary + ' ' + args.join(' ')); + }); + } +} + +export class Helper { + public static async run(cwd, command: string, gitArgs: string[]): Promise { + const gitProcess = new Process({ + cwd: cwd, + binary: os() == 'windows' ? 'magick' : '' + }); + const p = gitProcess.exec(command, {}, gitArgs); + const spinner = debug.spinner('Run ' + command + ' with ' + gitArgs.join(' ')).start(); + p.then(() => spinner.stopAndPersist()); + p.catch((e) => debug.error('Error git command : ' + command)); + return p; + } +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/log.ts b/extrusion/lydia-print-head-v1/firmware/node/src/log.ts new file mode 100644 index 0000000..cec65c3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/log.ts @@ -0,0 +1,18 @@ +import { default as chalk } from 'chalk'; +import * as util from 'util'; +import * as _ora from 'ora'; +// tslint:disable-next-line:no-var-requires +const jsome = require('jsome'); +jsome.level.show = true; +const glog = console.log; +export const log = (msg: string, ...rest: any[]) => glog(chalk.magenta(msg), ...rest); +export const info = (msg: string, ...rest) => glog(chalk.green(msg), ...rest); +export const error = (msg: string, ...rest: any[]) => glog(chalk.red(msg), ...rest); +export const warn = (msg: string, ...rest) => glog(chalk.yellow(msg), ...rest); +export const debug = (msg: string, ...rest) => glog(chalk.blue(msg), ...rest); +export const stack = (msg: string, ...rest) => glog(chalk.red(msg), new Error().stack); +export const inspect = (msg: string, d: any = null) => { + glog(chalk.blue(msg)); + d && jsome(d); +}; +export const spinner = (msg: string): any => _ora(msg); diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/main.ts b/extrusion/lydia-print-head-v1/firmware/node/src/main.ts new file mode 100644 index 0000000..30a7b4f --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/main.ts @@ -0,0 +1,17 @@ +import { defaults } from './_cli'; defaults(); +import * as cli from 'yargs'; +import { register as registerPIDProgram } from './commands/pid/program'; registerPIDProgram(cli); +var ModbusRTU = require("modbus-serial"); + +const argv = cli.argv; + +if (argv.h || argv.help) { + cli.showHelp(); + process.exit(); +} else if (argv.v || argv.version) { + // tslint:disable-next-line:no-var-requires + + var client = new ModbusRTU(); + + process.exit(); +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/os/context_menu/register_cli.ts b/extrusion/lydia-print-head-v1/firmware/node/src/os/context_menu/register_cli.ts new file mode 100644 index 0000000..0ddcc45 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/os/context_menu/register_cli.ts @@ -0,0 +1,106 @@ +const Registry = require('rage-edit').Registry; + +const SOFTWARE_CLASSES = 'HKCU\\Software\\Classes\\'; + +export const registerCommand = async options => { + if (!options) throw new Error('options are empty'); + + const { name, icon, command, menu } = options; + if (!name) throw new Error('name is not specified'); + if (!command) throw new Error('command is not specified'); + if (!menu) throw new Error('menuName is not specified'); + + try { + await Registry.set(`${SOFTWARE_CLASSES}*\\shell\\${name}`); + await Registry.set(`${SOFTWARE_CLASSES}*\\shell\\${name}`, '', menu); + if (icon) await Registry.set(`${SOFTWARE_CLASSES}*\\shell\\${name}`, 'Icon', (icon.endsWith('.exe') ? `${icon},0` : icon)); + await Registry.set(`${SOFTWARE_CLASSES}*\\shell\\${name}\\command`, '', `"${command}" "%1"`); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +export const registerDirectoryCommand = async options => { + if (!options) throw new Error('options are empty'); + + const { name, icon, command, menu } = options; + if (!name) throw new Error('name is not specified'); + if (!command) throw new Error('command is not specified'); + if (!menu) throw new Error('menu is not specified'); + + try { + await Registry.set(`${SOFTWARE_CLASSES}Directory\\shell\\${name}`); + await Registry.set(`${SOFTWARE_CLASSES}Directory\\shell\\${name}`, '', menu); + if (icon) await Registry.set(`${SOFTWARE_CLASSES}Directory\\shell\\${name}`, 'Icon', (icon.endsWith('.exe') ? `${icon},0` : icon)); + await Registry.set(`${SOFTWARE_CLASSES}Directory\\shell\\${name}\\command`, '', `"${command}" "%1"`); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +export const registerOpenWithCommand = async (extensions, options) => { + if (!extensions || !extensions.length) throw new Error('extensions is not specified'); + if (!options) throw new Error('options are empty'); + + const { name, command } = options; + if (!name) throw new Error('name is not specified'); + if (!command) throw new Error('command is not specified'); + + try { + await Promise.all((await findExtensionNames(extensions)).map(async n => { + await Registry.set(`${SOFTWARE_CLASSES}${n}`); + await Registry.set(`${SOFTWARE_CLASSES}${n}\\shell\\${name}`); + await Registry.set(`${SOFTWARE_CLASSES}${n}\\shell\\${name}\\command`, '', `"${command}" "%1"`); + })); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +export const removeCommand = async name => { + if (!name) throw new Error('name is not specified'); + + try { + await Registry.delete(`${SOFTWARE_CLASSES}*\\shell\\${name}`); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +export const removeDirectoryCommand = async name => { + if (!name) throw new Error('name is not specified'); + + try { + await Registry.delete(`${SOFTWARE_CLASSES}Directory\\shell\\${name}`); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +export const removeOpenWithCommand = async (extensions, name) => { + if (!extensions) throw new Error('extensions is not specified'); + if (!name) throw new Error('name is not specified'); + + try { + await Promise.all((await findExtensionNames(extensions)).map(async n => await Registry.delete(`${SOFTWARE_CLASSES}${n}\\shell\\${name}`))); + } catch (e) { + return Promise.reject(e); + } + + return Promise.resolve(); +}; + +async function findExtensionNames (exts) { + const { ses_root } = await Registry.get('HKCR'); + return Promise.all(Object.keys(ses_root).filter(e => exts.includes(e)).map(async k => (await Registry.get(`HKCR\\${k}`)).$values[''])); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/output.ts b/extrusion/lydia-print-head-v1/firmware/node/src/output.ts new file mode 100644 index 0000000..fb82d67 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/output.ts @@ -0,0 +1,27 @@ +import { sync } from '@xblox/fs/write'; +import { OutputTarget, Options, OutputResult, OutputFormat } from './types'; +import { error } from './log'; +import { render as format } from './format'; + +export const stdout = (result: any) => console.log(result); + +export const file = (result: string, path: string) => sync(path, result); + +export const render = (result: any, options: Options): OutputResult => { + const report = format(result, options); + switch (options.target) { + case OutputTarget.STDOUT: { + stdout(report); + return true; + } + case OutputTarget.FILE: { + file(report, options.path); + return true; + } + default: { + //private, should never happen since options had to be sanitized + error('output::render Invalid value in options.target'); + return false; + } + } +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/paths.ts b/extrusion/lydia-print-head-v1/firmware/node/src/paths.ts new file mode 100644 index 0000000..7ed5ecc --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/paths.ts @@ -0,0 +1,19 @@ +import * as path from 'path'; +import { URL } from 'url'; +export const STATS_SUFFIX = '_stats.json'; +export const TRACE_SUFFIX = '_trace.json'; +// utils to create output file name for url, format : hostname_time.json +const _url_short = (url: string) => + new URL(url).hostname; + +const _date_suffix = () => + new Date().toLocaleTimeString().replace(/:/g, '_'); + +const _default_filename = (url: string) => + `${_url_short(url)}_${_date_suffix()}`; + +export const default_path = (cwd: string, url: string) => + `${path.join(cwd, _default_filename(url))}${STATS_SUFFIX}`; + +export const default_trace_path = (cwd: string, url: string) => + `${path.join(cwd, _default_filename(url))}${TRACE_SUFFIX}`; \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/src/types.ts b/extrusion/lydia-print-head-v1/firmware/node/src/types.ts new file mode 100644 index 0000000..e746e42 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/src/types.ts @@ -0,0 +1,124 @@ +///////////////////////////////////////////////////// +// +// Application types +// +export enum OutputTarget { + STDOUT = 'console', + FILE = 'file' +} + +export enum OutputFormat { + text = 'text', + json = 'json' +} + +export interface Options { + // @TODO: support many + url?: string; + format?: OutputFormat; + // @TODO: support many + target?: OutputTarget; + headless?: boolean; + // output path + path?: string; + // @TODO: required to pick profile/config files + cwd?: string; + // @TODO: time of sesssion, mapped to Puppeteer waitUntil, if it's a number, the session will be opened for that + // time window, time=-1 means infinity, useful for repl. sessions + time?: number; + // @TODO: reload interval + reload?: number; + // @TODO: repl. --repl=true=interactive or repl=path to specify script + repl?: string | boolean; + // TODO: colored ouput + colors?: boolean; +} + +// options for certain categories as network, rendering,... +export interface OptionEx { + include?: string | string[]; + exclude?: string | string[]; + query?: string | string[]; +} + +export type OptionsEx = Options & { + launchOptions?: { + // puppeteer launch options + } + waitOptions?: { + // puppeteer wait options: wait for selector,... + } + replOptions?: { + script?: string; + } +} + +export type OutputResult = boolean; + +export interface ReportEntry { + name: string; +} + +export type NetworkReportEntry = ReportEntry & { + value: number; + formatted: string; + count: number; + cached_count: number; + external_count: number; + local_count: number; + times?: { + end: number, + formatted: string; + } +} + +///////////////////////////////////////////////////// +// +// Foreign data types (trace data) +// + +// type for a network resource's timing +export interface TraceTiming { + requestTime: number; + proxyStart: number; + proxyEnd: number; + dnsStart: number; + dnsEnd: number; + connectStart: number; + connectEnd: number; + sslStart: number; + sslEnd: number; + workerStart: number; + workerReady: number; + sendStart: number; + sendEnd: number; + receiveHeadersEnd: number; + pushStart: number; + pushEnd: number; +} + +export interface TraceData { + requestId: string; + frame: string; + statusCode: number; + mimeType: string; + encodedDataLength: number; + fromCache: boolean; + fromServiceWorker: boolean; + timing: TraceTiming; +} +export interface TraceArgs { + data: TraceData; +} + +export interface TraceEntry { + pid: number; + tid: number; + ts: number; + ph: string; // B: begin, | E: end; For async events: S: start, F: finish + cat: string; + name: string; + args: TraceArgs; + tts: number; + s: string; +} diff --git a/extrusion/lydia-print-head-v1/firmware/node/tsconfig.json b/extrusion/lydia-print-head-v1/firmware/node/tsconfig.json new file mode 100644 index 0000000..91dbcc7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "allowJs": false, + "noImplicitAny": false, + "noImplicitThis": false, + "alwaysStrict": true, + "sourceMap": true, + "outDir": "./build", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "pretty": true, + "baseUrl": "./src", + "rootDir": "./src", + "watch": true, + "allowSyntheticDefaultImports": true + }, + "compileOnSave": false, + "filesGlob": [ + "./src/**/*.ts" + ], + "atom": { + "rewriteTsconfig": true + }, + "files": [ + "./src/index.ts" + ] +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/node/tslint.json b/extrusion/lydia-print-head-v1/firmware/node/tslint.json new file mode 100644 index 0000000..6455bf7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/node/tslint.json @@ -0,0 +1,101 @@ +{ + "extends": [ + "tslint:latest", + "tslint-react" + ], + "rules": { + "triple-equals": false, + "no-bitwise": false, + "jsx-self-close": false, + "comment-format": false, + "jsx-alignment": false, + "no-debugger": false, + "no-empty": false, + "arrow-parens": false, + "eofline": false, + "only-arrow-functions": false, + "no-unused-expression": false, + "no-unused-variable": true, + "prefer-for-of": false, + "prefer-const": false, + "no-this-assignment": false, + "member-access": false, + "member-ordering": false, + "no-empty-interface": false, + "no-string-literal": false, + "no-trailing-whitespace": false, + "no-shadowed-variable": false, + "object-literal-shorthand": false, + "no-var-requires": true, + "interface-name": false, + "interface-over-type-literal": false, + "no-duplicate-imports": false, + "array-type": false, + "jsx-no-lambda": false, + "jsdoc-format": false, + "typedef-whitespace": false, + "ban": [ + true, + [ + "Object", + "assign", + "use TS2.1 object spread { ...a, ...b }" + ], + [ + "describe", + "only" + ], + [ + "it", + "only" + ] + ], + "no-console": false, + "linebreak-style": [ + true, + "LF" + ], + "no-invalid-this": [ + true, + "check-function-in-method" + ], + "jsx-wrap-multiline": false, + "space-before-function-paren": false, + "variable-name": [ + "ban-keywords", + "check-format", + "allow-leading-underscore", + "allow-pascal-case" + ], + "no-submodule-imports": false, + "no-implicit-dependencies": false, + "trailing-comma": [ + false + ], + "max-line-length": [ + 180 + ], + "max-classes-per-file": [ + false, + 5 + ], + "object-literal-sort-keys": false, + "jsx-no-multiline-js": false, + "ordered-imports": [ + false + ], + "semicolon": [ + false + ], + "quotemark": [ + true, + "single" + ] + }, + "jsRules": { + "object-literal-shorthand": true, + "trailing-comma": [ + false + ] + } +} diff --git a/extrusion/lydia-print-head-v1/firmware/platformio.ini b/extrusion/lydia-print-head-v1/firmware/platformio.ini new file mode 100644 index 0000000..ac8bd48 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/platformio.ini @@ -0,0 +1,20 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[platformio] +src_dir = ./firmware + +[env:controllino_mega] +platform = atmelavr +board = controllino_mega +board_build.mcu = atmega2560 +board_build.f_cpu = 16000000L +; see https://libraries.io/platformio/CONTROLLINO +lib_deps = controllino-plc/CONTROLLINO@^3.0.5 diff --git a/extrusion/lydia-print-head-v1/firmware/setup.md b/extrusion/lydia-print-head-v1/firmware/setup.md new file mode 100644 index 0000000..d8a602d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/setup.md @@ -0,0 +1,41 @@ +### Omron MX2 + +1. Please refer to the [OmronMX2 - Modbus setup guide](../vendor/omron/P641-E1-01_EGuide_CJ_Mod485_OMRON_3G3MX2-V1.pdf)(Section 7.2.2) + +In case the terminal labels mismatch the documenation, please use `SN` for (A-) and `SP` for (B+) + +2. The firmware expects the VFD at **Slave-Address 10** ! + +Additionally, please check the [user manual](../vendor/omron/I570-E2-02B.pdf) + +### Omron E5 - PID + +### TCP interface + +To set the target temperature to 100 Degc on PID1, the complete message for Modbus TCP would be + +![](./documentation/setPID100.jpg) + +``` 01 06 00 11 00 64 D8 24 ``` + +- ```01``` : slave id +- ```06``` : Modbus verb / function code, in this case **WRITE HOLDING REGISTER** +- ```11``` : address (17) +- ```00 64``` : value (100), 2 bytes +- ```D8 24``` : CRC, 2 bytes. Since it's TCP, **this isn't evaluated and can be ignored** on the Controllino - PlasticHub firmware (see ['./firmware/Mudbus.cpp'](./firmware/Mudbus.cpp)). + +In order to fake a Modbus message, all we need is ``` 01 06 00 11 00 64``` but we also have to prefix it with the TCP overhead (d2 8d 00 00 00 06) + +|-- TCP Overhead----- | -------- Modbus ---- | + +**```d2 8d 00 00 00 06 ```** | ```01 06 00 11 00 64``` + +In example, we can send this via Hercules : + +![](./documentation/setPID100_TCP.jpg) + +The TCP overhead (```d2 8d 00 00 00 06```) is created as follow: + +- ```d2 8d``` : Transaction identifier, 2 bytes +- ```00 00``` : Protocol identifier, 2 bytes +- ```00 06``` : Length of the message, 2 bytes diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest/ModbusRtu.h b/extrusion/lydia-print-head-v1/firmware/test/mtest/ModbusRtu.h new file mode 100644 index 0000000..845681d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest/ModbusRtu.h @@ -0,0 +1,1485 @@ +/** + * @file ModbusRtu.h + * @version 1.21 (modified by CONTROLLINO team) + * @date 2016.02.21 (2017.03.30) + * @author Samuel Marco i Armengol (Thank you, Samuel!) + * @contact sammarcoarmengol@gmail.com + * @contribution Helium6072 + * + * @description + * Arduino library for communicating with Modbus devices + * over RS232/USB/485 via RTU protocol. + * + * Further information: + * http://modbus.org/ + * http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf + * + * @license + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version + * 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @defgroup setup Modbus Object Instantiation/Initialization + * @defgroup loop Modbus Object Management + * @defgroup buffer Modbus Buffer Management + * @defgroup discrete Modbus Function Codes for Discrete Coils/Inputs + * @defgroup register Modbus Function Codes for Holding/Input Registers + * + */ + +#include +#include "Arduino.h" +#include "Print.h" +#include + +#define RS485_PIN_DE 0b01000000 +#define RS485_PIN_RE 0b00100000 +#define RS485_DIR_REG DDRJ +#define RS485_PORT_REG PORTJ +#define RS485_CLEAR_DE RS485_PORT_REG &= ~RS485_PIN_DE +#define RS485_CLEAR_RE RS485_PORT_REG &= ~RS485_PIN_RE +#define RS485_SET_DE RS485_PORT_REG |= RS485_PIN_DE +#define RS485_SET_RE RS485_PORT_REG |= RS485_PIN_RE + +/** + * @struct modbus_t + * @brief + * Master query structure: + * This includes all the necessary fields to make the Master generate a Modbus query. + * A Master may keep several of these structures and send them cyclically or + * use them according to program needs. + */ +typedef struct +{ + uint8_t u8id; /*!< Slave address between 1 and 247. 0 means broadcast */ + uint8_t u8fct; /*!< Function code: 1, 2, 3, 4, 5, 6, 15 or 16 */ + uint16_t u16RegAdd; /*!< Address of the first register to access at slave/s */ + uint16_t u16CoilsNo; /*!< Number of coils or registers to access */ + uint16_t *au16reg; /*!< Pointer to memory image in master */ +} modbus_t; + +enum +{ + RESPONSE_SIZE = 6, + EXCEPTION_SIZE = 3, + CHECKSUM_SIZE = 2 +}; + +/** + * @enum MESSAGE + * @brief + * Indexes to telegram frame positions + */ +enum MESSAGE +{ + ID = 0, //!< ID field + FUNC, //!< Function code position + ADD_HI, //!< Address high byte + ADD_LO, //!< Address low byte + NB_HI, //!< Number of coils or registers high byte + NB_LO, //!< Number of coils or registers low byte + BYTE_CNT //!< byte counter +}; + +/** + * @enum MB_FC + * @brief + * Modbus function codes summary. + * These are the implement function codes either for Master or for Slave. + * + * @see also fctsupported + * @see also modbus_t + */ +enum MB_FC +{ + MB_FC_NONE = 0, /*!< null operator */ + MB_FC_READ_COILS = 1, /*!< FCT=1 -> read coils or digital outputs */ + MB_FC_READ_DISCRETE_INPUT = 2, /*!< FCT=2 -> read digital inputs */ + MB_FC_READ_REGISTERS = 3, /*!< FCT=3 -> read registers or analog outputs */ + MB_FC_READ_INPUT_REGISTER = 4, /*!< FCT=4 -> read analog inputs */ + MB_FC_WRITE_COIL = 5, /*!< FCT=5 -> write single coil or output */ + MB_FC_WRITE_REGISTER = 6, /*!< FCT=6 -> write single register */ + MB_FC_WRITE_MULTIPLE_COILS = 15, /*!< FCT=15 -> write multiple coils or outputs */ + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 /*!< FCT=16 -> write multiple registers */ +}; + +enum COM_STATES +{ + COM_IDLE = 0, + COM_WAITING = 1 + +}; + +enum ERR_LIST +{ + ERR_NOT_MASTER = -1, + ERR_POLLING = -2, + ERR_BUFF_OVERFLOW = -3, + ERR_BAD_CRC = -4, + ERR_EXCEPTION = -5 +}; + +enum +{ + NO_REPLY = 255, + EXC_FUNC_CODE = 1, + EXC_ADDR_RANGE = 2, + EXC_REGS_QUANT = 3, + EXC_EXECUTE = 4 +}; + +const unsigned char fctsupported[] = + { + MB_FC_READ_COILS, + MB_FC_READ_DISCRETE_INPUT, + MB_FC_READ_REGISTERS, + MB_FC_READ_INPUT_REGISTER, + MB_FC_WRITE_COIL, + MB_FC_WRITE_REGISTER, + MB_FC_WRITE_MULTIPLE_COILS, + MB_FC_WRITE_MULTIPLE_REGISTERS}; + +#define T35 5 +#define MAX_BUFFER 64 //!< maximum size for the communication buffer in bytes + +/** + * @class Modbus + * @brief + * Arduino class library for communicating with Modbus devices over + * USB/RS232/485 (via RTU protocol). + */ +class Modbus +{ +private: + HardwareSerial *port; //!< Pointer to Serial class object + SoftwareSerial *softPort; //!< Pointer to SoftwareSerial class object + uint8_t u8id; //!< 0=master, 1..247=slave number + uint8_t u8serno; //!< serial port: 0-Serial, 1..3-Serial1..Serial3; 4: use software serial + uint8_t u8txenpin; //!< flow control pin: 0=USB or RS-232 mode, >0=RS-485 mode + uint8_t u8state; + uint8_t u8lastError; + uint8_t au8Buffer[MAX_BUFFER]; + uint8_t u8BufferSize; + uint8_t u8lastRec; + uint16_t *au16regs; + uint16_t u16InCnt, u16OutCnt, u16errCnt; + uint16_t u16timeOut; + uint32_t u32time, u32timeOut; + uint8_t u8regsize; + + void init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + void init(uint8_t u8id); + void sendTxBuffer(); + int8_t getRxBuffer(); + uint16_t calcCRC(uint8_t u8length); + uint8_t validateAnswer(); + uint8_t validateRequest(); + void get_FC1(); + void get_FC3(); + int8_t process_FC1(uint16_t *regs, uint8_t u8size); + int8_t process_FC3(uint16_t *regs, uint8_t u8size); + int8_t process_FC5(uint16_t *regs, uint8_t u8size); + int8_t process_FC6(uint16_t *regs, uint8_t u8size); + int8_t process_FC15(uint16_t *regs, uint8_t u8size); + int8_t process_FC16(uint16_t *regs, uint8_t u8size); + void buildException(uint8_t u8exception); // build exception message + +public: + Modbus(); + Modbus(uint8_t u8id, uint8_t u8serno); + Modbus(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + Modbus(uint8_t u8id); + void begin(long u32speed); + void begin(SoftwareSerial *sPort, long u32speed); + void begin(long u32speed, uint8_t u8config); + void begin(); + void setTimeOut(uint16_t u16timeout); //!begin(u32speed); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the software serial port using specified baud rate and SoftwareSerial object. + * Call once class has been instantiated, typically within setup(). + * + * @param speed *softPort, pointer to SoftwareSerial class object + * @param speed baud rate, in standard increments (300..115200) + * @ingroup setup + */ +void Modbus::begin(SoftwareSerial *sPort, long u32speed) +{ + + softPort = sPort; + + softPort->begin(u32speed); + + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (softPort->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the serial port using specified baud rate. + * Call once class has been instantiated, typically within setup(). + * + * @see http://arduino.cc/en/Serial/Begin#.Uy4CJ6aKlHY + * @param speed baud rate, in standard increments (300..115200) + * @param config data frame settings (data length, parity and stop bits) + * @ingroup setup + */ +void Modbus::begin(long u32speed, uint8_t u8config) +{ + + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + port = &Serial1; + break; +#endif + +#if defined(UBRR2H) + case 2: + port = &Serial2; + break; +#endif + +#if defined(UBRR3H) + case 3: + port = &Serial3; + break; +#endif + case 0: + default: + port = &Serial; + break; + } + + port->begin(u32speed, u8config); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + // pinMode(u8txenpin, OUTPUT); + // digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize default class object. + * + * Sets up the serial port using 19200 baud. + * Call once class has been instantiated, typically within setup(). + * + * @overload Modbus::begin(uint16_t u16BaudRate) + * @ingroup setup + */ +void Modbus::begin() +{ + begin(19200); +} + +/** + * @brief + * Method to write a new slave ID address + * + * @param u8id new slave address between 1 and 247 + * @ingroup setup + */ +void Modbus::setID(uint8_t u8id) +{ + if ((u8id != 0) && (u8id <= 247)) + { + this->u8id = u8id; + } +} + +/** + * @brief + * Method to read current slave ID address + * + * @return u8id current slave address between 1 and 247 + * @ingroup setup + */ +uint8_t Modbus::getID() +{ + return this->u8id; +} + +/** + * @brief + * Initialize time-out parameter + * + * Call once class has been instantiated, typically within setup(). + * The time-out timer is reset each time that there is a successful communication + * between Master and Slave. It works for both. + * + * @param time-out value (ms) + * @ingroup setup + */ +void Modbus::setTimeOut(uint16_t u16timeOut) +{ + this->u16timeOut = u16timeOut; +} + +/** + * @brief + * Return communication Watchdog state. + * It could be usefull to reset outputs if the watchdog is fired. + * + * @return TRUE if millis() > u32timeOut + * @ingroup loop + */ +boolean Modbus::getTimeOutState() +{ + return (millis() > u32timeOut); +} + +/** + * @brief + * Get input messages counter value + * This can be useful to diagnose communication + * + * @return input messages counter + * @ingroup buffer + */ +uint16_t Modbus::getInCnt() +{ + return u16InCnt; +} + +/** + * @brief + * Get transmitted messages counter value + * This can be useful to diagnose communication + * + * @return transmitted messages counter + * @ingroup buffer + */ +uint16_t Modbus::getOutCnt() +{ + return u16OutCnt; +} + +/** + * @brief + * Get errors counter value + * This can be useful to diagnose communication + * + * @return errors counter + * @ingroup buffer + */ +uint16_t Modbus::getErrCnt() +{ + return u16errCnt; +} + +/** + * Get modbus master state + * + * @return = 0 IDLE, = 1 WAITING FOR ANSWER + * @ingroup buffer + */ +uint8_t Modbus::getState() +{ + return u8state; +} + +/** + * Get the last error in the protocol processor + * + * @returnreturn NO_REPLY = 255 Time-out + * @return EXC_FUNC_CODE = 1 Function code not available + * @return EXC_ADDR_RANGE = 2 Address beyond available space for Modbus registers + * @return EXC_REGS_QUANT = 3 Coils or registers number beyond the available space + * @ingroup buffer + */ +uint8_t Modbus::getLastError() +{ + return u8lastError; +} + +/** + * @brief + * *** Only Modbus Master *** + * Generate a query to an slave with a modbus_t telegram structure + * The Master must be in COM_IDLE mode. After it, its state would be COM_WAITING. + * This method has to be called only in loop() section. + * + * @see modbus_t + * @param modbus_t modbus telegram structure (id, fct, ...) + * @ingroup loop + * @todo finish function 15 + */ +int8_t Modbus::query(modbus_t telegram) +{ + uint8_t u8regsno, u8bytesno; + if (u8id != 0) + return -2; + if (u8state != COM_IDLE) + return -1; + + if ((telegram.u8id == 0) || (telegram.u8id > 247)) + return -3; + + au16regs = telegram.au16reg; + + // telegram header + au8Buffer[ID] = telegram.u8id; + au8Buffer[FUNC] = telegram.u8fct; + au8Buffer[ADD_HI] = highByte(telegram.u16RegAdd); + au8Buffer[ADD_LO] = lowByte(telegram.u16RegAdd); + + switch (telegram.u8fct) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + u8BufferSize = 6; + break; + case MB_FC_WRITE_COIL: + au8Buffer[NB_HI] = ((au16regs[0] > 0) ? 0xff : 0); + au8Buffer[NB_LO] = 0; + u8BufferSize = 6; + break; + case MB_FC_WRITE_REGISTER: + au8Buffer[NB_HI] = highByte(au16regs[0]); + au8Buffer[NB_LO] = lowByte(au16regs[0]); + u8BufferSize = 6; + break; + case MB_FC_WRITE_MULTIPLE_COILS: // TODO: implement "sending coils" + u8regsno = telegram.u16CoilsNo / 16; + u8bytesno = u8regsno * 2; + if ((telegram.u16CoilsNo % 16) != 0) + { + u8bytesno++; + u8regsno++; + } + + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = u8bytesno; + u8BufferSize = 7; + + u8regsno = u8bytesno = 0; // now auxiliary registers + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + } + break; + + case MB_FC_WRITE_MULTIPLE_REGISTERS: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = (uint8_t)(telegram.u16CoilsNo * 2); + u8BufferSize = 7; + + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + au8Buffer[u8BufferSize] = highByte(au16regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(au16regs[i]); + u8BufferSize++; + } + break; + } + + sendTxBuffer(); + u8state = COM_WAITING; + return 0; +} + +/** + * @brief *** Only for Modbus Master *** + * This method checks if there is any incoming answer if pending. + * If there is no answer, it would change Master state to COM_IDLE. + * This method must be called only at loop section. + * Avoid any delay() function. + * + * Any incoming data would be redirected to au16regs pointer, + * as defined in its modbus_t query telegram. + * + * @params nothing + * @return errors counter + * @ingroup loop + */ +int8_t Modbus::poll() +{ + // check if there is any incoming frame + uint8_t u8current; + if (u8serno < 4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (millis() > u32timeOut) + { + u8state = COM_IDLE; + u8lastError = NO_REPLY; + u16errCnt++; + Serial.println("time out"); + Serial.println(u32timeOut); + return 0; + } + + if (u8current == 0) + { + Serial.println("no port"); + return 0; + } + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + Serial.println("t35"); + return 0; + } + if (millis() < u32time) + { + Serial.println("bel"); + return 0; + }; + + // transfer Serial buffer frame to auBuffer + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + if (i8state < 7) + { + u8state = COM_IDLE; + u16errCnt++; + Serial.println("idle"); + return i8state; + } + + // validate message: id, CRC, FCT, exception + uint8_t u8exception = validateAnswer(); + if (u8exception != 0) + { + Serial.println("exception"); + u8state = COM_IDLE; + return u8exception; + } + + Serial.print("have data "); + // process answer + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + // call get_FC1 to transfer the incoming message to au16regs buffer + get_FC1(); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + // call get_FC3 to transfer the incoming message to au16regs buffer + get_FC3(); + break; + case MB_FC_WRITE_COIL: + case MB_FC_WRITE_REGISTER: + case MB_FC_WRITE_MULTIPLE_COILS: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + // nothing to do + break; + default: + break; + } + u8state = COM_IDLE; + return u8BufferSize; +} + +/** + * @brief + * *** Only for Modbus Slave *** + * This method checks if there is any incoming query + * Afterwards, it would shoot a validation routine plus a register query + * Avoid any delay() function !!!! + * After a successful frame between the Master and the Slave, the time-out timer is reset. + * + * @param *regs register table for communication exchange + * @param u8size size of the register table + * @return 0 if no query, 1..4 if communication error, >4 if correct query processed + * @ingroup loop + */ +int8_t Modbus::poll(uint16_t *regs, uint8_t u8size) +{ + + au16regs = regs; + u8regsize = u8size; + uint8_t u8current; + + // check if there is any incoming frame + if (u8serno < 4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (u8current == 0) + return 0; + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) + return 0; + + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + u8lastError = i8state; + if (i8state < 7) + return i8state; + + // check slave id + if (au8Buffer[ID] != u8id) + return 0; + + // validate message: CRC, FCT, address and size + uint8_t u8exception = validateRequest(); + if (u8exception > 0) + { + if (u8exception != NO_REPLY) + { + buildException(u8exception); + sendTxBuffer(); + } + u8lastError = u8exception; + return u8exception; + } + + u32timeOut = millis() + long(u16timeOut); + u8lastError = 0; + + // process message + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + return process_FC1(regs, u8size); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + return process_FC3(regs, u8size); + break; + case MB_FC_WRITE_COIL: + return process_FC5(regs, u8size); + break; + case MB_FC_WRITE_REGISTER: + return process_FC6(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_COILS: + return process_FC15(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_REGISTERS: + return process_FC16(regs, u8size); + break; + default: + break; + } + return i8state; +} + +/* _____PRIVATE FUNCTIONS_____________________________________________________ */ + +void Modbus::init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin) +{ + this->u8id = u8id; + this->u8serno = (u8serno > 3) ? 0 : u8serno; + + // this->u8txenpin = u8txenpin; + this->u8txenpin = 2; // Ignore input parameter u8txenpin and hardcode 2 for compatibility + + this->u16timeOut = 1000; +} + +void Modbus::init(uint8_t u8id) +{ + this->u8id = u8id; + this->u8serno = 4; + this->u8txenpin = 0; + this->u16timeOut = 1000; +} + +/** + * @brief + * This method moves Serial buffer data to the Modbus au8Buffer. + * + * @return buffer size if OK, ERR_BUFF_OVERFLOW if u8BufferSize >= MAX_BUFFER + * @ingroup buffer + */ +int8_t Modbus::getRxBuffer() +{ + boolean bBuffOverflow = false; + + if (u8txenpin > 1) + { + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + + u8BufferSize = 0; + if (u8serno < 4) + while (port->available()) + { + au8Buffer[u8BufferSize] = port->read(); + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + else + while (softPort->available()) + { + au8Buffer[u8BufferSize] = softPort->read(); + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + u16InCnt++; + + if (bBuffOverflow) + { + u16errCnt++; + return ERR_BUFF_OVERFLOW; + } + return u8BufferSize; +} + +/** + * @brief + * This method transmits au8Buffer to Serial line. + * Only if u8txenpin != 0, there is a flow handling in order to keep + * the RS485 transceiver in output state as long as the message is being sent. + * This is done with UCSRxA register. + * The CRC is appended to the buffer before starting to send it. + * + * @param nothing + * @return nothing + * @ingroup buffer + */ +void Modbus::sendTxBuffer() +{ + uint8_t i = 0; + + // append CRC to message + uint16_t u16crc = calcCRC(u8BufferSize); + /* + + Serial.print("---- calc CRC "); + Serial.print(u16crc); + Serial.print(" - "); + Serial.print(u8BufferSize); + Serial.print("\n");*/ + + au8Buffer[u8BufferSize] = u16crc >> 8; + u8BufferSize++; + au8Buffer[u8BufferSize] = u16crc & 0x00ff; + u8BufferSize++; + + // set RS485 transceiver to transmit mode + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + UCSR1A = UCSR1A | (1 << TXC1); + break; +#endif + +#if defined(UBRR2H) + case 2: + UCSR2A = UCSR2A | (1 << TXC2); + break; +#endif + +#if defined(UBRR3H) + case 3: + UCSR3A = UCSR3A | (1 << TXC3); + break; +#endif + case 0: + default: + UCSR0A = UCSR0A | (1 << TXC0); + break; + } + RS485_SET_DE; + RS485_SET_RE; + //digitalWrite( u8txenpin, HIGH ); + } + + // transfer buffer to serial line + if (u8serno < 4) + port->write(au8Buffer, u8BufferSize); + else + softPort->write(au8Buffer, u8BufferSize); + + // keep RS485 transceiver in transmit mode as long as sending + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + while (!(UCSR1A & (1 << TXC1))) + ; + break; +#endif + +#if defined(UBRR2H) + case 2: + while (!(UCSR2A & (1 << TXC2))) + ; + break; +#endif + +#if defined(UBRR3H) + case 3: + while (!(UCSR3A & (1 << TXC3))) + ; + break; +#endif + case 0: + default: + while (!(UCSR0A & (1 << TXC0))) + ; + break; + } + + // return RS485 transceiver to receive mode + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + if (u8serno < 4) + while (port->read() >= 0) + ; + else + while (softPort->read() >= 0) + ; + + u8BufferSize = 0; + + // set time-out for master + u32timeOut = millis() + (unsigned long)u16timeOut; + + // increase message counter + u16OutCnt++; +} + +/** + * @brief + * This method calculates CRC + * + * @return uint16_t calculated CRC value for the message + * @ingroup buffer + */ +uint16_t Modbus::calcCRC(uint8_t u8length) +{ + unsigned int temp, temp2, flag; + temp = 0xFFFF; + for (unsigned char i = 0; i < u8length; i++) + { + temp = temp ^ au8Buffer[i]; + for (unsigned char j = 1; j <= 8; j++) + { + flag = temp & 0x0001; + temp >>= 1; + if (flag) + temp ^= 0xA001; + } + } + // Reverse byte order. + temp2 = temp >> 8; + temp = (temp << 8) | temp2; + temp &= 0xFFFF; + // the returned value is already swapped + // crcLo byte is first & crcHi byte is last + return temp; +} + +/** + * @brief + * This method validates slave incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateRequest() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + // check start address & nb range + uint16_t u16regs = 0; + uint8_t u8regs; + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_WRITE_MULTIPLE_COILS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_COIL: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_REGISTER: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + } + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method validates master incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateAnswer() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check exception + if ((au8Buffer[FUNC] & 0x80) != 0) + { + u16errCnt++; + return ERR_EXCEPTION; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method builds an exception message + * + * @ingroup buffer + */ +void Modbus::buildException(uint8_t u8exception) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + + au8Buffer[ID] = u8id; + au8Buffer[FUNC] = u8func + 0x80; + au8Buffer[2] = u8exception; + u8BufferSize = EXCEPTION_SIZE; +} + +/** + * This method processes functions 1 & 2 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + * TODO: finish its implementation + */ +void Modbus::get_FC1() +{ + uint8_t u8byte, i; + u8byte = 0; + + // for (i=0; i< au8Buffer[ 2 ] /2; i++) { + // au16regs[ i ] = word( + // au8Buffer[ u8byte ], + // au8Buffer[ u8byte +1 ]); + // u8byte += 2; + // } +} + +/** + * This method processes functions 3 & 4 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + */ +void Modbus::get_FC3() +{ + uint8_t u8byte, i; + u8byte = 3; + + for (i = 0; i < au8Buffer[2] / 2; i++) + { + au16regs[i] = word( + au8Buffer[u8byte], + au8Buffer[u8byte + 1]); + u8byte += 2; + } +} + +/** + * @brief + * This method processes functions 1 & 2 + * This method reads a bit array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC1(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8bytesno, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // put the number of bytes in the outcoming message + u8bytesno = (uint8_t)(u16Coilno / 8); + if (u16Coilno % 8 != 0) + u8bytesno++; + au8Buffer[ADD_HI] = u8bytesno; + u8BufferSize = ADD_LO; + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bitWrite( + au8Buffer[u8BufferSize], + u8bitsno, + bitRead(regs[u8currentRegister], u8currentBit)); + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8BufferSize++; + } + } + + // send outcoming message + if (u16Coilno % 8 != 0) + u8BufferSize++; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes functions 3 & 4 + * This method reads a word array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC3(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8StartAdd = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8regsno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + uint8_t u8CopyBufferSize; + uint8_t i; + + au8Buffer[2] = u8regsno * 2; + u8BufferSize = 3; + + for (i = u8StartAdd; i < u8StartAdd + u8regsno; i++) + { + au8Buffer[u8BufferSize] = highByte(regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(regs[i]); + u8BufferSize++; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 5 + * This method writes a value assigned by the master to a single bit + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC5(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit; + uint8_t u8CopyBufferSize; + uint16_t u16coil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + + // point to the register and its bit + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + // write to coil + bitWrite( + regs[u8currentRegister], + u8currentBit, + au8Buffer[NB_HI] == 0xff); + + // send answer to master + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 6 + * This method writes a value assigned by the master to a single word + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC6(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8add = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8CopyBufferSize; + uint16_t u16val = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + regs[u8add] = u16val; + + // keep the same header + u8BufferSize = RESPONSE_SIZE; + + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 15 + * This method writes a bit array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC15(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8frameByte, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + boolean bTemp; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + u8frameByte = 7; + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bTemp = bitRead( + au8Buffer[u8frameByte], + u8bitsno); + + bitWrite( + regs[u8currentRegister], + u8currentBit, + bTemp); + + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8frameByte++; + } + } + + // send outcoming message + // it's just a copy of the incomping frame until 6th byte + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 16 + * This method writes a word array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC16(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + uint8_t u8StartAdd = au8Buffer[ADD_HI] << 8 | au8Buffer[ADD_LO]; + uint8_t u8regsno = au8Buffer[NB_HI] << 8 | au8Buffer[NB_LO]; + uint8_t u8CopyBufferSize; + uint8_t i; + uint16_t temp; + + // build header + au8Buffer[NB_HI] = 0; + au8Buffer[NB_LO] = u8regsno; + u8BufferSize = RESPONSE_SIZE; + + // write registers + for (i = 0; i < u8regsno; i++) + { + temp = word( + au8Buffer[(BYTE_CNT + 1) + i * 2], + au8Buffer[(BYTE_CNT + 2) + i * 2]); + + regs[u8StartAdd + i] = temp; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest/mtest.ino b/extrusion/lydia-print-head-v1/firmware/test/mtest/mtest.ino new file mode 100644 index 0000000..5a70da4 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest/mtest.ino @@ -0,0 +1,190 @@ +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ +#include "ModbusRtu.h" /* Usage of ModBusRtu library allows you to implement the Modbus RTU protocol in your sketch. */ + +// This MACRO defines Modbus master address. +// For any Modbus slave devices are reserved addresses in the range from 1 to 247. +// Important note only address 0 is reserved for a Modbus master device! + +#define MasterModbusAdd 0 +#define SlaveModbusAdd 1 + +// This MACRO defines number of the comport that is used for RS 485 interface. +// For MAXI and MEGA RS485 is reserved UART Serial3. +#define RS485Serial 3 + +// The object ControllinoModbuSlave of the class Modbus is initialized with three parameters. +// The first parametr specifies the address of the Modbus slave device. +// The second parameter specifies type of the interface used for communication between devices - in this sketch - RS485. +// The third parameter can be any number. During the initialization of the object this parameter has no effect. +Modbus ControllinoModbusMaster(MasterModbusAdd, RS485Serial, 0); + +// This uint16 array specified internal registers in the Modbus slave device. +// Each Modbus device has particular internal registers that are available for the Modbus master. +// In this example sketch internal registers are defined as follows: +// (ModbusSlaveRegisters 0 - 3 read only and ModbusSlaveRegisters 4 - 7 write only from the Master perspective): +// ModbusSlaveRegisters[0] - Read an analog value from the CONTROLLINO_A0 - returns value in the range from 0 to 1023. +// ModbusSlaveRegisters[1] - Read an digital value from the CONTROLLINO_D0 - returns only the value 0 or 1. +// ModbusSlaveRegisters[2] - Read the number of incoming messages - Communication diagnostic. +// ModbusSlaveRegisters[3] - Read the number of number of outcoming messages - Communication diagnostic. +// ModbusSlaveRegisters[4] - Sets the Relay output CONTROLLINO_R0 - only the value 0 or 1 is accepted. +// ModbusSlaveRegisters[5] - Sets the Relay output CONTROLLINO_R1 - only the value 0 or 1 is accepted. +// ModbusSlaveRegisters[6] - Sets the Relay output CONTROLLINO_R2 - only the value 0 or 1 is accepted. +// ModbusSlaveRegisters[7] - Sets the Relay output CONTROLLINO_R3 - only the value 0 or 1 is accepted. +uint16_t ModbusSlaveRegisters[8]; + +// This is an structe which contains a query to an slave device +modbus_t ModbusQuery[2]; + +uint8_t myState; // machine state +uint8_t currentQuery; // pointer to message query + +unsigned long WaitingTime; + +void setup() +{ + // initialize serial communication at 9600 bits per second: + Serial.begin(19200); + Serial.println("-----------------------------------------"); + Serial.println("CONTROLLINO Modbus RTU Master Test Sketch"); + Serial.println("-----------------------------------------"); + Serial.println(""); + +#define MX2_STATE 0x0003 // (2 bytes) Status of the inverter +#define MX2_TARGET_FR 0x0001 // (4 bytes) Source (reference) of the frequency reference (0,01 [Hz]) +#define MX2_ACCEL_TIME 0x1103 // (4 bytes) Acceleration time (cm compressor) in 0.01 sec +#define MX2_DEACCEL_TIME 0x1105 // (4 bytes) Braking time (cm compressor) in 0.01 sec + +#define MX2_CURRENT_FR 0x1001 // (4 bytes) Output frequency control (0,01 [Hz]) +#define MX2_AMPERAGE 0x1003 // (2 bytes) Output current monitoring (0,01 [A]) +#define MX2_VOLTAGE 0x1011 // (2 bytes) Monitoring output voltage 0.1 [V] +#define MX2_POWER 0x1012 // (2 bytes) Power control 0.1 [kW] +#define MX2_POWER_HOUR 0x1013 // (4 bytes) Watt-hour control 0.1 [kW / h] +#define MX2_HOUR 0x1015 // (4 bytes) Control of operating time in the "Run" mode 1 [h] +#define MX2_HOUR1 0x1017 // (4 bytes) Monitoring of running hours with power on 1 [h] +#define MX2_TEMP 0x1019 // (2 bytes) Radiator temperature control (0.1 degree) -200 ... 1500 +#define MX2_VOLTAGE_DC 0x1026 // (2 bytes) DC voltage control (PN) 0.1 [V] +#define MX2_NUM_ERR 0x0011 // (2 bytes) Trip counter 0 ... 65530 +#define MX2_ERROR1 0x0012 // (20 bytes) Description 1 trip the remaining 5 lie sequentially behind the first address error are calculated MX2_ERROR1 + i * 0x0a +#define MX2_INIT_DEF 0x1357 // (2 bytes) Set the initialization mode to 0 (nothing), 1 (clearing the shutdown history), 2 (clearing the shutdown history and initializing data), 4 (clearing the shutdown history, initializing data and the program EzSQ) +#define MX2_INIT_RUN 0x13b7 // (2 bytes) Initialization start 0 (off), 1 (on) + +#define MX2_SOURCE_FR 0x1201 // (2 bytes) Frequency reference source +#define MX2_SOURCE_CMD 0x1202 // (2 bytes) Command source +#define MX2_BASE_FR 0x1203 // (2 bytes) Main frequency 300 ... "maximum frequency" 0.1 Hz +#define MX2_MAX_FR 0x1204 // (2 bytes) Maximum frequency 300 ... 4000 (10000) 0.1 Hz +#define MX2_DC_BRAKING 0x1245 // (2 bytes) Enable DC Braking +#define MX2_STOP_MODE 0x134e // (2 bytes) Choosing a stop method B091 = 01 +#define MX2_MODE 0x13ae // (2 bytes) IF mode selection b171 = 03 +#define MX2_A002 0x1202 // A002 Source of the “Run” command 01 .. Control terminals 02 ... “Run” key on the keypad or digital panel 03 ... Input via the ModBus network 04 ... Add. card = 01 +#define MX2_A003 0x1203 // A003 Main frequency Can be set in the range from 30 Hz to the maximum frequency (A004) (0.1 Hz) = 120 * 10 +#define MX2_A004 0x1204 // A004 Maximum frequency Can be set in the range from the fundamental frequency to 400 Hz (0.1 Hz) = 120 * 10 + +#define ku8MBReadCoils 0x01 ///< Modbus function 0x01 Read Coils +#define ku8MBReadDiscreteInputs 0x02 ///< Modbus function 0x02 Read Discrete Inputs +#define ku8MBWriteSingleCoil 0x05 ///< Modbus function 0x05 Write Single Coil +#define ku8MBWriteMultipleCoils 0x0F ///< Modbus function 0x0F Write Multiple Coils + +// Modbus function codes for 16 bit access +#define ku8MBReadHoldingRegisters 0x03 ///< Modbus function 0x03 Read Holding Registers +#define ku8MBReadInputRegisters 0x04 ///< Modbus function 0x04 Read Input Registers +#define ku8MBWriteSingleRegister 0x06 ///< Modbus function 0x06 Write Single Register +#define ku8MBWriteMultipleRegisters 0x10 ///< Modbus function 0x10 Write Multiple Registers +#define ku8MBMaskWriteRegister 0x16 ///< Modbus function 0x16 Mask Write Register +#define ku8MBReadWriteMultipleRegisters 0x17 ///< Modbus function 0x17 Read Write Multiple Registers +#define ku8MBLinkTestOmronMX2Only 0x08 ///< Modbus function 0x08 Тест связи с инвертром Omron MX2 функция только для него + +#define MX2_STATE 0x0003 // (2 bytes) Status of the inverter + + // ModbusQuery 0: read registers + ModbusQuery[0].u8id = SlaveModbusAdd; // slave address + ModbusQuery[0].u8fct = ku8MBReadHoldingRegisters; // function code (this one is registers read) + ModbusQuery[0].u16RegAdd = 0x0; // start address in slave + ModbusQuery[0].u16CoilsNo = 2; // number of elements (coils or registers) to read + ModbusQuery[0].au16reg = ModbusSlaveRegisters; // pointer to a memory array in the CONTROLLINO + + ModbusSlaveRegisters[0] = 0; + ModbusSlaveRegisters[1] = 0; + ModbusSlaveRegisters[2] = 0; + ModbusSlaveRegisters[3] = 2; + + + // ModbusSlaveRegisters[0] = 1234; + + // ModbusQuery 1: write a single register + ModbusQuery[1].u8id = SlaveModbusAdd; // slave address + ModbusQuery[1].u8fct = ku8MBReadHoldingRegisters; // function code (this one is write a single register) + ModbusQuery[1].u16RegAdd = 0; // start address in slave + ModbusQuery[1].u16CoilsNo = 4; // number of elements (coils or registers) to write + ModbusQuery[1].au16reg = ModbusSlaveRegisters + 4; // pointer to a memory array in the CONTROLLINO + + // ModbusSlaveRegisters[4] = 1234; // initial value for the relays + + ControllinoModbusMaster.begin(19200); // baud-rate at 19200 + ControllinoModbusMaster.setTimeOut(5000); // if there is no answer in 5000 ms, roll over + + WaitingTime = millis() + 1000; + myState = 0; + currentQuery = 0; + + //Controllino_RS485RxEnable(); + //Controllino_RS485TxEnable(); + + delay(5000); +} + +void loop() +{ + switch (myState) + { + case 0: + if (millis() > WaitingTime) + myState++; // wait state + break; + case 1: + Serial.print("---- Sending query "); + Serial.print(currentQuery); + Serial.println(" -------------"); + ControllinoModbusMaster.query(ModbusQuery[currentQuery]); // send query (only once) + myState++; + currentQuery++; + if (currentQuery == 2) + { + currentQuery = 0; + } + break; + case 2: + ControllinoModbusMaster.poll(); // check incoming messages + if (ControllinoModbusMaster.getState() == COM_IDLE) + { + // response from the slave was received + myState = 0; + WaitingTime = millis() + 1000; + // debug printout + if (currentQuery == 0) + { + // registers write was proceed + Serial.println("---------- WRITE RESPONSE RECEIVED ----"); + Serial.println(""); + } + if (currentQuery == 1) + { + // registers read was proceed + Serial.println("---------- READ RESPONSE RECEIVED ----"); + Serial.print("Slave "); + + Serial.print(SlaveModbusAdd, DEC); + Serial.print(" ADC0: 0x"); + Serial.print(ModbusSlaveRegisters[0], HEX); + Serial.print(" , Digital0: "); + Serial.print(ModbusSlaveRegisters[1], HEX); + Serial.print(" , ModbusCounterIn: "); + Serial.print(ModbusSlaveRegisters[2], DEC); + Serial.print(" , ModbusCounterOut: "); + Serial.println(ModbusSlaveRegisters[3], DEC); + Serial.println("-------------------------------------"); + Serial.println(""); + } + } + break; + } +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest2/ModbusRtu.h b/extrusion/lydia-print-head-v1/firmware/test/mtest2/ModbusRtu.h new file mode 100644 index 0000000..1f02440 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest2/ModbusRtu.h @@ -0,0 +1,1504 @@ +/** + * @file ModbusRtu.h + * @version 1.21 (modified by CONTROLLINO team) + * @date 2016.02.21 (2017.03.30) + * @author Samuel Marco i Armengol (Thank you, Samuel!) + * @contact sammarcoarmengol@gmail.com + * @contribution Helium6072 + * + * @description + * Arduino library for communicating with Modbus devices + * over RS232/USB/485 via RTU protocol. + * + * Further information: + * http://modbus.org/ + * http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf + * + * @license + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version + * 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @defgroup setup Modbus Object Instantiation/Initialization + * @defgroup loop Modbus Object Management + * @defgroup buffer Modbus Buffer Management + * @defgroup discrete Modbus Function Codes for Discrete Coils/Inputs + * @defgroup register Modbus Function Codes for Holding/Input Registers + * + */ + +#include +#include "Arduino.h" +#include "Print.h" +#include + +#define RS485_PIN_DE 0b01000000 +#define RS485_PIN_RE 0b00100000 +#define RS485_DIR_REG DDRJ +#define RS485_PORT_REG PORTJ +#define RS485_CLEAR_DE RS485_PORT_REG &= ~RS485_PIN_DE +#define RS485_CLEAR_RE RS485_PORT_REG &= ~RS485_PIN_RE +#define RS485_SET_DE RS485_PORT_REG |= RS485_PIN_DE +#define RS485_SET_RE RS485_PORT_REG |= RS485_PIN_RE + +/** + * @struct modbus_t + * @brief + * Master query structure: + * This includes all the necessary fields to make the Master generate a Modbus query. + * A Master may keep several of these structures and send them cyclically or + * use them according to program needs. + */ +typedef struct +{ + uint8_t u8id; /*!< Slave address between 1 and 247. 0 means broadcast */ + uint8_t u8fct; /*!< Function code: 1, 2, 3, 4, 5, 6, 15 or 16 */ + uint16_t u16RegAdd; /*!< Address of the first register to access at slave/s */ + uint16_t u16CoilsNo; /*!< Number of coils or registers to access */ + uint16_t *au16reg; /*!< Pointer to memory image in master */ +} modbus_t; + +enum +{ + RESPONSE_SIZE = 6, + EXCEPTION_SIZE = 3, + CHECKSUM_SIZE = 2 +}; + +/** + * @enum MESSAGE + * @brief + * Indexes to telegram frame positions + */ +enum MESSAGE +{ + ID = 0, //!< ID field + FUNC, //!< Function code position + ADD_HI, //!< Address high byte + ADD_LO, //!< Address low byte + NB_HI, //!< Number of coils or registers high byte + NB_LO, //!< Number of coils or registers low byte + BYTE_CNT //!< byte counter +}; + +/** + * @enum MB_FC + * @brief + * Modbus function codes summary. + * These are the implement function codes either for Master or for Slave. + * + * @see also fctsupported + * @see also modbus_t + */ +enum MB_FC +{ + MB_FC_NONE = 0, /*!< null operator */ + MB_FC_READ_COILS = 1, /*!< FCT=1 -> read coils or digital outputs */ + MB_FC_READ_DISCRETE_INPUT = 2, /*!< FCT=2 -> read digital inputs */ + MB_FC_READ_REGISTERS = 3, /*!< FCT=3 -> read registers or analog outputs */ + MB_FC_READ_INPUT_REGISTER = 4, /*!< FCT=4 -> read analog inputs */ + MB_FC_WRITE_COIL = 5, /*!< FCT=5 -> write single coil or output */ + MB_FC_WRITE_REGISTER = 6, /*!< FCT=6 -> write single register */ + MB_FC_WRITE_MULTIPLE_COILS = 15, /*!< FCT=15 -> write multiple coils or outputs */ + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 /*!< FCT=16 -> write multiple registers */ +}; + +enum COM_STATES +{ + COM_IDLE = 0, + COM_WAITING = 1 + +}; + +enum ERR_LIST +{ + ERR_NOT_MASTER = -1, + ERR_POLLING = -2, + ERR_BUFF_OVERFLOW = -3, + ERR_BAD_CRC = -4, + ERR_EXCEPTION = -5 +}; + +enum +{ + NO_REPLY = 255, + EXC_FUNC_CODE = 1, + EXC_ADDR_RANGE = 2, + EXC_REGS_QUANT = 3, + EXC_EXECUTE = 4 +}; + +const unsigned char fctsupported[] = + { + MB_FC_READ_COILS, + MB_FC_READ_DISCRETE_INPUT, + MB_FC_READ_REGISTERS, + MB_FC_READ_INPUT_REGISTER, + MB_FC_WRITE_COIL, + MB_FC_WRITE_REGISTER, + MB_FC_WRITE_MULTIPLE_COILS, + MB_FC_WRITE_MULTIPLE_REGISTERS}; + +#define T35 5 +#define MAX_BUFFER 64 //!< maximum size for the communication buffer in bytes + +/** + * @class Modbus + * @brief + * Arduino class library for communicating with Modbus devices over + * USB/RS232/485 (via RTU protocol). + */ +class Modbus +{ +private: + HardwareSerial *port; //!< Pointer to Serial class object + SoftwareSerial *softPort; //!< Pointer to SoftwareSerial class object + uint8_t u8id; //!< 0=master, 1..247=slave number + uint8_t u8serno; //!< serial port: 0-Serial, 1..3-Serial1..Serial3; 4: use software serial + uint8_t u8txenpin; //!< flow control pin: 0=USB or RS-232 mode, >0=RS-485 mode + uint8_t u8state; + uint8_t u8lastError; + uint8_t au8Buffer[MAX_BUFFER]; + uint8_t u8BufferSize; + uint8_t u8lastRec; + uint16_t *au16regs; + uint16_t u16InCnt, u16OutCnt, u16errCnt; + uint16_t u16timeOut; + uint32_t u32time, u32timeOut; + uint8_t u8regsize; + + void init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + void init(uint8_t u8id); + void sendTxBuffer(); + int8_t getRxBuffer(); + uint16_t calcCRC(uint8_t u8length); + uint8_t validateAnswer(); + uint8_t validateRequest(); + void get_FC1(); + void get_FC3(); + int8_t process_FC1(uint16_t *regs, uint8_t u8size); + int8_t process_FC3(uint16_t *regs, uint8_t u8size); + int8_t process_FC5(uint16_t *regs, uint8_t u8size); + int8_t process_FC6(uint16_t *regs, uint8_t u8size); + int8_t process_FC15(uint16_t *regs, uint8_t u8size); + int8_t process_FC16(uint16_t *regs, uint8_t u8size); + void buildException(uint8_t u8exception); // build exception message + +public: + Modbus(); + Modbus(uint8_t u8id, uint8_t u8serno); + Modbus(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + Modbus(uint8_t u8id); + void begin(long u32speed); + void begin(SoftwareSerial *sPort, long u32speed); + void begin(long u32speed, uint8_t u8config); + void begin(); + void setTimeOut(uint16_t u16timeout); //!begin(u32speed); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the software serial port using specified baud rate and SoftwareSerial object. + * Call once class has been instantiated, typically within setup(). + * + * @param speed *softPort, pointer to SoftwareSerial class object + * @param speed baud rate, in standard increments (300..115200) + * @ingroup setup + */ +void Modbus::begin(SoftwareSerial *sPort, long u32speed) +{ + + softPort = sPort; + + softPort->begin(u32speed); + + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while (softPort->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the serial port using specified baud rate. + * Call once class has been instantiated, typically within setup(). + * + * @see http://arduino.cc/en/Serial/Begin#.Uy4CJ6aKlHY + * @param speed baud rate, in standard increments (300..115200) + * @param config data frame settings (data length, parity and stop bits) + * @ingroup setup + */ +void Modbus::begin(long u32speed, uint8_t u8config) +{ + + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + port = &Serial1; + break; +#endif + +#if defined(UBRR2H) + case 2: + port = &Serial2; + break; +#endif + +#if defined(UBRR3H) + case 3: + port = &Serial3; + break; +#endif + case 0: + default: + port = &Serial; + break; + } + + port->begin(u32speed, u8config); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + // pinMode(u8txenpin, OUTPUT); + // digitalWrite(u8txenpin, LOW); + } + + while (port->read() >= 0) + ; + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize default class object. + * + * Sets up the serial port using 19200 baud. + * Call once class has been instantiated, typically within setup(). + * + * @overload Modbus::begin(uint16_t u16BaudRate) + * @ingroup setup + */ +void Modbus::begin() +{ + begin(19200); +} + +/** + * @brief + * Method to write a new slave ID address + * + * @param u8id new slave address between 1 and 247 + * @ingroup setup + */ +void Modbus::setID(uint8_t u8id) +{ + if ((u8id != 0) && (u8id <= 247)) + { + this->u8id = u8id; + } +} + +/** + * @brief + * Method to read current slave ID address + * + * @return u8id current slave address between 1 and 247 + * @ingroup setup + */ +uint8_t Modbus::getID() +{ + return this->u8id; +} + +/** + * @brief + * Initialize time-out parameter + * + * Call once class has been instantiated, typically within setup(). + * The time-out timer is reset each time that there is a successful communication + * between Master and Slave. It works for both. + * + * @param time-out value (ms) + * @ingroup setup + */ +void Modbus::setTimeOut(uint16_t u16timeOut) +{ + this->u16timeOut = u16timeOut; +} + +/** + * @brief + * Return communication Watchdog state. + * It could be usefull to reset outputs if the watchdog is fired. + * + * @return TRUE if millis() > u32timeOut + * @ingroup loop + */ +boolean Modbus::getTimeOutState() +{ + return (millis() > u32timeOut); +} + +/** + * @brief + * Get input messages counter value + * This can be useful to diagnose communication + * + * @return input messages counter + * @ingroup buffer + */ +uint16_t Modbus::getInCnt() +{ + return u16InCnt; +} + +/** + * @brief + * Get transmitted messages counter value + * This can be useful to diagnose communication + * + * @return transmitted messages counter + * @ingroup buffer + */ +uint16_t Modbus::getOutCnt() +{ + return u16OutCnt; +} + +/** + * @brief + * Get errors counter value + * This can be useful to diagnose communication + * + * @return errors counter + * @ingroup buffer + */ +uint16_t Modbus::getErrCnt() +{ + return u16errCnt; +} + +/** + * Get modbus master state + * + * @return = 0 IDLE, = 1 WAITING FOR ANSWER + * @ingroup buffer + */ +uint8_t Modbus::getState() +{ + return u8state; +} + +/** + * Get the last error in the protocol processor + * + * @returnreturn NO_REPLY = 255 Time-out + * @return EXC_FUNC_CODE = 1 Function code not available + * @return EXC_ADDR_RANGE = 2 Address beyond available space for Modbus registers + * @return EXC_REGS_QUANT = 3 Coils or registers number beyond the available space + * @ingroup buffer + */ +uint8_t Modbus::getLastError() +{ + return u8lastError; +} + +/** + * @brief + * *** Only Modbus Master *** + * Generate a query to an slave with a modbus_t telegram structure + * The Master must be in COM_IDLE mode. After it, its state would be COM_WAITING. + * This method has to be called only in loop() section. + * + * @see modbus_t + * @param modbus_t modbus telegram structure (id, fct, ...) + * @ingroup loop + * @todo finish function 15 + */ +int8_t Modbus::query(modbus_t telegram) +{ + + uint8_t u8regsno, u8bytesno; + if (u8id != 0) + return -2; + if (u8state != COM_IDLE) + return -1; + + if ((telegram.u8id == 0) || (telegram.u8id > 247)) + return -3; + + au16regs = telegram.au16reg; + + // telegram header + au8Buffer[ID] = telegram.u8id; + au8Buffer[FUNC] = telegram.u8fct; + au8Buffer[ADD_HI] = highByte(telegram.u16RegAdd); + au8Buffer[ADD_LO] = lowByte(telegram.u16RegAdd); + + switch (telegram.u8fct) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + u8BufferSize = 6; + break; + case MB_FC_WRITE_COIL: + au8Buffer[NB_HI] = ((au16regs[0] > 0) ? 0xff : 0); + au8Buffer[NB_LO] = 0; + u8BufferSize = 6; + break; + case MB_FC_WRITE_REGISTER: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + u8BufferSize = 6; + break; + case MB_FC_WRITE_MULTIPLE_COILS: // TODO: implement "sending coils" + u8regsno = telegram.u16CoilsNo / 16; + u8bytesno = u8regsno * 2; + if ((telegram.u16CoilsNo % 16) != 0) + { + u8bytesno++; + u8regsno++; + } + + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = u8bytesno; + u8BufferSize = 7; + + u8regsno = u8bytesno = 0; // now auxiliary registers + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + } + break; + + case MB_FC_WRITE_MULTIPLE_REGISTERS: + au8Buffer[NB_HI] = highByte(telegram.u16CoilsNo); + au8Buffer[NB_LO] = lowByte(telegram.u16CoilsNo); + au8Buffer[NB_LO + 1] = (uint8_t)(telegram.u16CoilsNo * 2); + u8BufferSize = 7; + + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + au8Buffer[u8BufferSize] = highByte(au16regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(au16regs[i]); + u8BufferSize++; + } + break; + } + + sendTxBuffer(); + u8state = COM_WAITING; + return 0; +} + +/** + * @brief *** Only for Modbus Master *** + * This method checks if there is any incoming answer if pending. + * If there is no answer, it would change Master state to COM_IDLE. + * This method must be called only at loop section. + * Avoid any delay() function. + * + * Any incoming data would be redirected to au16regs pointer, + * as defined in its modbus_t query telegram. + * + * @params nothing + * @return errors counter + * @ingroup loop + */ +int8_t Modbus::poll() +{ + // check if there is any incoming frame + uint8_t u8current; + if (u8serno < 4) + { + u8current = port->available(); + } + else + { + u8current = softPort->available(); + } + + if (millis() > u32timeOut) + { + u8state = COM_IDLE; + u8lastError = NO_REPLY; + u16errCnt++; + return 0; + } + + if (u8current == 0) + { + // Serial.println("no port"); + return 0; + } + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + // Serial.println("t35"); + return 0; + } + if (millis() < u32time) + { + //Serial.println("bel"); + return 0; + }; + + // transfer Serial buffer frame to auBuffer + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + if (i8state < 7) + { + u8state = COM_IDLE; + u16errCnt++; + return i8state; + } + + // validate message: id, CRC, FCT, exception + uint8_t u8exception = validateAnswer(); + if (u8exception != 0) + { + Serial.println("exception"); + Serial.println(u8exception); + u8state = COM_IDLE; + return u8exception; + } + + // process answer + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + // call get_FC1 to transfer the incoming message to au16regs buffer + get_FC1(); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + // call get_FC3 to transfer the incoming message to au16regs buffer + get_FC3(); + break; + case MB_FC_WRITE_COIL: + case MB_FC_WRITE_REGISTER: + case MB_FC_WRITE_MULTIPLE_COILS: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + // nothing to do + break; + default: + break; + } + u8state = COM_IDLE; + return u8BufferSize; +} + +/** + * @brief + * *** Only for Modbus Slave *** + * This method checks if there is any incoming query + * Afterwards, it would shoot a validation routine plus a register query + * Avoid any delay() function !!!! + * After a successful frame between the Master and the Slave, the time-out timer is reset. + * + * @param *regs register table for communication exchange + * @param u8size size of the register table + * @return 0 if no query, 1..4 if communication error, >4 if correct query processed + * @ingroup loop + */ +int8_t Modbus::poll(uint16_t *regs, uint8_t u8size) +{ + + au16regs = regs; + u8regsize = u8size; + uint8_t u8current; + + // check if there is any incoming frame + if (u8serno < 4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (u8current == 0) + return 0; + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) + return 0; + + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + u8lastError = i8state; + if (i8state < 7) + return i8state; + + // check slave id + if (au8Buffer[ID] != u8id) + return 0; + + // validate message: CRC, FCT, address and size + uint8_t u8exception = validateRequest(); + if (u8exception > 0) + { + if (u8exception != NO_REPLY) + { + buildException(u8exception); + sendTxBuffer(); + } + u8lastError = u8exception; + return u8exception; + } + + u32timeOut = millis() + long(u16timeOut); + u8lastError = 0; + + // process message + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + return process_FC1(regs, u8size); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS: + return process_FC3(regs, u8size); + break; + case MB_FC_WRITE_COIL: + return process_FC5(regs, u8size); + break; + case MB_FC_WRITE_REGISTER: + return process_FC6(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_COILS: + return process_FC15(regs, u8size); + break; + case MB_FC_WRITE_MULTIPLE_REGISTERS: + return process_FC16(regs, u8size); + break; + default: + break; + } + return i8state; +} + +/* _____PRIVATE FUNCTIONS_____________________________________________________ */ + +void Modbus::init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin) +{ + this->u8id = u8id; + this->u8serno = (u8serno > 3) ? 0 : u8serno; + + // this->u8txenpin = u8txenpin; + this->u8txenpin = 2; // Ignore input parameter u8txenpin and hardcode 2 for compatibility + + this->u16timeOut = 1000; +} + +void Modbus::init(uint8_t u8id) +{ + this->u8id = u8id; + this->u8serno = 4; + this->u8txenpin = 0; + this->u16timeOut = 1000; +} + +/** + * @brief + * This method moves Serial buffer data to the Modbus au8Buffer. + * + * @return buffer size if OK, ERR_BUFF_OVERFLOW if u8BufferSize >= MAX_BUFFER + * @ingroup buffer + */ +int8_t Modbus::getRxBuffer() +{ + boolean bBuffOverflow = false; + + if (u8txenpin > 1) + { + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + + u8BufferSize = 0; + if (u8serno < 4) + while (port->available()) + { + au8Buffer[u8BufferSize] = port->read(); + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + else + while (softPort->available()) + { + au8Buffer[u8BufferSize] = softPort->read(); + u8BufferSize++; + + if (u8BufferSize >= MAX_BUFFER) + bBuffOverflow = true; + } + u16InCnt++; + + if (bBuffOverflow) + { + u16errCnt++; + return ERR_BUFF_OVERFLOW; + } + return u8BufferSize; +} + +/** + * @brief + * This method transmits au8Buffer to Serial line. + * Only if u8txenpin != 0, there is a flow handling in order to keep + * the RS485 transceiver in output state as long as the message is being sent. + * This is done with UCSRxA register. + * The CRC is appended to the buffer before starting to send it. + * + * @param nothing + * @return nothing + * @ingroup buffer + */ +void Modbus::sendTxBuffer() +{ + uint8_t i = 0; + + // append CRC to message + uint16_t u16crc = calcCRC(u8BufferSize); + + /* + Serial.print("---- calc CRC : HEX : "); + Serial.print(u16crc, DEC); + Serial.print(" - HEX : "); + Serial.print(u16crc, HEX); + Serial.print(" - "); + Serial.print(u8BufferSize); + Serial.print("\n"); + */ + + au8Buffer[u8BufferSize] = u16crc >> 8; + u8BufferSize++; + au8Buffer[u8BufferSize] = u16crc & 0x00ff; + u8BufferSize++; + + Serial.print("Send Hex : "); + for (int i = 0; i < 8; i++) + { + Serial.print(au8Buffer[i], HEX); + Serial.print(" : "); + } + Serial.println("--------------- \n"); + + // set RS485 transceiver to transmit mode + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + UCSR1A = UCSR1A | (1 << TXC1); + break; +#endif + +#if defined(UBRR2H) + case 2: + UCSR2A = UCSR2A | (1 << TXC2); + break; +#endif + +#if defined(UBRR3H) + case 3: + UCSR3A = UCSR3A | (1 << TXC3); + break; +#endif + case 0: + default: + UCSR0A = UCSR0A | (1 << TXC0); + break; + } + RS485_SET_DE; + RS485_SET_RE; + //digitalWrite( u8txenpin, HIGH ); + } + + // transfer buffer to serial line + if (u8serno < 4) + { + port->write(au8Buffer, u8BufferSize); + + } + else + { + softPort->write(au8Buffer, u8BufferSize); + } + // keep RS485 transceiver in transmit mode as long as sending + if (u8txenpin > 1) + { + switch (u8serno) + { +#if defined(UBRR1H) + case 1: + while (!(UCSR1A & (1 << TXC1))) + ; + break; +#endif + +#if defined(UBRR2H) + case 2: + while (!(UCSR2A & (1 << TXC2))) + ; + break; +#endif + +#if defined(UBRR3H) + case 3: + while (!(UCSR3A & (1 << TXC3))) + ; + break; +#endif + case 0: + default: + while (!(UCSR0A & (1 << TXC0))) + ; + break; + } + // return RS485 transceiver to receive mode + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + if (u8serno < 4) + while (port->read() >= 0) + ; + else + while (softPort->read() >= 0) + ; + + u8BufferSize = 0; + + // set time-out for master + u32timeOut = millis() + (unsigned long)u16timeOut; + + // increase message counter + u16OutCnt++; +} + +/** + * @brief + * This method calculates CRC + * + * @return uint16_t calculated CRC value for the message + * @ingroup buffer + */ +uint16_t Modbus::calcCRC(uint8_t u8length) +{ + unsigned int temp, temp2, flag; + temp = 0xFFFF; + for (unsigned char i = 0; i < u8length; i++) + { + temp = temp ^ au8Buffer[i]; + // Serial.println(au8Buffer[i], DEC); + for (unsigned char j = 1; j <= 8; j++) + { + flag = temp & 0x0001; + temp >>= 1; + if (flag) + temp ^= 0xA001; + } + } + // Reverse byte order. + temp2 = temp >> 8; + temp = (temp << 8) | temp2; + temp &= 0xFFFF; + // the returned value is already swapped + // crcLo byte is first & crcHi byte is last + return temp; +} + +/** + * @brief + * This method validates slave incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateRequest() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + // check start address & nb range + uint16_t u16regs = 0; + uint8_t u8regs; + switch (au8Buffer[FUNC]) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_WRITE_MULTIPLE_COILS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_COIL: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]) / 16; + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_REGISTER: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_WRITE_MULTIPLE_REGISTERS: + u16regs = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + u16regs += word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + u8regs = (uint8_t)u16regs; + if (u8regs > u8regsize) + return EXC_ADDR_RANGE; + break; + } + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method validates master incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateAnswer() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if (calcCRC(u8BufferSize - 2) != u16MsgCRC) + { + u16errCnt++; + return NO_REPLY; + } + + // check exception + if ((au8Buffer[FUNC] & 0x80) != 0) + { + u16errCnt++; + return ERR_EXCEPTION; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i < sizeof(fctsupported); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt++; + return EXC_FUNC_CODE; + } + + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method builds an exception message + * + * @ingroup buffer + */ +void Modbus::buildException(uint8_t u8exception) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + + au8Buffer[ID] = u8id; + au8Buffer[FUNC] = u8func + 0x80; + au8Buffer[2] = u8exception; + u8BufferSize = EXCEPTION_SIZE; +} + +/** + * This method processes functions 1 & 2 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + * TODO: finish its implementation + */ +void Modbus::get_FC1() +{ + uint8_t u8byte, i; + u8byte = 0; + + // for (i=0; i< au8Buffer[ 2 ] /2; i++) { + // au16regs[ i ] = word( + // au8Buffer[ u8byte ], + // au8Buffer[ u8byte +1 ]); + // u8byte += 2; + // } +} + +/** + * This method processes functions 3 & 4 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + */ +void Modbus::get_FC3() +{ + uint8_t u8byte, i; + u8byte = 3; + + for (i = 0; i < au8Buffer[2] / 2; i++) + { + au16regs[i] = word( + au8Buffer[u8byte], + au8Buffer[u8byte + 1]); + u8byte += 2; + } +} + +/** + * @brief + * This method processes functions 1 & 2 + * This method reads a bit array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC1(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8bytesno, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // put the number of bytes in the outcoming message + u8bytesno = (uint8_t)(u16Coilno / 8); + if (u16Coilno % 8 != 0) + u8bytesno++; + au8Buffer[ADD_HI] = u8bytesno; + u8BufferSize = ADD_LO; + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bitWrite( + au8Buffer[u8BufferSize], + u8bitsno, + bitRead(regs[u8currentRegister], u8currentBit)); + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8BufferSize++; + } + } + + // send outcoming message + if (u16Coilno % 8 != 0) + u8BufferSize++; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes functions 3 & 4 + * This method reads a word array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC3(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8StartAdd = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8regsno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + uint8_t u8CopyBufferSize; + uint8_t i; + + au8Buffer[2] = u8regsno * 2; + u8BufferSize = 3; + + for (i = u8StartAdd; i < u8StartAdd + u8regsno; i++) + { + au8Buffer[u8BufferSize] = highByte(regs[i]); + u8BufferSize++; + au8Buffer[u8BufferSize] = lowByte(regs[i]); + u8BufferSize++; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 5 + * This method writes a value assigned by the master to a single bit + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC5(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit; + uint8_t u8CopyBufferSize; + uint16_t u16coil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + + // point to the register and its bit + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + // write to coil + bitWrite( + regs[u8currentRegister], + u8currentBit, + au8Buffer[NB_HI] == 0xff); + + // send answer to master + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 6 + * This method writes a value assigned by the master to a single word + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC6(uint16_t *regs, uint8_t u8size) +{ + + uint8_t u8add = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint8_t u8CopyBufferSize; + uint16_t u16val = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + regs[u8add] = u16val; + + // keep the same header + u8BufferSize = RESPONSE_SIZE; + + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 15 + * This method writes a bit array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC15(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8currentRegister, u8currentBit, u8frameByte, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + boolean bTemp; + + // get the first and last coil from the message + uint16_t u16StartCoil = word(au8Buffer[ADD_HI], au8Buffer[ADD_LO]); + uint16_t u16Coilno = word(au8Buffer[NB_HI], au8Buffer[NB_LO]); + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + u8frameByte = 7; + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t)(u16coil / 16); + u8currentBit = (uint8_t)(u16coil % 16); + + bTemp = bitRead( + au8Buffer[u8frameByte], + u8bitsno); + + bitWrite( + regs[u8currentRegister], + u8currentBit, + bTemp); + + u8bitsno++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8frameByte++; + } + } + + // send outcoming message + // it's just a copy of the incomping frame until 6th byte + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 16 + * This method writes a word array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC16(uint16_t *regs, uint8_t u8size) +{ + uint8_t u8func = au8Buffer[FUNC]; // get the original FUNC code + uint8_t u8StartAdd = au8Buffer[ADD_HI] << 8 | au8Buffer[ADD_LO]; + uint8_t u8regsno = au8Buffer[NB_HI] << 8 | au8Buffer[NB_LO]; + uint8_t u8CopyBufferSize; + uint8_t i; + uint16_t temp; + + // build header + au8Buffer[NB_HI] = 0; + au8Buffer[NB_LO] = u8regsno; + u8BufferSize = RESPONSE_SIZE; + + // write registers + for (i = 0; i < u8regsno; i++) + { + temp = word( + au8Buffer[(BYTE_CNT + 1) + i * 2], + au8Buffer[(BYTE_CNT + 2) + i * 2]); + + regs[u8StartAdd + i] = temp; + } + u8CopyBufferSize = u8BufferSize + 2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest2/OmronE5.h b/extrusion/lydia-print-head-v1/firmware/test/mtest2/OmronE5.h new file mode 100644 index 0000000..7b4857d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest2/OmronE5.h @@ -0,0 +1,332 @@ +#ifndef OMRON_E5_H +#define OMRON_E5_H + +// Omron EJ5 Modbus Registers & Coils + +#define OR_BIT(A) (A >> 1) +#define OR_WORD(A) (A << 4) + +bool OR_E5_STATUS_BIT(unsigned int high, unsigned int low, byte bit) +{ + // shift down all for 16bit platforms only + if (bit <= 16) + { + return (low & (1 << 8)); + } + + return (OR_WORD(high) & (1 << (OR_BIT(bit)))); +} + +// Status Bit -1 , see h175_e5_c_communications_manual_en.pdf::3-24 +enum OR_E5_STATUS_1 +{ + // Lower Word + + OR_E5_S1_Heater_OverCurrent = 0, + OR_E5_S1_Heater_CurrentHold = 1, + OR_E5_S1_AD_ConverterError = 2, + OR_E5_S1_HS_Alarm = 3, + OR_E5_S1_RSP_InputError = 4, + OR_E5_S1_InputError = 6, + OR_E5_S1_PotentiometerInnputError = 7, + OR_E5_S1_Control_OutputOpenOutput = 8, + OR_E5_S1_Control_OutputCloseOutput = 9, + OR_E5_S1_HBAlarmCT1 = 10, + OR_E5_S1_HBAlarmCT2 = 11, + OR_E5_S1_Alarm1 = 12, + OR_E5_S1_Alarm2 = 13, + OR_E5_S1_Alarm3 = 14, + OR_E5_S1_ProgramEndOutput = 15, + + // Upper Word + + OR_E5_S1_EventInput1 = 16, + OR_E5_S1_EventInput2 = 17, + OR_E5_S1_EventInput3 = 18, + OR_E5_S1_EventInput4 = 19, + OR_E5_S1_WriteMode = 20, + OR_E5_S1_NonVolatileMemory = 21, + OR_E5_S1_SetupArea = 22, + OR_E5_S1_ATExcecute = 23, + OR_E5_S1_RunStop = 24, + OR_E5_S1_ComWrite = 25, + OR_E5_S1_AutoManualSwitch = 26, + OR_E5_S1_ProgramStart = 27, + OR_E5_S1_HeaterOverCurrentCT2 = 28, + OR_E5_S1_HeaterCurrentHoldCT2 = 29, + OR_E5_S1_HSAlarmCT2 = 31 +}; + +// Status Bit - 2 , see h175_e5_c_communications_manual_en.pdf::3-25 + +enum OR_E5_STATUS_2 +{ + // Lower Word + + OR_E5_S2_WorkBit1 = 0, + OR_E5_S2_WorkBit2 = 1, + OR_E5_S2_WorkBit3 = 2, + OR_E5_S2_WorkBit4 = 3, + OR_E5_S2_WorkBit5 = 4, + OR_E5_S2_WorkBit6 = 5, + OR_E5_S2_WorkBit7 = 6, + OR_E5_S2_WorkBit8 = 7, + + // Upper Word + + OR_E5_S2_EventInput5 = 16, + OR_E5_S2_EventInput6 = 17, + OR_E5_S2_Inverse = 20, + OR_E5_S2_SPRamp = 21, + OR_E5_S2_SPMode = 27, + OR_E5_S2_Alarm4 = 28 +}; + +// Variable Area - Settings Range (0x06s) - 2 byte mode, +// see h175_e5_c_communications_manual_en.pdf::5-1 + +enum OR_E5_SWR +{ + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV = 0x2000, + + // Refer to 5-2 Status for details (see @OR_E5_STATUS_1 and @OR_E5_STATUS_2) + OR_E5_SWR_STATUS = 0x2001, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP = 0x2002, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor = 0x2003, + + // MV Monitor (Heating) + // Standard: 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling: 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorHeating = 0x2004, + + // MV Monitor (Cooling) + // 0x00000000 to 0x0000041A (0.0 to 105.0) + OR_E5_SWR_MVMonitorCooling = 0x2005, + + // Set Point - SP lower limit to SP upper limit + OR_E5_SWR_SP_LIMIT = 0x2103, + + // Alarm Value 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1 = 0x2104, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_UL = 0x2105, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_1_LL = 0x2106, + + // Alarm Value 2 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2 = 0x2107, + + // Alarm Value - Upper Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_UL = 0x2108, + + // Alarm Value - Lower Limit 1 + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_ALARM_2_LL = 0x2109, + + //Temperature: Use the specified range for each sensor. + // Analog: Scaling lower limit − 5% FS to Scaling upper limit + 5% FS + OR_E5_SWR_PV2 = 0x2402, + + // Internal Set Point(see appendix *1) - SP lower limit to SP upper limit + OR_E5_SWR_ISP2 = 0x2403, + + // Multi SP No. Monitor, 0x00000000 to 0x00000007 (0 to 7) + OR_E5_SWR_MSMON = 0x2404, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEX = 0x2406, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the leftmost 16 bits are read. + OR_E5_SWR_STATUSEXL = 0x2407, + + // Status, + // - Not displayed on the Controller display. + // - In 2-byte mode, the rightmost 16 bits are read. + OR_E5_SWR_STATUSEXR = 0x2408, + + // Decimal Point Monitor, + // 0x00000000 to 0x00000003 (0 to 3) + OR_E5_SWR_DECMON = 0x2410, + + // Set Point () + // SP lower limit to SP upper limit + OR_E5_SWR_SP = 0x2601, + + // Remote Set Point Monitor + // - Remote SP lower limit −10% FS to Remote SP upper limit +10% FS + OR_E5_SWR_SP_EX_MON = 0x2602, + + // Heater Current 1 Value Monitor, 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_HeaterCurrentValue1_Monitor2 = 0x2604, + + // Valve Opening Monitor, 0xFFFFFF9C to 0x0000044C (−10.0 to 110.0) + OR_E5_SWR_VALVE_OPENING_MON = 0x2607, + + // Proportional Band (Cooling), 0x00000001 to 0x0000270F (0.1 to 999.9) + OR_E5_SWR_PRO_BAND = 0x2701, + + // Integral Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_IT_COOLING = 0x2702, + + // Derivative Time (Cooling) 0x00000000 to 0x0000270F + // (0 to 9999: Integral/derivative time unit is 1 s.) + // (0.0 to 999.9: Integral/derivative time unit is 0.1 s.) + OR_E5_SWR_D_COOLING = 0x2703, + + // Dead Band 0xFFFFF831 to 0x0000270F + // (−199.9 to 999.9 for temperature input) + // (−19.99 to 99.99 for analog input) + OR_E5_SWR_DEADBAND = 0x2704, + + // Manual Reset Value, + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_MANUAL_RESET_VALUE = 0x2705, + + // Hysteresis (Heating) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS = 0x2706, + + // Hysteresis (Cooling) + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for temperature input) + // (0.01 to 99.99 for analog input) + OR_E5_SWR_HYSTERESIS_COOLING = 0x2707, + + // Control Period (Heating) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_HEATING = 0x2708, + + // Control Period (Cooling) + // 0xFFFFFFFE (−2): 0.1 s + // 0xFFFFFFFF (−1): 0.2 s + // 0x00000000 (0): 0.5 s + // 0x00000001 to 0x00000063 (1 to 99) + OR_E5_SWR_CONTROL_PERIOD_COOLING = 0x2709, + + // Position Proportional Dead Band + // 0x00000001 to 0x00000064 (0.1 to 10.0) + OR_E5_SWR_POSITION_PROPORTIONAL_DEAD_BAND = 0x270A, + + // Open/Close Hysteresis + // 0x00000001 to 0x000000C8 (0.1 to 20.0) + OR_E5_SWR_OPEN_CLOSE_HYSTERESIS = 0x270B, + + // SP Ramp Time Unit 0x00000000 (0): EU/second + // 0x00000001 (1): EU/minute + // 0x00000002 (2): EU/hour + OR_E5_SWR_SP_RAMP_UNIT = 0x270C, + + // SP Ramp Set Value 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_RAMP_SET_VALUE = 0x270D, + + // SP Ramp Fall Value + // 0xFFFFFFFF (−1): Same (Same as SP Ramp Set Value.) + // 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SP_FALL_VALUE = 0x270E, + + // MV at Stop Standard Models + // Standard control: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Heating and cooling control: + // 0xFFFFFBE6 to 0x0000041A (−105.0 to 105.0) + // Position-proportional Models + // Close position-proportional control with the Direct Setting of + // Position Proportional MV parameter set to ON: + // 0xFFFFFFCE to 0x0000041A (−5.0 to 105.0) + // Floating position-proportional control or the Direct Setting of + // Position Proportional MV parameter set to OFF: + // 0xFFFFFFFF to 0x00000001 (−1 to 1) + OR_E5_SWR_MV_PV_ERROR = 0x2711, + + // MV Change Rate Limit + // 0x00000000 to 0x000003E8 (0.0 to 100.0) + OR_E5_SWR_CHANGE_RATE_LIMIT = 0x2713, + + // PV Input Slope Coefficient + // 0x00000001 to 0x0000270F (0.001 to 9.999) + OR_E5_SWR_PV_INPUT_SLOPE_COEFFICIENT = 0x2718, + + // Heater Burnout Detection 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_1 = 0x271B, + + // Leakage Current 1 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_1 = 0x271C, + + // HS Alarm 1 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_1 = 0x271D, + + // Process Value Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_PROCESS_VALUE_INPUT_SHIFT = 0x2723, + + // Heater Burnout Detection 2 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HEATER_BURNOUT_DETECTION_2 = 0x2725, + + // Leakage Current 2 Monitor + // 0x00000000 to 0x00000226 (0.0 to 55.0) + OR_E5_SWR_LEAKAGE_CURRENT_MONITOR_2 = 0x2726, + + // HS Alarm 12 + // 0x00000000 to 0x000001F4 (0.0 to 50.0) + OR_E5_SWR_HS_ALARM_2 = 0x2727, + + // Soak Time Remain (how lovely) + // 0x00000000 to 0x0000270F (0 to 9999) + OR_E5_SWR_SOAK_REMAIN = 0x2728, + + // Soak Time + // 0x00000001 to 0x0000270F (1 to 9999) + OR_E5_SWR_SOAK_TIME = 0x2729, + + // Wait Band 0x00000000 (0): OFF + // 0x00000001 to 0x0000270F + // (0.1 to 999.9 for Temperature input) + // (0.01 to 99.99 for Analog input) + OR_E5_SWR_WAIT_BAND = 0x272A, + + // Remote SP Input Shift + // 0xFFFFF831 to 0x0000270F (−1999 to 9999) + OR_E5_SWR_REMOTE_SP_SHIFT = 0x272B, + + // Remote SP input Slope Coefficient + // 0x00000001 to 0x0 + OR_E5_SWR_REMOTE_SP_SLOPE_COEFFICIENT = 0x272C, + + // Input Digital Filter 0x00000000 to 0x0000270F (0.0 to 999.9) + OR_E5_SWR_DIGITAL_FILTER = 0x2800 + + // Notes : + // *1 Not displayed on the Controller display +}; + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest2/PriUint64.h b/extrusion/lydia-print-head-v1/firmware/test/mtest2/PriUint64.h new file mode 100644 index 0000000..b67418a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest2/PriUint64.h @@ -0,0 +1,96 @@ +#ifndef PRIUINT64_H +#define PRIUINT64_H + +#include +#include +#include + +/** \brief Allow printing uint64_t value. + * \code + * uint64_t x = 1; + * Serial.print(PriUint64(x)); + * \endcode + */ +template +class PriUint64 : public Printable +{ +public: + explicit + PriUint64(uint64_t value, int ignored = 0) + : m_value(value) + { + } + + size_t + printTo(Print& p) const override + { + char buf[8 * sizeof(uint64_t) + 1]; + char* str = &buf[sizeof(buf) - 1]; + *str = '\0'; + + uint64_t n = m_value; + do { + char c = n % Base; + n /= Base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n > 0); + + return p.write(str); + } + +private: + uint64_t m_value; +}; + +#if defined(ARDUINO_STREAMING) && defined(STREAMING_LIBRARY_VERSION) && STREAMING_LIBRARY_VERSION == 5 + +/** \brief Print uint64_t as decimal. + */ +inline Print& +operator<<(Print& p, uint64_t x) +{ + return p << PriUint64(x); +} + +#if defined(ESP8266) || defined(ESP32) +#define PRIUINT64_OVERRIDE_STREAMING_BASED +// is available on ESP8266 and ESP32, but unavailable on AVR. +#endif + +#ifdef PRIUINT64_OVERRIDE_STREAMING_BASED +#include + +#undef _HEX +#undef _DEC +#undef _OCT +#undef _BIN + +class _BASED1 : public _BASED, public Printable +{ +public: + using _BASED::_BASED; + + size_t + printTo(Print& p) const override + { + return p.print(val, base); + } +}; + +template::value, PriUint64, _BASED1>::type> +class _BASED2 : public BaseCls +{ +public: + using BaseCls::BaseCls; +}; + +#define _HEX(a) (_BASED2(a, HEX)) +#define _DEC(a) (_BASED2(a, DEC)) +#define _OCT(a) (_BASED2(a, OCT)) +#define _BIN(a) (_BASED2(a, BIN)) + +#endif // PRIUINT64_OVERRIDE_STREAMING_BASED +#endif // ARDUINO_STREAMING + +#endif // PRIUINT64_H \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest2/macros.h b/extrusion/lydia-print-head-v1/firmware/test/mtest2/macros.h new file mode 100644 index 0000000..a253087 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest2/macros.h @@ -0,0 +1,98 @@ +#ifndef MACROS_H +#define MACROS_H + +#include "../types.h" + +// Macros for adding +#define INC_0 1 +#define INC_1 2 +#define INC_2 3 +#define INC_3 4 +#define INC_4 5 +#define INC_5 6 +#define INC_6 7 +#define INC_7 8 +#define INC_8 9 +#define INCREMENT_(n) INC_ ##n +#define INCREMENT(n) INCREMENT_(n) + +// Macros for subtracting +#define DEC_1 0 +#define DEC_2 1 +#define DEC_3 2 +#define DEC_4 3 +#define DEC_5 4 +#define DEC_6 5 +#define DEC_7 6 +#define DEC_8 7 +#define DEC_9 8 +#define DECREMENT_(n) DEC_ ##n +#define DECREMENT(n) DECREMENT_(n) + +// compiler - & C quirks +#define FORCE_INLINE __attribute__((always_inline)) inline +#define _UNUSED __attribute__((unused)) + +// fallback noop +#define NOOP do{} while(0) + +//Option testing +#define _CAT(a, ...) a ## __VA_ARGS__ +#define SWITCH_ENABLED_ 1 +#define ENABLED(b) _CAT(SWITCH_ENABLED_, b) + +// time +#define PENDING(NOW,SOON) ((long)(NOW-(SOON))<0) +#define ELAPSED(NOW,SOON) (!PENDING(NOW,SOON)) + +#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f) +#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f) +#define HOUR_MS ((millis_t)1000 * (millis_t)(60 * 60)) +#define MIN_MS ((millis_t)1000 * (millis_t)(60)) +#define SECS ((millis_t)1000) + +// bit masks +#undef _BV +#define _BV(b) (1 << (b)) +#define TEST(n,b) !!((n)&_BV(b)) +#define SBI(n,b) (n |= _BV(b)) +#define CBI(n,b) (n &= ~_BV(b)) +#define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0) + +#define _BV32(b) (1UL << (b)) +#define TEST32(n,b) !!((n)&_BV32(b)) +#define SBI32(n,b) (n |= _BV32(b)) +#define CBI32(n,b) (n &= ~_BV32(b)) +#define SIGN(a) ((a>0)-(a<0)) + +// math basics + +#define WITHIN(V,L,H) ((V) >= (L) && (V) <= (H)) +#define NUMERIC(a) WITHIN(a, '0', '9') +#define DECIMAL(a) (NUMERIC(a) || a == '.') +#define NUMERIC_SIGNED(a) (NUMERIC(a) || (a) == '-' || (a) == '+') +#define DECIMAL_SIGNED(a) (DECIMAL(a) || (a) == '-' || (a) == '+') +#define COUNT(a) (sizeof(a)/sizeof(*a)) +#define ZERO(a) memset(a,0,sizeof(a)) +#define COPY(a,b) memcpy(a,b,MIN(sizeof(a),sizeof(b))) + + +// #define M_PI 3.14159265358979323846f +#define RADIANS(d) ((d)*M_PI/180.0f) +#define DEGREES(r) ((r)*180.0f/M_PI) +#define CEILING(x,y) (((x) + (y) - 1) / (y)) + +// Macros for initializing arrays +#define ARRAY_6(v1, v2, v3, v4, v5, v6, ...) { v1, v2, v3, v4, v5, v6 } +#define ARRAY_5(v1, v2, v3, v4, v5, ...) { v1, v2, v3, v4, v5 } +#define ARRAY_4(v1, v2, v3, v4, ...) { v1, v2, v3, v4 } +#define ARRAY_3(v1, v2, v3, ...) { v1, v2, v3 } +#define ARRAY_2(v1, v2, ...) { v1, v2 } +#define ARRAY_1(v1, ...) { v1 } + +#define _ARRAY_N(N, ...) ARRAY_ ##N(__VA_ARGS__) +#define ARRAY_N(N, ...) _ARRAY_N(N, __VA_ARGS__) + +#define SPACE(A) " " << A << " " + +#endif diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtest2/mtest2.ino b/extrusion/lydia-print-head-v1/firmware/test/mtest2/mtest2.ino new file mode 100644 index 0000000..3d5cdb3 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtest2/mtest2.ino @@ -0,0 +1,218 @@ +/** + * Modbus master example 1: + * The purpose of this example is to query an array of data + * from an external Modbus slave device. + * The link media can be USB or RS232. + * + * Recommended Modbus slave: + * diagslave http://www.modbusdriver.com/diagslave.html + * + * In a Linux box, run + * "./diagslave /dev/ttyUSB0 -b 19200 -d 8 -s 1 -p none -m rtu -a 1" + * This is: + * serial port /dev/ttyUSB0 at 19200 baud 8N1 + * RTU mode and address @1 + */ + +#include "ModbusRtu.h" +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ + +#include "OmronE5.h" +#include "PriUint64.h" + +// data array for modbus network sharing +uint16_t au16data[16]; +uint8_t u8state; + +#define ku8MBReadCoils 0x01 ///< Modbus function 0x01 Read Coils +#define ku8MBReadDiscreteInputs 0x02 ///< Modbus function 0x02 Read Discrete Inputs +#define ku8MBWriteSingleCoil 0x05 ///< Modbus function 0x05 Write Single Coil +#define ku8MBWriteMultipleCoils 0x0F ///< Modbus function 0x0F Write Multiple Coils + +#define ku8MBReadHoldingRegisters 0x03 ///< Modbus function 0x03 Read Holding Registers +#define ku8MBReadInputRegisters 0x04 ///< Modbus function 0x04 Read Input Registers +#define ku8MBWriteSingleRegister 0x06 ///< Modbus function 0x06 Write Single Register +#define ku8MBWriteMultipleRegisters 0x10 ///< Modbus function 0x10 Write Multiple Registers +#define ku8MBMaskWriteRegister 0x16 ///< Modbus function 0x16 Mask Write Register +#define ku8MBReadWriteMultipleRegisters 0x17 ///< Modbus function 0x17 Read Write Multiple Registers +#define ku8MBLinkTestOmronMX2Only 0x08 ///< Modbus function 0x08 Тест связи с инвертром Omron MX2 функция только для него + +#define R_INFO_START 0 +#define R_INFO_LENGTH 0xA + +#define W_SP_VALUE 300 +#define W_SP_START 0x2601 + +Modbus master(0, 3); +modbus_t telegram; +unsigned long u32wait; + +long u16RegAdd = 0; +long u16CoilsNo = 0xA; + +/// Status bytes - STOP : 768 | 2 +/// Status bytes - RUN(&OUT) : 512 | 256 +/// Status bytes - RUN(none) : 512 | 256 +/// Status bytes - RUN(none) : 512 | 28674 +// +// Status bits : RUN/STOP = 24 +// +// + +long COMMAND = ku8MBReadHoldingRegisters; + +unsigned long setByte(unsigned long value, byte position, byte new_byte) +{ + unsigned bitpos = position * 8; + unsigned long mask = 0xFFU << bitpos; + value &= ~mask; + value |= new_byte; + return value; +} + +unsigned int WORD(int in) +{ + return in << 4; +} + +void setup() +{ + Serial.begin(19200); // baud-rate at 19200 + + // https://www.arduino.cc/reference/en/language/functions/communication/serial/begin/ + master.begin(19200, SERIAL_8E1); // SERIAL_8E1 + + master.setTimeOut(2000); // if there is no answer in 2000 ms, roll over + u32wait = millis() + 1000; + u8state = 0; +} + +#define PRINTBIN(Num) \ + for (uint32_t t = (1UL << (sizeof(Num) * 8) - 1); t; t >>= 1) \ + Serial.write(Num &t ? '1' : '0'); // Prints a binary number with leading zeros (Automatic Handling) +#define PRINTBINL(Num) \ + for (int i = 0; i < (sizeof(Num) * 8); i++) \ + { \ + Serial.write(((Num >> i) & 1) == 1 ? '1' : '0'); \ + } // Prints a binary number with following Placeholder Zeros (Automatic Handling) + +#define MX2_STATE 0x0003 // (2 bytes) Status of the inverter + +class OmronState +{ +public: + bool isRunning; + bool isHeating; + bool isCooling; + bool alarm1; + int pv; + int sp; +}; + +OmronState state; + +void loop() +{ + + switch (u8state) + { + case 0: + if (millis() > u32wait) + u8state++; // wait state + break; + case 1: + { + telegram.u8id = 1; // slave address + telegram.u8fct = COMMAND; // function code (this one is registers read) + telegram.u16RegAdd = u16RegAdd; // start address in slave + telegram.u16CoilsNo = u16CoilsNo; // number of elements (coils or registers) to read + telegram.au16reg = au16data; // pointer to a memory array in the Arduino + + master.query(telegram); // send query (only once) + u8state++; + break; + } + case 2: + master.poll(); // check incoming messages + if (master.getState() == COM_IDLE) + { + + int statusHigh = au16data[2]; + int statusLow = au16data[3]; + + state.isRunning = !OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_RunStop); + state.isHeating = OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_Control_OutputOpenOutput); + state.isCooling = OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_Control_OutputCloseOutput); + state.alarm1 = OR_E5_STATUS_BIT(statusHigh, statusLow, OR_E5_STATUS_1::OR_E5_S1_Alarm1); + state.pv = au16data[1]; + state.sp = au16data[5]; + + + u8state = 0; + u32wait = millis() + 1000; + + bool print = true; + + Serial.println("---- Omron state : "); + Serial.print("\n\t Is Running: "); + Serial.print(state.isRunning ? " RUNNING " : "STOPPED"); + + Serial.print("\n\t Is Heating: "); + Serial.print(state.isHeating ? " HEATING " : " NO "); + + Serial.print("\n\t Is Cooling : "); + Serial.print(state.isHeating ? " COOLING " : " NO "); + + Serial.print("\n\t Is Alarm-1 : "); + Serial.print(state.alarm1 ? " ALARM! " : " NO "); + + Serial.println("------------------"); + + Serial.print(au16data[2]); + Serial.print(" : "); + + char buf[16]; + unsigned long lval = 768 << 4; + + // assign lval something then... + ultoa(lval, buf, 10); + + Serial.println(buf); + + Serial.print(" :: "); + //Serial.print(PriUint64(DWORD(au16data[2]))); + Serial.println("\n ---- ------"); + + if (print) + { + Serial.print(master.getLastError()); + Serial.print("\t ADC-0: "); + Serial.print(au16data[0], HEX); + Serial.print("\t ADC-1 : "); + Serial.print(au16data[1], DEC); + Serial.print("\t ADC-2 : "); + Serial.print(au16data[2], DEC); + // PRINTBIN(au16data[2]); + Serial.print("\t ADC-3 : "); + Serial.print(au16data[3], DEC); + Serial.print("\t ADC-4 : "); + Serial.print(au16data[4], DEC); + Serial.print("\t ADC-5 : "); + Serial.print(au16data[5], DEC); + + Serial.print("\t ADC-6 : "); + Serial.print(au16data[6], DEC); + + Serial.print("\t ADC-7 : "); + Serial.print(au16data[7], DEC); + + Serial.print("\t ADC-8 : "); + Serial.print(au16data[8], DEC); + + Serial.println("-------------------------------------"); + Serial.println(""); + } + } + break; + } +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestmaster/mtestmaster.ino b/extrusion/lydia-print-head-v1/firmware/test/mtestmaster/mtestmaster.ino new file mode 100644 index 0000000..5392a6f --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestmaster/mtestmaster.ino @@ -0,0 +1,99 @@ +/* + + Basic.pde - example using ModbusMaster library + + Library:: ModbusMaster + Author:: Doc Walker <4-20ma@wvfans.net> + + Copyright:: 2009-2016 Doc Walker + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +#include +#include + +/* +#define CONTROLLINO_RS485_TX 14 +#define CONTROLLINO_RS485_RX 15 +*/ +// instantiate ModbusMaster object +#define POWER_0 CONTROLLINO_R10 // Primary power circuit +#define POWER_1 CONTROLLINO_R11 // Secondary power circuit + +ModbusMaster node; + +void setup() +{ + // use Serial (port 0); initialize Modbus communication baud rate + Serial.begin(19200); + + + digitalWrite(POWER_0, HIGH); + digitalWrite(POWER_1, HIGH); + + + + delay(5000); + + Serial.println("test"); + Controllino_RS485Init(); + Controllino_RS485RxEnable(); + Controllino_RS485TxEnable(); + + + // communicate with Modbus slave ID 2 over Serial (port 0) + node.begin(1, Serial3); +} + +void loop() +{ + static uint32_t i; + uint8_t j, result; + uint16_t data[6]; + + i++; + + Serial.println("0"); + // set word 0 of TX buffer to least-significant word of counter (bits 15..0) + node.setTransmitBuffer(0, lowWord(i)); + + // set word 1 of TX buffer to most-significant word of counter (bits 31..16) + node.setTransmitBuffer(1, highWord(i)); + + // slave: write TX buffer to (2) 16-bit registers starting at register 0 + result = node.writeMultipleRegisters(0, 2); + + // slave: read (6) 16-bit registers starting at register 2 to RX buffer + result = node.readHoldingRegisters(2, 6); + Serial.println("1"); + + // do something with data if read is successful + if (result == node.ku8MBSuccess) + { + Serial.println("ok!!"); + for (j = 0; j < 6; j++) + { + data[j] = node.getResponseBuffer(j); + } + } + else + { + Serial.println("not ok"); + Serial.println(result); + } + + Serial.println("ok ::: "); + Serial.println(result); +} diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.cpp b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.cpp new file mode 100644 index 0000000..d92a3c1 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.cpp @@ -0,0 +1,932 @@ +/* +Доработка библиотеки для "Народного контроллера теплового насоса" +Автор pav2000 firstlast2007@gmail.com +Добавлены изменения для работы с инвертором Omron MX2 +- поддерживается функция проверки связи (код функции 0х08) +для проверки функции используйте LinkTestOmronMX2Only(code) +где code - проверочный код (любое число uint16_t), +в случае успеха первый элемент буфера будет содержать этот код +- сделана обработка ошибок инвертора (в коде функции добавляется 0х80) +при этом возвращается состяние ku8MBErrorOmronMX2, +первый элемент буфера при этом содержит код ошибки +* +* Some additional - vad7@yahoo.com +* +*/ +/** +@file +Arduino library for communicating with Modbus slaves over RS232/485 (via RTU protocol). +*/ +/* + + ModbusMaster.cpp - Arduino library for communicating with Modbus slaves + over RS232/485 (via RTU protocol). + + Library:: ModbusMaster + + Copyright:: 2009-2016 Doc Walker + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +#include "ModbusMaster.h" + +ModbusMaster::ModbusMaster(void) +{ + _idle = 0; + _preTransmission = 0; + _postTransmission = 0; + last_transaction_time = 0; +} + +/** +Initialize class object. + +Assigns the Modbus slave ID and serial port. +Call once class has been instantiated, typically within setup(). + +@param slave Modbus slave ID (1..255) +@param &serial reference to serial port object (Serial, Serial1, ... Serial3) +@ingroup setup +*/ +void ModbusMaster::begin(uint8_t slave, Stream &serial) +{ +// txBuffer = (uint16_t*) calloc(ku8MaxBufferSize, sizeof(uint16_t)); + _u8MBSlave = slave; + _serial = &serial; + _u8TransmitBufferIndex = 0; + u16TransmitBufferLength = 0; +} + + +void ModbusMaster::beginTransmission(uint16_t u16Address) +{ + _u16WriteAddress = u16Address; + _u8TransmitBufferIndex = 0; + u16TransmitBufferLength = 0; +} + +/*/ eliminate this function in favor of using existing MB request functions +uint8_t ModbusMaster::requestFrom(uint16_t address, uint16_t quantity) +{ + // clamp to buffer length + if (quantity > ku8MaxBufferSize) + { + quantity = ku8MaxBufferSize; + } + // set rx buffer iterator vars + _u8ResponseBufferIndex = 0; + _u8ResponseBufferLength = quantity; + + return quantity; +} +*/ + +void ModbusMaster::sendBit(bool data) +{ + uint8_t txBitIndex = u16TransmitBufferLength % 16; + if ((u16TransmitBufferLength >> 4) < ku8MaxBufferSize) + { + if (0 == txBitIndex) + { + _u16TransmitBuffer[_u8TransmitBufferIndex] = 0; + } + bitWrite(_u16TransmitBuffer[_u8TransmitBufferIndex], txBitIndex, data); + u16TransmitBufferLength++; + _u8TransmitBufferIndex = u16TransmitBufferLength >> 4; + } +} + + +void ModbusMaster::send(uint16_t data) +{ + if (_u8TransmitBufferIndex < ku8MaxBufferSize) + { + _u16TransmitBuffer[_u8TransmitBufferIndex++] = data; + u16TransmitBufferLength = _u8TransmitBufferIndex << 4; + } +} + + +void ModbusMaster::send(uint32_t data) +{ + send(lowWord(data)); + send(highWord(data)); +} + + +void ModbusMaster::send(uint8_t data) +{ + send(word(data)); +} + + +uint8_t ModbusMaster::available(void) +{ + return _u8ResponseBufferLength - _u8ResponseBufferIndex; +} + + +uint16_t ModbusMaster::receive(void) +{ + if (_u8ResponseBufferIndex < _u8ResponseBufferLength) + { + return _u16ResponseBuffer[_u8ResponseBufferIndex++]; + } + else + { + return 0xFFFF; + } +} + + + +/** +Set idle time callback function (cooperative multitasking). + +This function gets called in the idle time between transmission of data +and response from slave. Do not call functions that read from the serial +buffer that is used by ModbusMaster. Use of i2c/TWI, 1-Wire, other +serial ports, etc. is permitted within callback function. + +@see ModbusMaster::ModbusMasterTransaction() +*/ +void ModbusMaster::idle(void (*idle)()) +{ + _idle = idle; +} + +/** +Set pre-transmission callback function. + +This function gets called just before a Modbus message is sent over serial. +Typical usage of this callback is to enable an RS485 transceiver's +Driver Enable pin, and optionally disable its Receiver Enable pin. + +@see ModbusMaster::ModbusMasterTransaction() +@see ModbusMaster::postTransmission() +*/ +void ModbusMaster::preTransmission(void (*preTransmission)()) +{ + _preTransmission = preTransmission; +} + +/** +Set post-transmission callback function. + +This function gets called after a Modbus message has finished sending +(i.e. after all data has been physically transmitted onto the serial +bus). + +Typical usage of this callback is to enable an RS485 transceiver's +Receiver Enable pin, and disable its Driver Enable pin. + +@see ModbusMaster::ModbusMasterTransaction() +@see ModbusMaster::preTransmission() +*/ +void ModbusMaster::postTransmission(void (*postTransmission)()) +{ + _postTransmission = postTransmission; +} + + +/** +Retrieve data from response buffer. + +@see ModbusMaster::clearResponseBuffer() +@param u8Index index of response buffer array (0x00..0x3F) +@return value in position u8Index of response buffer (0x0000..0xFFFF) +@ingroup buffer +*/ +uint16_t ModbusMaster::getResponseBuffer(uint8_t u8Index) +{ + if (u8Index < ku8MaxBufferSize) + { + return _u16ResponseBuffer[u8Index]; + } + else + { + return 0xFFFF; + } +} + + +/** +Clear Modbus response buffer. + +@see ModbusMaster::getResponseBuffer(uint8_t u8Index) +@ingroup buffer +*/ +void ModbusMaster::clearResponseBuffer() +{ + uint8_t i; + + for (i = 0; i < ku8MaxBufferSize; i++) + { + _u16ResponseBuffer[i] = 0; + } +} + + +/** +Place data in transmit buffer. + +@see ModbusMaster::clearTransmitBuffer() +@param u8Index index of transmit buffer array (0x00..0x3F) +@param u16Value value to place in position u8Index of transmit buffer (0x0000..0xFFFF) +@return 0 on success; exception number on failure +@ingroup buffer +*/ +uint8_t ModbusMaster::setTransmitBuffer(uint8_t u8Index, uint16_t u16Value) +{ + if (u8Index < ku8MaxBufferSize) + { + _u16TransmitBuffer[u8Index] = u16Value; + return ku8MBSuccess; + } + else + { + return ku8MBIllegalDataAddress; + } +} + + +/** +Clear Modbus transmit buffer. + +@see ModbusMaster::setTransmitBuffer(uint8_t u8Index, uint16_t u16Value) +@ingroup buffer +*/ +void ModbusMaster::clearTransmitBuffer() +{ + uint8_t i; + + for (i = 0; i < ku8MaxBufferSize; i++) + { + _u16TransmitBuffer[i] = 0; + } +} + + +/** +Modbus function 0x01 Read Coils. + +This function code is used to read from 1 to 2000 contiguous status of +coils in a remote device. The request specifies the starting address, +i.e. the address of the first coil specified, and the number of coils. +Coils are addressed starting at zero. + +The coils in the response buffer are packed as one coil per bit of the +data field. Status is indicated as 1=ON and 0=OFF. The LSB of the first +data word contains the output addressed in the query. The other coils +follow toward the high order end of this word and from low order to high +order in subsequent words. + +If the returned quantity is not a multiple of sixteen, the remaining +bits in the final data word will be padded with zeros (toward the high +order end of the word). + +@param u16ReadAddress address of first coil (0x0000..0xFFFF) +@param u16BitQty quantity of coils to read (1..2000, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup discrete +*/ +uint8_t ModbusMaster::readCoils(uint16_t u16ReadAddress, uint16_t u16BitQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16BitQty; + return ModbusMasterTransaction(ku8MBReadCoils); +} + + +/** +Modbus function 0x02 Read Discrete Inputs. + +This function code is used to read from 1 to 2000 contiguous status of +discrete inputs in a remote device. The request specifies the starting +address, i.e. the address of the first input specified, and the number +of inputs. Discrete inputs are addressed starting at zero. + +The discrete inputs in the response buffer are packed as one input per +bit of the data field. Status is indicated as 1=ON; 0=OFF. The LSB of +the first data word contains the input addressed in the query. The other +inputs follow toward the high order end of this word, and from low order +to high order in subsequent words. + +If the returned quantity is not a multiple of sixteen, the remaining +bits in the final data word will be padded with zeros (toward the high +order end of the word). + +@param u16ReadAddress address of first discrete input (0x0000..0xFFFF) +@param u16BitQty quantity of discrete inputs to read (1..2000, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup discrete +*/ +uint8_t ModbusMaster::readDiscreteInputs(uint16_t u16ReadAddress, + uint16_t u16BitQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16BitQty; + return ModbusMasterTransaction(ku8MBReadDiscreteInputs); +} + + +/** +Modbus function 0x03 Read Holding Registers. + +This function code is used to read the contents of a contiguous block of +holding registers in a remote device. The request specifies the starting +register address and the number of registers. Registers are addressed +starting at zero. + +The register data in the response buffer is packed as one word per +register. + +@param u16ReadAddress address of the first holding register (0x0000..0xFFFF) +@param u16ReadQty quantity of holding registers to read (1..125, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::readHoldingRegisters(uint16_t u16ReadAddress, + uint16_t u16ReadQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16ReadQty; + return ModbusMasterTransaction(ku8MBReadHoldingRegisters); +} + + +/** +Modbus function 0x04 Read Input Registers. + +This function code is used to read from 1 to 125 contiguous input +registers in a remote device. The request specifies the starting +register address and the number of registers. Registers are addressed +starting at zero. + +The register data in the response buffer is packed as one word per +register. + +@param u16ReadAddress address of the first input register (0x0000..0xFFFF) +@param u16ReadQty quantity of input registers to read (1..125, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::readInputRegisters(uint16_t u16ReadAddress, + uint8_t u16ReadQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16ReadQty; + return ModbusMasterTransaction(ku8MBReadInputRegisters); +} + + +/** +Modbus function 0x05 Write Single Coil. + +This function code is used to write a single output to either ON or OFF +in a remote device. The requested ON/OFF state is specified by a +constant in the state field. A non-zero value requests the output to be +ON and a value of 0 requests it to be OFF. The request specifies the +address of the coil to be forced. Coils are addressed starting at zero. + +@param u16WriteAddress address of the coil (0x0000..0xFFFF) +@param u8State 0=OFF, non-zero=ON (0x00..0xFF) +@return 0 on success; exception number on failure +@ingroup discrete +*/ +uint8_t ModbusMaster::writeSingleCoil(uint16_t u16WriteAddress, uint8_t u8State) +{ + _u16WriteAddress = u16WriteAddress; + _u16WriteQty = (u8State ? 0xFF00 : 0x0000); +// Serial.println(_u16WriteQty) ; + return ModbusMasterTransaction(ku8MBWriteSingleCoil); +} + + +/** +Modbus function 0x06 Write Single Register. + +This function code is used to write a single holding register in a +remote device. The request specifies the address of the register to be +written. Registers are addressed starting at zero. + +@param u16WriteAddress address of the holding register (0x0000..0xFFFF) +@param u16WriteValue value to be written to holding register (0x0000..0xFFFF) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::writeSingleRegister(uint16_t u16WriteAddress, + uint16_t u16WriteValue) +{ + _u16WriteAddress = u16WriteAddress; + _u16WriteQty = 0; + _u16TransmitBuffer[0] = u16WriteValue; + return ModbusMasterTransaction(ku8MBWriteSingleRegister); +} + + +/** +Modbus function 0x0F Write Multiple Coils. + +This function code is used to force each coil in a sequence of coils to +either ON or OFF in a remote device. The request specifies the coil +references to be forced. Coils are addressed starting at zero. + +The requested ON/OFF states are specified by contents of the transmit +buffer. A logical '1' in a bit position of the buffer requests the +corresponding output to be ON. A logical '0' requests it to be OFF. + +@param u16WriteAddress address of the first coil (0x0000..0xFFFF) +@param u16BitQty quantity of coils to write (1..2000, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup discrete +*/ +uint8_t ModbusMaster::writeMultipleCoils(uint16_t u16WriteAddress, + uint16_t u16BitQty) +{ + _u16WriteAddress = u16WriteAddress; + _u16WriteQty = u16BitQty; + return ModbusMasterTransaction(ku8MBWriteMultipleCoils); +} +uint8_t ModbusMaster::writeMultipleCoils() +{ + _u16WriteQty = u16TransmitBufferLength; + return ModbusMasterTransaction(ku8MBWriteMultipleCoils); +} + + +/** +Modbus function 0x10 Write Multiple Registers. + +This function code is used to write a block of contiguous registers (1 +to 123 registers) in a remote device. + +The requested written values are specified in the transmit buffer. Data +is packed as one word per register. + +@param u16WriteAddress address of the holding register (0x0000..0xFFFF) +@param u16WriteQty quantity of holding registers to write (1..123, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::writeMultipleRegisters(uint16_t u16WriteAddress, + uint16_t u16WriteQty) +{ + _u16WriteAddress = u16WriteAddress; + _u16WriteQty = u16WriteQty; + return ModbusMasterTransaction(ku8MBWriteMultipleRegisters); +} + +// new version based on Wire.h +uint8_t ModbusMaster::writeMultipleRegisters() +{ + _u16WriteQty = _u8TransmitBufferIndex; + return ModbusMasterTransaction(ku8MBWriteMultipleRegisters); +} + + +/** +Modbus function 0x16 Mask Write Register. + +This function code is used to modify the contents of a specified holding +register using a combination of an AND mask, an OR mask, and the +register's current contents. The function can be used to set or clear +individual bits in the register. + +The request specifies the holding register to be written, the data to be +used as the AND mask, and the data to be used as the OR mask. Registers +are addressed starting at zero. + +The function's algorithm is: + +Result = (Current Contents && And_Mask) || (Or_Mask && (~And_Mask)) + +@param u16WriteAddress address of the holding register (0x0000..0xFFFF) +@param u16AndMask AND mask (0x0000..0xFFFF) +@param u16OrMask OR mask (0x0000..0xFFFF) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::maskWriteRegister(uint16_t u16WriteAddress, + uint16_t u16AndMask, uint16_t u16OrMask) +{ + _u16WriteAddress = u16WriteAddress; + _u16TransmitBuffer[0] = u16AndMask; + _u16TransmitBuffer[1] = u16OrMask; + return ModbusMasterTransaction(ku8MBMaskWriteRegister); +} + +/** +Modbus function 0x17 Read Write Multiple Registers. + +This function code performs a combination of one read operation and one +write operation in a single MODBUS transaction. The write operation is +performed before the read. Holding registers are addressed starting at +zero. + +The request specifies the starting address and number of holding +registers to be read as well as the starting address, and the number of +holding registers. The data to be written is specified in the transmit +buffer. + +@param u16ReadAddress address of the first holding register (0x0000..0xFFFF) +@param u16ReadQty quantity of holding registers to read (1..125, enforced by remote device) +@param u16WriteAddress address of the first holding register (0x0000..0xFFFF) +@param u16WriteQty quantity of holding registers to write (1..121, enforced by remote device) +@return 0 on success; exception number on failure +@ingroup register +*/ +uint8_t ModbusMaster::readWriteMultipleRegisters(uint16_t u16ReadAddress, + uint16_t u16ReadQty, uint16_t u16WriteAddress, uint16_t u16WriteQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16ReadQty; + _u16WriteAddress = u16WriteAddress; + _u16WriteQty = u16WriteQty; + return ModbusMasterTransaction(ku8MBReadWriteMultipleRegisters); +} +uint8_t ModbusMaster::readWriteMultipleRegisters(uint16_t u16ReadAddress, + uint16_t u16ReadQty) +{ + _u16ReadAddress = u16ReadAddress; + _u16ReadQty = u16ReadQty; + _u16WriteQty = _u8TransmitBufferIndex; + return ModbusMasterTransaction(ku8MBReadWriteMultipleRegisters); +} + +// Только для OMRON MX2 - проверка связи с инвертором +// едиственный параметр - проверчый код - он должен вернуться с инвертора +uint8_t ModbusMaster::LinkTestOmronMX2Only(uint16_t code) +{ + _u16WriteAddress=0x0; // первые два байта 0 + _u16TransmitBuffer[0] = code; + return ModbusMasterTransaction(ku8MBLinkTestOmronMX2Only); +} + +/* _____PRIVATE FUNCTIONS____________________________________________________ */ + +/** +Modbus transaction engine. +Sequence: Последовательность: + - assemble Modbus Request Application Data Unit (ADU), + based on particular function called + - transmit request over selected serial port + - wait for/retrieve response + - evaluate/disassemble response + - return status (success/exception)*/ +// @param u8MBFunction Modbus function (0x01..0xFF) +// @return 0 on success; exception number on failure +uint8_t ModbusMaster::ModbusMasterTransaction(uint8_t u8MBFunction) +{ + static uint8_t u8ModbusADU[128]; // буфер + uint8_t u8ModbusADUSize = 0; // текущее положение в буфере (длина данных) + uint8_t i, u8Qty; + uint16_t u16CRC; + uint32_t u32StartTime; + uint8_t u8BytesLeft = 8; // число оставшихся байт для чтения (минимальна длина ответа??) + uint8_t u8MBStatus = ku8MBSuccess; // текущий статус + + if((u32StartTime = millis() - last_transaction_time) < MIN_TIME_BETWEEN_TRANSACTION) { +#ifdef MODBUSMASTER_DEBUG + Serial.print("#"); +#endif + u32StartTime = MIN_TIME_BETWEEN_TRANSACTION - u32StartTime; +#ifdef MODBUS_FREERTOS + while(u32StartTime--) if(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) vTaskDelay(1); else delay(1); +#else + while(u32StartTime--) delay(1); +#endif + } +#ifdef MODBUSMASTER_DEBUG + Serial.print("MB"); Serial.print(_u8MBSlave); Serial.print(": "); +#endif + // assemble Modbus Request Application Data Unit (ADU) + // Сборка блока запроса Modbus Application Data (ADU) + u8ModbusADU[u8ModbusADUSize++] = _u8MBSlave; // номер устройства (Slave) + u8ModbusADU[u8ModbusADUSize++] = u8MBFunction; // номер функции Modbus + + // ЧТЕНИЕ ДАННЫХ в зависимости от функции Modbus поместить адрес регистра и длину данных + switch(u8MBFunction) + { + case ku8MBReadCoils: // 0x01 < Modbus function 0x01 Read Coils + case ku8MBReadDiscreteInputs: // 0x02 < Modbus function 0x02 Read Discrete Inputs + case ku8MBReadInputRegisters: // 0x04 < Modbus function 0x04 Read Input Registers + case ku8MBReadHoldingRegisters: // 0x03 < Modbus function 0x03 Read Holding Registers + case ku8MBReadWriteMultipleRegisters: + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16ReadAddress); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16ReadAddress); + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16ReadQty); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16ReadQty); + break; + } + // ЗАПИСЬ ДАННЫХ в зависимости от функции Modbus поместить адрес регистра + switch(u8MBFunction) + { + case ku8MBWriteSingleCoil: // 0x05 < Modbus function 0x05 Write Single Coil + case ku8MBMaskWriteRegister: // 0x16 < Modbus function 0x16 Mask Write Register + case ku8MBWriteMultipleCoils: // 0x0F < Modbus function 0x0F Write Multiple Coils + case ku8MBWriteSingleRegister: // 0x06 < Modbus function 0x06 Write Single Register + case ku8MBWriteMultipleRegisters: // 0x10 < Modbus function 0x10 Write Multiple Registers + case ku8MBReadWriteMultipleRegisters: // 0x17 < Modbus function 0x17 Read Write Multiple Registers + case ku8MBLinkTestOmronMX2Only: // 0x08 < Modbus function 0x08 Тест связи с инвертром Omron MX2 функция только для него + + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16WriteAddress); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16WriteAddress); + break; + } + // ЗАПИСЬ ДАННЫХ в зависимости от функции Modbus поместить данные + switch(u8MBFunction) + { + case ku8MBWriteSingleCoil: + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16WriteQty); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16WriteQty); + break; + + case ku8MBWriteSingleRegister: + case ku8MBLinkTestOmronMX2Only: // проверка связи поместить данные + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16TransmitBuffer[0]); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16TransmitBuffer[0]); + break; + + case ku8MBWriteMultipleCoils: + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16WriteQty); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16WriteQty); + u8Qty = (_u16WriteQty % 8) ? ((_u16WriteQty >> 3) + 1) : (_u16WriteQty >> 3); + u8ModbusADU[u8ModbusADUSize++] = u8Qty; + for (i = 0; i < u8Qty; i++) + { + switch(i % 2) + { + case 0: // i is even + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16TransmitBuffer[i >> 1]); + break; + + case 1: // i is odd + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16TransmitBuffer[i >> 1]); + break; + } + } + break; + + case ku8MBWriteMultipleRegisters: + case ku8MBReadWriteMultipleRegisters: + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16WriteQty); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16WriteQty); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16WriteQty << 1); + + for (i = 0; i < lowByte(_u16WriteQty); i++) + { + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16TransmitBuffer[i]); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16TransmitBuffer[i]); + } + break; + + case ku8MBMaskWriteRegister: + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16TransmitBuffer[0]); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16TransmitBuffer[0]); + u8ModbusADU[u8ModbusADUSize++] = highByte(_u16TransmitBuffer[1]); + u8ModbusADU[u8ModbusADUSize++] = lowByte(_u16TransmitBuffer[1]); + break; + case ku8MBCustomRequest: + for (i = 0; i < _u8TransmitBufferIndex; i++) + { + u8ModbusADU[u8ModbusADUSize++] = _u16TransmitBuffer[i]; + } + break; + } + + // вычисление контрольной суммы + u16CRC = 0xFFFF; + for (i = 0; i < u8ModbusADUSize; i++) + { + u16CRC = crc16_update(u16CRC, u8ModbusADU[i]); + } + u8ModbusADU[u8ModbusADUSize++] = lowByte(u16CRC); + u8ModbusADU[u8ModbusADUSize++] = highByte(u16CRC); + u8ModbusADU[u8ModbusADUSize] = 0; + + // flush receive buffer before transmitting request + // Очистка приемного буфера перед передачей запроса + while (_serial->read() != -1); + + // transmit request + // вызов функции перед началом передачи - дернуть ногу передачи max485 (помним про полудуплекс) + if (_preTransmission) { _preTransmission(); } + + // передаем данные + for (i = 0; i < u8ModbusADUSize; i++) + { + _serial->write(u8ModbusADU[i]); + } + + _serial->flush(); // Очистить передающий буфер + // вызов функции в конце передачи - дернуть ногу передачи max485 + задержка перед чтением(помним про полудуплекс) + if (_postTransmission) { _postTransmission(); } + + // -------------------- ЧТЕНИЕ ОТВЕТА -------------------------------------- + u8ModbusADUSize = 0; // Сбросить длину буфера + +#ifdef MODBUSMASTER_DEBUG + Serial.print("St: "); Serial.print(millis()); Serial.print(" "); +#endif + + // Цикл чтения из входного буфера пока нет ошибок и не прошло время ожидания + u32StartTime = millis(); // время начала + // Ожидание и чтение ответа + while(u8BytesLeft && !u8MBStatus) { + if(_serial->available()) // есть символы во входном буфере + { +#ifdef MODBUSMASTER_DEBUG + if(u8ModbusADUSize == 0) { Serial.print("1: "); Serial.print(millis()); Serial.print(" "); } +#endif + u8ModbusADU[u8ModbusADUSize++] = _serial->read(); + u8BytesLeft--; // байт прочли уменьшили счетчик + u32StartTime = millis(); // время продолжения + } else { // нет символов во входном буфере + if(_idle) { _idle(); } // если разрешено - операция ожидания + } + + // evaluate slave ID, function code once enough bytes have been read + // определение ID ведомого и кода функции - один байт + if(u8ModbusADUSize == (u8MBFunction == ku8MBCustomRequest && _u8TransmitBufferIndex < 2 ? _u8TransmitBufferIndex + 3 : 5)) // Разбор заголовка + { + // verify response is for correct Modbus slave + // Сравнение ID с посланым в запросе + if(u8ModbusADU[0] != _u8MBSlave) { + u8MBStatus = ku8MBInvalidSlaveID; + break; + } + + // verify response is for correct Modbus function code (mask exception bit 7) + else if((u8ModbusADU[1] & 0x80) == 0x80) { + u8MBStatus = ku8MBExtendedError + u8ModbusADU[2]; // найдена ошибка, кодируем код исключения + break; + } else if((u8ModbusADU[1] & 0x7F) != u8MBFunction) { + u8MBStatus = ku8MBInvalidFunction; + break; + } + + // check whether Modbus exception occurred; return Modbus Exception Code + else if(bitRead(u8ModbusADU[1], 7)) { + u8MBStatus = u8ModbusADU[2]; + break; + } + + // evaluate returned Modbus function code + // Оценить в зависимости от функции требуемое число байт + switch(u8ModbusADU[1]) // код функции + { + case ku8MBReadCoils: + case ku8MBReadDiscreteInputs: + case ku8MBReadInputRegisters: + case ku8MBReadHoldingRegisters: + case ku8MBReadWriteMultipleRegisters: + u8BytesLeft = u8ModbusADU[2]; + break; + case ku8MBWriteSingleCoil: + case ku8MBWriteMultipleCoils: + case ku8MBWriteSingleRegister: + case ku8MBWriteMultipleRegisters: + u8BytesLeft = 3; + break; + case ku8MBMaskWriteRegister: + u8BytesLeft = 5; + break; + case ku8MBLinkTestOmronMX2Only: + u8BytesLeft = 3; + break; + default: + if(u8MBFunction == ku8MBCustomRequest) { + u8BytesLeft = _u8TransmitBufferIndex - (u8ModbusADUSize - 3); + } + } + } // if (u8ModbusADUSize == 5) + + // проверка привышения времени ожидания + if((millis() - u32StartTime) > ku16MBResponseTimeout) { + u8MBStatus = ku8MBResponseTimedOut; + break; + } + } //Конец цикла приема while (u8BytesLeft && !u8MBStatus) + + // verify response is large enough to inspect further + // Проверить является ли длина ответ достаточно большой + if (!u8MBStatus && u8ModbusADUSize >= 5) + { + // calculate CRC + u16CRC = 0xFFFF; + for (i = 0; i < (u8ModbusADUSize - 2); i++) + { + u16CRC = crc16_update(u16CRC, u8ModbusADU[i]); + } + + // verify CRC + if (!u8MBStatus && (lowByte(u16CRC) != u8ModbusADU[u8ModbusADUSize - 2] || + highByte(u16CRC) != u8ModbusADU[u8ModbusADUSize - 1])) + { + u8MBStatus = ku8MBInvalidCRC; + } + } //if (!u8MBStatus && u8ModbusADUSize >= 5) + + // Разобрать ADU по словам в буфер (данные готовы) + if (!u8MBStatus) + { + // Разбор данных в зависимости от кода функции Modbus + switch(u8ModbusADU[1]) + { + case ku8MBReadCoils: + case ku8MBReadDiscreteInputs: + // load bytes into word; response bytes are ordered L, H, L, H, ... + // Загрузка байт в слово; байты ответа упорядочиваются L, H, L, H, ... + for (i = 0; i < (u8ModbusADU[2] >> 1); i++) + { + if (i < ku8MaxBufferSize) + { + _u16ResponseBuffer[i] = word(u8ModbusADU[2 * i + 4], u8ModbusADU[2 * i + 3]); + } + + _u8ResponseBufferLength = i; + } + + // in the event of an odd number of bytes, load last byte into zero-padded word + // в случае нечетного числа байт, загрузка последнего байта в дополняется нулями + if (u8ModbusADU[2] % 2) + { + if (i < ku8MaxBufferSize) + { + _u16ResponseBuffer[i] = word(0, u8ModbusADU[2 * i + 3]); + } + + _u8ResponseBufferLength = i + 1; + } + break; + + case ku8MBReadInputRegisters: + case ku8MBReadHoldingRegisters: + case ku8MBReadWriteMultipleRegisters: + // Загрузка байт в слово; байты ответа упорядочиваются H, L, H, L, ... + for (i = 0; i < (u8ModbusADU[2] >> 1); i++) + { + if (i < ku8MaxBufferSize) + { + _u16ResponseBuffer[i] = word(u8ModbusADU[2 * i + 3], u8ModbusADU[2 * i + 4]); + } + + _u8ResponseBufferLength = i; + } + break; + case ku8MBLinkTestOmronMX2Only: // Сохранение кода возврата + _u16ResponseBuffer[0] = word(u8ModbusADU[4], u8ModbusADU[5]); + break; + } // switch(u8ModbusADU[1]) + } else { + _u16ResponseBuffer[0] = word(0,u8ModbusADU[2]); // ошибка - записать код ошибки в буфер + } + + _u8TransmitBufferIndex = 0; + u16TransmitBufferLength = 0; + _u8ResponseBufferIndex = 0; + last_transaction_time = millis(); +#ifdef MODBUSMASTER_DEBUG + Serial.print(" E: "); Serial.println(millis()); +#endif + return u8MBStatus; +} + +/** @ingroup util_crc16 + Processor-independent CRC-16 calculation. + + Polynomial: x^16 + x^15 + x^2 + 1 (0xA001)
+ Initial value: 0xFFFF + + This CRC is normally used in disk-drive controllers. + + @param uint16_t crc (0x0000..0xFFFF) + @param uint8_t a (0x00..0xFF) + @return calculated CRC (0x0000..0xFFFF) +*/ +uint16_t crc16_update(uint16_t crc, uint8_t a) +{ + int i; + + crc ^= a; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; + else + crc = (crc >> 1); + } + + return crc; +} diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.h b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.h new file mode 100644 index 0000000..ebd4e20 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusMaster.h @@ -0,0 +1,278 @@ +/* +Доработка библиотеки для "Народного контроллера теплового насоса" +Автор pav2000 firstlast2007@gmail.com +Добавлены изменения для работы с инвертором Omron MX2 +- поддерживается функция проверки связи (код функции 0х08) +для проверки функции используйте LinkTestOmronMX2Only(code) +где code - проверочный код (любое число uint16_t), +в случае успеха первый элемент буфера будет содержать этот код +- сделана обработка ошибок инвертора (в коде функции добавляется 0х80) +при этом возвращается состяние ku8MBErrorOmronMX2, +первый элемент буфера при этом содержит код ошибки +* +* Some additional - vad7@yahoo.com +*/ + +/** +@file +Arduino library for communicating with Modbus slaves over RS232/485 (via RTU protocol). +*/ +/* + ModbusMaster.h - Arduino library for communicating with Modbus slaves + over RS232/485 (via RTU protocol). + + Library:: ModbusMaster + + Copyright:: 2009-2016 Doc Walker + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef ModbusMaster_h +#define ModbusMaster_h + +#define MODBUSMASTER_DEBUG // Отладка - посылка приема и передачи в Serial +// #define MODBUS_FREERTOS // Настроить либу на многозадачность + +#include "Arduino.h" // include types & constants of Wiring core API +#include "util/crc16.h" // functions to calculate Modbus Application Data Unit CRC +#include "util/word.h" // functions to manipulate words + +#ifdef MODBUS_FREERTOS +#include "FreeRTOS_ARM.h" // поддержка многозадачности +#endif + +#define MIN_TIME_BETWEEN_TRANSACTION 30 // ms + +// Коды функций Modbus +// Modbus function codes for bit access +#define ku8MBReadCoils 0x01 ///< Modbus function 0x01 Read Coils +#define ku8MBReadDiscreteInputs 0x02 ///< Modbus function 0x02 Read Discrete Inputs +#define ku8MBWriteSingleCoil 0x05 ///< Modbus function 0x05 Write Single Coil +#define ku8MBWriteMultipleCoils 0x0F ///< Modbus function 0x0F Write Multiple Coils + +// Modbus function codes for 16 bit access +#define ku8MBReadHoldingRegisters 0x03 ///< Modbus function 0x03 Read Holding Registers +#define ku8MBReadInputRegisters 0x04 ///< Modbus function 0x04 Read Input Registers +#define ku8MBWriteSingleRegister 0x06 ///< Modbus function 0x06 Write Single Register +#define ku8MBWriteMultipleRegisters 0x10 ///< Modbus function 0x10 Write Multiple Registers +#define ku8MBMaskWriteRegister 0x16 ///< Modbus function 0x16 Mask Write Register +#define ku8MBReadWriteMultipleRegisters 0x17 ///< Modbus function 0x17 Read Write Multiple Registers +#define ku8MBLinkTestOmronMX2Only 0x08 ///< Modbus function 0x08 Тест связи с инвертром Omron MX2 функция только для него +// 8 bit +#define ku8MBCustomRequest 0x09 // Custom request, prepare send buffer - send(uint8_t) //vad7 + +/** +Arduino class library for communicating with Modbus slaves over +RS232/485 (via RTU protocol). +*/ +class ModbusMaster +{ + public: + ModbusMaster(); + + void begin(uint8_t, Stream &serial); + inline uint8_t set_slave(uint8_t slave) {return _u8MBSlave=slave;} // Установить slave + void idle(void (*)()); + void preTransmission(void (*)()); + void postTransmission(void (*)()); + + // Modbus exception codes + /** + Modbus protocol illegal function exception. + + The function code received in the query is not an allowable action for + the server (or slave). This may be because the function code is only + applicable to newer devices, and was not implemented in the unit + selected. It could also indicate that the server (or slave) is in the + wrong state to process a request of this type, for example because it is + unconfigured and is being asked to return register values. + + @ingroup constant + */ + static const uint8_t ku8MBIllegalFunction = 0x01; + + /** + Modbus protocol illegal data address exception. + + The data address received in the query is not an allowable address for + the server (or slave). More specifically, the combination of reference + number and transfer length is invalid. For a controller with 100 + registers, the ADU addresses the first register as 0, and the last one + as 99. If a request is submitted with a starting register address of 96 + and a quantity of registers of 4, then this request will successfully + operate (address-wise at least) on registers 96, 97, 98, 99. If a + request is submitted with a starting register address of 96 and a + quantity of registers of 5, then this request will fail with Exception + Code 0x02 "Illegal Data Address" since it attempts to operate on + registers 96, 97, 98, 99 and 100, and there is no register with address + 100. + + @ingroup constant + */ + static const uint8_t ku8MBIllegalDataAddress = 0x02; + + /** + Modbus protocol illegal data value exception. + + A value contained in the query data field is not an allowable value for + server (or slave). This indicates a fault in the structure of the + remainder of a complex request, such as that the implied length is + incorrect. It specifically does NOT mean that a data item submitted for + storage in a register has a value outside the expectation of the + application program, since the MODBUS protocol is unaware of the + significance of any particular value of any particular register. + + @ingroup constant + */ + static const uint8_t ku8MBIllegalDataValue = 0x03; + + /** + Modbus protocol slave device failure exception. + + An unrecoverable error occurred while the server (or slave) was + attempting to perform the requested action. + + @ingroup constant + */ + static const uint8_t ku8MBSlaveDeviceFailure = 0x04; + + // Class-defined success/exception codes + /** + ModbusMaster success. + + Modbus transaction was successful; the following checks were valid: + - slave ID + - function code + - response code + - data + - CRC + + @ingroup constant + */ + static const uint8_t ku8MBSuccess = 0x00; + + /** + ModbusMaster invalid response slave ID exception. + + The slave ID in the response does not match that of the request. + + @ingroup constant + */ + static const uint8_t ku8MBInvalidSlaveID = 0xE0; + + /** + ModbusMaster invalid response function exception. + + The function code in the response does not match that of the request. + + @ingroup constant + */ + static const uint8_t ku8MBInvalidFunction = 0xE1; + + /** + ModbusMaster response timed out exception. + + The entire response was not received within the timeout period, + ModbusMaster::ku8MBResponseTimeout. + + @ingroup constant + */ + static const uint8_t ku8MBResponseTimedOut = 0xE2; + + /** + ModbusMaster invalid response CRC exception. + + The CRC in the response does not match the one calculated. + + @ingroup constant + */ + static const uint8_t ku8MBInvalidCRC = 0xE3; + + + // Обнаружена спицефическая ошибка Omron MX2, счетчика PZEM-004T + // В случае обнаружения ошибки в запросе (кроме ошибки связи) + // преобразователь частоты возвращает в ответе сообщение об исключении и не выполняет никаких действий. + // Ошибку можно найти по коду функции в ответе. Код функции для ответа с + // сообщением об ошибке определяется как сумма кода функции запроса и числа 80h. + // Для кодирования используется ku8MBErrorOmronMX2+Код_исключения (третий байт пакета) + static const uint8_t ku8MBExtendedError = 0x08; + + uint16_t getResponseBuffer(uint8_t); + void clearResponseBuffer(); + uint8_t setTransmitBuffer(uint8_t, uint16_t); + void clearTransmitBuffer(); + + void beginTransmission(uint16_t); + //uint8_t requestFrom(uint16_t, uint16_t); + void sendBit(bool); + void send(uint8_t); + void send(uint16_t); + void send(uint32_t); + uint8_t available(void); + uint16_t receive(void); + + + uint8_t readCoils(uint16_t, uint16_t); + uint8_t readDiscreteInputs(uint16_t, uint16_t); + uint8_t readHoldingRegisters(uint16_t, uint16_t); + uint8_t readInputRegisters(uint16_t, uint8_t); + uint8_t writeSingleCoil(uint16_t, uint8_t); + uint8_t writeSingleRegister(uint16_t, uint16_t); + uint8_t writeMultipleCoils(uint16_t, uint16_t); + uint8_t writeMultipleCoils(); + uint8_t writeMultipleRegisters(uint16_t, uint16_t); + uint8_t writeMultipleRegisters(); + uint8_t maskWriteRegister(uint16_t, uint16_t, uint16_t); + uint8_t readWriteMultipleRegisters(uint16_t, uint16_t, uint16_t, uint16_t); + uint8_t readWriteMultipleRegisters(uint16_t, uint16_t); + uint8_t LinkTestOmronMX2Only(uint16_t); + + // master function that conducts Modbus transactions + uint8_t ModbusMasterTransaction(uint8_t u8MBFunction); + + private: + Stream* _serial; ///< reference to serial port object + uint8_t _u8MBSlave; ///< Modbus slave (1..255) initialized in begin() + static const uint8_t ku8MaxBufferSize = 64; ///< size of response/transmit buffers + uint16_t _u16ReadAddress; ///< slave register from which to read + uint16_t _u16ReadQty; ///< quantity of words to read + uint16_t _u16ResponseBuffer[ku8MaxBufferSize]; ///< buffer to store Modbus slave response; read via GetResponseBuffer() + uint16_t _u16WriteAddress; ///< slave register to which to write + uint16_t _u16WriteQty; ///< quantity of words to write + uint16_t _u16TransmitBuffer[ku8MaxBufferSize]; ///< buffer containing data to transmit to Modbus slave; set via SetTransmitBuffer() + uint16_t* txBuffer; // from Wire.h -- need to clean this up Rx + uint8_t _u8TransmitBufferIndex; + uint16_t u16TransmitBufferLength; + uint16_t* rxBuffer; // from Wire.h -- need to clean this up Rx + uint8_t _u8ResponseBufferIndex; + uint8_t _u8ResponseBufferLength; + uint32_t last_transaction_time; + + // Modbus timeout [milliseconds] Depend on serial speed + static const uint16_t ku16MBResponseTimeout = 100; ///< Modbus timeout, every byte [milliseconds] + + // idle callback function; gets called during idle time between TX and RX + void (*_idle)(); + // preTransmission callback function; gets called before writing a Modbus message + void (*_preTransmission)(); + // postTransmission callback function; gets called after a Modbus message has been sent + void (*_postTransmission)(); +}; +#endif + +/** +@example examples/Basic/Basic.pde +@example examples/PhoenixContact_nanoLC/PhoenixContact_nanoLC.pde +@example examples/RS485_HalfDuplex/RS485_HalfDuplex.ino +*/ diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusRtu.h b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusRtu.h new file mode 100644 index 0000000..a2a2530 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/ModbusRtu.h @@ -0,0 +1,1449 @@ +/** + * @file ModbusRtu.h + * @version 1.21 (modified by CONTROLLINO team) + * @date 2016.02.21 (2017.03.30) + * @author Samuel Marco i Armengol (Thank you, Samuel!) + * @contact sammarcoarmengol@gmail.com + * @contribution Helium6072 + * + * @description + * Arduino library for communicating with Modbus devices + * over RS232/USB/485 via RTU protocol. + * + * Further information: + * http://modbus.org/ + * http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf + * + * @license + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version + * 2.1 of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * @defgroup setup Modbus Object Instantiation/Initialization + * @defgroup loop Modbus Object Management + * @defgroup buffer Modbus Buffer Management + * @defgroup discrete Modbus Function Codes for Discrete Coils/Inputs + * @defgroup register Modbus Function Codes for Holding/Input Registers + * + */ + +#include +#include "Arduino.h" +#include "Print.h" +#include + +#define RS485_PIN_DE 0b01000000 +#define RS485_PIN_RE 0b00100000 +#define RS485_DIR_REG DDRJ +#define RS485_PORT_REG PORTJ +#define RS485_CLEAR_DE RS485_PORT_REG &= ~RS485_PIN_DE +#define RS485_CLEAR_RE RS485_PORT_REG &= ~RS485_PIN_RE +#define RS485_SET_DE RS485_PORT_REG |= RS485_PIN_DE +#define RS485_SET_RE RS485_PORT_REG |= RS485_PIN_RE + + +/** + * @struct modbus_t + * @brief + * Master query structure: + * This includes all the necessary fields to make the Master generate a Modbus query. + * A Master may keep several of these structures and send them cyclically or + * use them according to program needs. + */ +typedef struct +{ + uint8_t u8id; /*!< Slave address between 1 and 247. 0 means broadcast */ + uint8_t u8fct; /*!< Function code: 1, 2, 3, 4, 5, 6, 15 or 16 */ + uint16_t u16RegAdd; /*!< Address of the first register to access at slave/s */ + uint16_t u16CoilsNo; /*!< Number of coils or registers to access */ + uint16_t *au16reg; /*!< Pointer to memory image in master */ +} +modbus_t; + +enum +{ + RESPONSE_SIZE = 6, + EXCEPTION_SIZE = 3, + CHECKSUM_SIZE = 2 +}; + +/** + * @enum MESSAGE + * @brief + * Indexes to telegram frame positions + */ +enum MESSAGE +{ + ID = 0, //!< ID field + FUNC, //!< Function code position + ADD_HI, //!< Address high byte + ADD_LO, //!< Address low byte + NB_HI, //!< Number of coils or registers high byte + NB_LO, //!< Number of coils or registers low byte + BYTE_CNT //!< byte counter +}; + +/** + * @enum MB_FC + * @brief + * Modbus function codes summary. + * These are the implement function codes either for Master or for Slave. + * + * @see also fctsupported + * @see also modbus_t + */ +enum MB_FC +{ + MB_FC_NONE = 0, /*!< null operator */ + MB_FC_READ_COILS = 1, /*!< FCT=1 -> read coils or digital outputs */ + MB_FC_READ_DISCRETE_INPUT = 2, /*!< FCT=2 -> read digital inputs */ + MB_FC_READ_REGISTERS = 3, /*!< FCT=3 -> read registers or analog outputs */ + MB_FC_READ_INPUT_REGISTER = 4, /*!< FCT=4 -> read analog inputs */ + MB_FC_WRITE_COIL = 5, /*!< FCT=5 -> write single coil or output */ + MB_FC_WRITE_REGISTER = 6, /*!< FCT=6 -> write single register */ + MB_FC_WRITE_MULTIPLE_COILS = 15, /*!< FCT=15 -> write multiple coils or outputs */ + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 /*!< FCT=16 -> write multiple registers */ +}; + +enum COM_STATES +{ + COM_IDLE = 0, + COM_WAITING = 1 + +}; + +enum ERR_LIST +{ + ERR_NOT_MASTER = -1, + ERR_POLLING = -2, + ERR_BUFF_OVERFLOW = -3, + ERR_BAD_CRC = -4, + ERR_EXCEPTION = -5 +}; + +enum +{ + NO_REPLY = 255, + EXC_FUNC_CODE = 1, + EXC_ADDR_RANGE = 2, + EXC_REGS_QUANT = 3, + EXC_EXECUTE = 4 +}; + +const unsigned char fctsupported[] = +{ + MB_FC_READ_COILS, + MB_FC_READ_DISCRETE_INPUT, + MB_FC_READ_REGISTERS, + MB_FC_READ_INPUT_REGISTER, + MB_FC_WRITE_COIL, + MB_FC_WRITE_REGISTER, + MB_FC_WRITE_MULTIPLE_COILS, + MB_FC_WRITE_MULTIPLE_REGISTERS +}; + +#define T35 5 +#define MAX_BUFFER 64 //!< maximum size for the communication buffer in bytes + +/** + * @class Modbus + * @brief + * Arduino class library for communicating with Modbus devices over + * USB/RS232/485 (via RTU protocol). + */ +class Modbus +{ +private: + HardwareSerial *port; //!< Pointer to Serial class object + SoftwareSerial *softPort; //!< Pointer to SoftwareSerial class object + uint8_t u8id; //!< 0=master, 1..247=slave number + uint8_t u8serno; //!< serial port: 0-Serial, 1..3-Serial1..Serial3; 4: use software serial + uint8_t u8txenpin; //!< flow control pin: 0=USB or RS-232 mode, >0=RS-485 mode + uint8_t u8state; + uint8_t u8lastError; + uint8_t au8Buffer[MAX_BUFFER]; + uint8_t u8BufferSize; + uint8_t u8lastRec; + uint16_t *au16regs; + uint16_t u16InCnt, u16OutCnt, u16errCnt; + uint16_t u16timeOut; + uint32_t u32time, u32timeOut; + uint8_t u8regsize; + + void init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + void init(uint8_t u8id); + void sendTxBuffer(); + int8_t getRxBuffer(); + uint16_t calcCRC(uint8_t u8length); + uint8_t validateAnswer(); + uint8_t validateRequest(); + void get_FC1(); + void get_FC3(); + int8_t process_FC1( uint16_t *regs, uint8_t u8size ); + int8_t process_FC3( uint16_t *regs, uint8_t u8size ); + int8_t process_FC5( uint16_t *regs, uint8_t u8size ); + int8_t process_FC6( uint16_t *regs, uint8_t u8size ); + int8_t process_FC15( uint16_t *regs, uint8_t u8size ); + int8_t process_FC16( uint16_t *regs, uint8_t u8size ); + void buildException( uint8_t u8exception ); // build exception message + +public: + Modbus(); + Modbus(uint8_t u8id, uint8_t u8serno); + Modbus(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin); + Modbus(uint8_t u8id); + void begin(long u32speed); + void begin(SoftwareSerial *sPort, long u32speed); + void begin(long u32speed, uint8_t u8config); + void begin(); + void setTimeOut( uint16_t u16timeout); //!begin(u32speed); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while(port->read() >= 0); + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the software serial port using specified baud rate and SoftwareSerial object. + * Call once class has been instantiated, typically within setup(). + * + * @param speed *softPort, pointer to SoftwareSerial class object + * @param speed baud rate, in standard increments (300..115200) + * @ingroup setup + */ +void Modbus::begin(SoftwareSerial *sPort, long u32speed) +{ + + softPort=sPort; + + softPort->begin(u32speed); + + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //pinMode(u8txenpin, OUTPUT); + //digitalWrite(u8txenpin, LOW); + } + + while(softPort->read() >= 0); + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize class object. + * + * Sets up the serial port using specified baud rate. + * Call once class has been instantiated, typically within setup(). + * + * @see http://arduino.cc/en/Serial/Begin#.Uy4CJ6aKlHY + * @param speed baud rate, in standard increments (300..115200) + * @param config data frame settings (data length, parity and stop bits) + * @ingroup setup + */ +void Modbus::begin(long u32speed,uint8_t u8config) +{ + + switch( u8serno ) + { +#if defined(UBRR1H) + case 1: + port = &Serial1; + break; +#endif + +#if defined(UBRR2H) + case 2: + port = &Serial2; + break; +#endif + +#if defined(UBRR3H) + case 3: + port = &Serial3; + break; +#endif + case 0: + default: + port = &Serial; + break; + } + + port->begin(u32speed, u8config); + if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX + { + // return RS485 transceiver to transmit mode + RS485_DIR_REG |= RS485_PIN_DE | RS485_PIN_RE; + RS485_CLEAR_DE; + RS485_CLEAR_RE; + // pinMode(u8txenpin, OUTPUT); + // digitalWrite(u8txenpin, LOW); + } + + while(port->read() >= 0); + u8lastRec = u8BufferSize = 0; + u16InCnt = u16OutCnt = u16errCnt = 0; +} + +/** + * @brief + * Initialize default class object. + * + * Sets up the serial port using 19200 baud. + * Call once class has been instantiated, typically within setup(). + * + * @overload Modbus::begin(uint16_t u16BaudRate) + * @ingroup setup + */ +void Modbus::begin() +{ + begin(19200); +} + +/** + * @brief + * Method to write a new slave ID address + * + * @param u8id new slave address between 1 and 247 + * @ingroup setup + */ +void Modbus::setID( uint8_t u8id) +{ + if (( u8id != 0) && (u8id <= 247)) + { + this->u8id = u8id; + } +} + +/** + * @brief + * Method to read current slave ID address + * + * @return u8id current slave address between 1 and 247 + * @ingroup setup + */ +uint8_t Modbus::getID() +{ + return this->u8id; +} + +/** + * @brief + * Initialize time-out parameter + * + * Call once class has been instantiated, typically within setup(). + * The time-out timer is reset each time that there is a successful communication + * between Master and Slave. It works for both. + * + * @param time-out value (ms) + * @ingroup setup + */ +void Modbus::setTimeOut( uint16_t u16timeOut) +{ + this->u16timeOut = u16timeOut; +} + +/** + * @brief + * Return communication Watchdog state. + * It could be usefull to reset outputs if the watchdog is fired. + * + * @return TRUE if millis() > u32timeOut + * @ingroup loop + */ +boolean Modbus::getTimeOutState() +{ + return (millis() > u32timeOut); +} + +/** + * @brief + * Get input messages counter value + * This can be useful to diagnose communication + * + * @return input messages counter + * @ingroup buffer + */ +uint16_t Modbus::getInCnt() +{ + return u16InCnt; +} + +/** + * @brief + * Get transmitted messages counter value + * This can be useful to diagnose communication + * + * @return transmitted messages counter + * @ingroup buffer + */ +uint16_t Modbus::getOutCnt() +{ + return u16OutCnt; +} + +/** + * @brief + * Get errors counter value + * This can be useful to diagnose communication + * + * @return errors counter + * @ingroup buffer + */ +uint16_t Modbus::getErrCnt() +{ + return u16errCnt; +} + +/** + * Get modbus master state + * + * @return = 0 IDLE, = 1 WAITING FOR ANSWER + * @ingroup buffer + */ +uint8_t Modbus::getState() +{ + return u8state; +} + +/** + * Get the last error in the protocol processor + * + * @returnreturn NO_REPLY = 255 Time-out + * @return EXC_FUNC_CODE = 1 Function code not available + * @return EXC_ADDR_RANGE = 2 Address beyond available space for Modbus registers + * @return EXC_REGS_QUANT = 3 Coils or registers number beyond the available space + * @ingroup buffer + */ +uint8_t Modbus::getLastError() +{ + return u8lastError; +} + +/** + * @brief + * *** Only Modbus Master *** + * Generate a query to an slave with a modbus_t telegram structure + * The Master must be in COM_IDLE mode. After it, its state would be COM_WAITING. + * This method has to be called only in loop() section. + * + * @see modbus_t + * @param modbus_t modbus telegram structure (id, fct, ...) + * @ingroup loop + * @todo finish function 15 + */ +int8_t Modbus::query( modbus_t telegram ) +{ + uint8_t u8regsno, u8bytesno; + if (u8id!=0) return -2; + if (u8state != COM_IDLE) return -1; + + if ((telegram.u8id==0) || (telegram.u8id>247)) return -3; + + au16regs = telegram.au16reg; + + // telegram header + au8Buffer[ ID ] = telegram.u8id; + au8Buffer[ FUNC ] = telegram.u8fct; + au8Buffer[ ADD_HI ] = highByte(telegram.u16RegAdd ); + au8Buffer[ ADD_LO ] = lowByte( telegram.u16RegAdd ); + + switch( telegram.u8fct ) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_READ_REGISTERS: + case MB_FC_READ_INPUT_REGISTER: + au8Buffer[ NB_HI ] = highByte(telegram.u16CoilsNo ); + au8Buffer[ NB_LO ] = lowByte( telegram.u16CoilsNo ); + u8BufferSize = 6; + break; + case MB_FC_WRITE_COIL: + au8Buffer[ NB_HI ] = ((au16regs[0] > 0) ? 0xff : 0); + au8Buffer[ NB_LO ] = 0; + u8BufferSize = 6; + break; + case MB_FC_WRITE_REGISTER: + au8Buffer[ NB_HI ] = highByte(au16regs[0]); + au8Buffer[ NB_LO ] = lowByte(au16regs[0]); + u8BufferSize = 6; + break; + case MB_FC_WRITE_MULTIPLE_COILS: // TODO: implement "sending coils" + u8regsno = telegram.u16CoilsNo / 16; + u8bytesno = u8regsno * 2; + if ((telegram.u16CoilsNo % 16) != 0) + { + u8bytesno++; + u8regsno++; + } + + au8Buffer[ NB_HI ] = highByte(telegram.u16CoilsNo ); + au8Buffer[ NB_LO ] = lowByte( telegram.u16CoilsNo ); + au8Buffer[ NB_LO+1 ] = u8bytesno; + u8BufferSize = 7; + + u8regsno = u8bytesno = 0; // now auxiliary registers + for (uint16_t i = 0; i < telegram.u16CoilsNo; i++) + { + + + } + break; + + case MB_FC_WRITE_MULTIPLE_REGISTERS: + au8Buffer[ NB_HI ] = highByte(telegram.u16CoilsNo ); + au8Buffer[ NB_LO ] = lowByte( telegram.u16CoilsNo ); + au8Buffer[ NB_LO+1 ] = (uint8_t) ( telegram.u16CoilsNo * 2 ); + u8BufferSize = 7; + + for (uint16_t i=0; i< telegram.u16CoilsNo; i++) + { + au8Buffer[ u8BufferSize ] = highByte( au16regs[ i ] ); + u8BufferSize++; + au8Buffer[ u8BufferSize ] = lowByte( au16regs[ i ] ); + u8BufferSize++; + } + break; + } + + sendTxBuffer(); + u8state = COM_WAITING; + return 0; +} + +/** + * @brief *** Only for Modbus Master *** + * This method checks if there is any incoming answer if pending. + * If there is no answer, it would change Master state to COM_IDLE. + * This method must be called only at loop section. + * Avoid any delay() function. + * + * Any incoming data would be redirected to au16regs pointer, + * as defined in its modbus_t query telegram. + * + * @params nothing + * @return errors counter + * @ingroup loop + */ +int8_t Modbus::poll() +{ + // check if there is any incoming frame + uint8_t u8current; + if(u8serno<4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (millis() > u32timeOut) + { + u8state = COM_IDLE; + u8lastError = NO_REPLY; + u16errCnt++; + return 0; + } + + if (u8current == 0) return 0; + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) return 0; + + // transfer Serial buffer frame to auBuffer + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + if (i8state < 7) + { + u8state = COM_IDLE; + u16errCnt++; + return i8state; + } + + // validate message: id, CRC, FCT, exception + uint8_t u8exception = validateAnswer(); + if (u8exception != 0) + { + u8state = COM_IDLE; + return u8exception; + } + + // process answer + switch( au8Buffer[ FUNC ] ) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + // call get_FC1 to transfer the incoming message to au16regs buffer + get_FC1( ); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS : + // call get_FC3 to transfer the incoming message to au16regs buffer + get_FC3( ); + break; + case MB_FC_WRITE_COIL: + case MB_FC_WRITE_REGISTER : + case MB_FC_WRITE_MULTIPLE_COILS: + case MB_FC_WRITE_MULTIPLE_REGISTERS : + // nothing to do + break; + default: + break; + } + u8state = COM_IDLE; + return u8BufferSize; +} + +/** + * @brief + * *** Only for Modbus Slave *** + * This method checks if there is any incoming query + * Afterwards, it would shoot a validation routine plus a register query + * Avoid any delay() function !!!! + * After a successful frame between the Master and the Slave, the time-out timer is reset. + * + * @param *regs register table for communication exchange + * @param u8size size of the register table + * @return 0 if no query, 1..4 if communication error, >4 if correct query processed + * @ingroup loop + */ +int8_t Modbus::poll( uint16_t *regs, uint8_t u8size ) +{ + + au16regs = regs; + u8regsize = u8size; + uint8_t u8current; + + + // check if there is any incoming frame + if(u8serno<4) + u8current = port->available(); + else + u8current = softPort->available(); + + if (u8current == 0) return 0; + + // check T35 after frame end or still no frame end + if (u8current != u8lastRec) + { + u8lastRec = u8current; + u32time = millis() + T35; + return 0; + } + if (millis() < u32time) return 0; + + u8lastRec = 0; + int8_t i8state = getRxBuffer(); + u8lastError = i8state; + if (i8state < 7) return i8state; + + // check slave id + if (au8Buffer[ ID ] != u8id) return 0; + + // validate message: CRC, FCT, address and size + uint8_t u8exception = validateRequest(); + if (u8exception > 0) + { + if (u8exception != NO_REPLY) + { + buildException( u8exception ); + sendTxBuffer(); + } + u8lastError = u8exception; + return u8exception; + } + + u32timeOut = millis() + long(u16timeOut); + u8lastError = 0; + + // process message + switch( au8Buffer[ FUNC ] ) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + return process_FC1( regs, u8size ); + break; + case MB_FC_READ_INPUT_REGISTER: + case MB_FC_READ_REGISTERS : + return process_FC3( regs, u8size ); + break; + case MB_FC_WRITE_COIL: + return process_FC5( regs, u8size ); + break; + case MB_FC_WRITE_REGISTER : + return process_FC6( regs, u8size ); + break; + case MB_FC_WRITE_MULTIPLE_COILS: + return process_FC15( regs, u8size ); + break; + case MB_FC_WRITE_MULTIPLE_REGISTERS : + return process_FC16( regs, u8size ); + break; + default: + break; + } + return i8state; +} + +/* _____PRIVATE FUNCTIONS_____________________________________________________ */ + +void Modbus::init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin) +{ + this->u8id = u8id; + this->u8serno = (u8serno > 3) ? 0 : u8serno; + + // this->u8txenpin = u8txenpin; + this->u8txenpin = 2; // Ignore input parameter u8txenpin and hardcode 2 for compatibility + + this->u16timeOut = 1000; +} + +void Modbus::init(uint8_t u8id) +{ + this->u8id = u8id; + this->u8serno = 4; + this->u8txenpin = 0; + this->u16timeOut = 1000; +} + +/** + * @brief + * This method moves Serial buffer data to the Modbus au8Buffer. + * + * @return buffer size if OK, ERR_BUFF_OVERFLOW if u8BufferSize >= MAX_BUFFER + * @ingroup buffer + */ +int8_t Modbus::getRxBuffer() +{ + boolean bBuffOverflow = false; + + if (u8txenpin > 1) + { + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + + u8BufferSize = 0; + if(u8serno<4) + while ( port->available() ) + { + au8Buffer[ u8BufferSize ] = port->read(); + u8BufferSize ++; + + if (u8BufferSize >= MAX_BUFFER) bBuffOverflow = true; + } + else + while ( softPort->available() ) + { + au8Buffer[ u8BufferSize ] = softPort->read(); + u8BufferSize ++; + + if (u8BufferSize >= MAX_BUFFER) bBuffOverflow = true; + } + u16InCnt++; + + if (bBuffOverflow) + { + u16errCnt++; + return ERR_BUFF_OVERFLOW; + } + return u8BufferSize; +} + +/** + * @brief + * This method transmits au8Buffer to Serial line. + * Only if u8txenpin != 0, there is a flow handling in order to keep + * the RS485 transceiver in output state as long as the message is being sent. + * This is done with UCSRxA register. + * The CRC is appended to the buffer before starting to send it. + * + * @param nothing + * @return nothing + * @ingroup buffer + */ +void Modbus::sendTxBuffer() +{ + uint8_t i = 0; + + // append CRC to message + uint16_t u16crc = calcCRC( u8BufferSize ); + au8Buffer[ u8BufferSize ] = u16crc >> 8; + u8BufferSize++; + au8Buffer[ u8BufferSize ] = u16crc & 0x00ff; + u8BufferSize++; + + // set RS485 transceiver to transmit mode + if (u8txenpin > 1) + { + switch( u8serno ) + { +#if defined(UBRR1H) + case 1: + UCSR1A=UCSR1A |(1 << TXC1); + break; +#endif + +#if defined(UBRR2H) + case 2: + UCSR2A=UCSR2A |(1 << TXC2); + break; +#endif + +#if defined(UBRR3H) + case 3: + UCSR3A=UCSR3A |(1 << TXC3); + break; +#endif + case 0: + default: + UCSR0A=UCSR0A |(1 << TXC0); + break; + } + RS485_SET_DE; + RS485_SET_RE; + //digitalWrite( u8txenpin, HIGH ); + } + + // transfer buffer to serial line + if(u8serno<4) + port->write( au8Buffer, u8BufferSize ); + else + softPort->write( au8Buffer, u8BufferSize ); + + // keep RS485 transceiver in transmit mode as long as sending + if (u8txenpin > 1) + { + switch( u8serno ) + { +#if defined(UBRR1H) + case 1: + while (!(UCSR1A & (1 << TXC1))); + break; +#endif + +#if defined(UBRR2H) + case 2: + while (!(UCSR2A & (1 << TXC2))); + break; +#endif + +#if defined(UBRR3H) + case 3: + while (!(UCSR3A & (1 << TXC3))); + break; +#endif + case 0: + default: + while (!(UCSR0A & (1 << TXC0))); + break; + } + + // return RS485 transceiver to receive mode + RS485_CLEAR_DE; + RS485_CLEAR_RE; + //digitalWrite( u8txenpin, LOW ); + } + if(u8serno<4) + while(port->read() >= 0); + else + while(softPort->read() >= 0); + + u8BufferSize = 0; + + // set time-out for master + u32timeOut = millis() + (unsigned long) u16timeOut; + + // increase message counter + u16OutCnt++; +} + +/** + * @brief + * This method calculates CRC + * + * @return uint16_t calculated CRC value for the message + * @ingroup buffer + */ +uint16_t Modbus::calcCRC(uint8_t u8length) +{ + unsigned int temp, temp2, flag; + temp = 0xFFFF; + for (unsigned char i = 0; i < u8length; i++) + { + temp = temp ^ au8Buffer[i]; + for (unsigned char j = 1; j <= 8; j++) + { + flag = temp & 0x0001; + temp >>=1; + if (flag) + temp ^= 0xA001; + } + } + // Reverse byte order. + temp2 = temp >> 8; + temp = (temp << 8) | temp2; + temp &= 0xFFFF; + // the returned value is already swapped + // crcLo byte is first & crcHi byte is last + return temp; +} + +/** + * @brief + * This method validates slave incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateRequest() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) + | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if ( calcCRC( u8BufferSize-2 ) != u16MsgCRC ) + { + u16errCnt ++; + return NO_REPLY; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i< sizeof( fctsupported ); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt ++; + return EXC_FUNC_CODE; + } + + // check start address & nb range + uint16_t u16regs = 0; + uint8_t u8regs; + switch ( au8Buffer[ FUNC ] ) + { + case MB_FC_READ_COILS: + case MB_FC_READ_DISCRETE_INPUT: + case MB_FC_WRITE_MULTIPLE_COILS: + u16regs = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ]) / 16; + u16regs += word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ]) /16; + u8regs = (uint8_t) u16regs; + if (u8regs > u8regsize) return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_COIL: + u16regs = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ]) / 16; + u8regs = (uint8_t) u16regs; + if (u8regs > u8regsize) return EXC_ADDR_RANGE; + break; + case MB_FC_WRITE_REGISTER : + u16regs = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ]); + u8regs = (uint8_t) u16regs; + if (u8regs > u8regsize) return EXC_ADDR_RANGE; + break; + case MB_FC_READ_REGISTERS : + case MB_FC_READ_INPUT_REGISTER : + case MB_FC_WRITE_MULTIPLE_REGISTERS : + u16regs = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ]); + u16regs += word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ]); + u8regs = (uint8_t) u16regs; + if (u8regs > u8regsize) return EXC_ADDR_RANGE; + break; + } + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method validates master incoming messages + * + * @return 0 if OK, EXCEPTION if anything fails + * @ingroup buffer + */ +uint8_t Modbus::validateAnswer() +{ + // check message crc vs calculated crc + uint16_t u16MsgCRC = + ((au8Buffer[u8BufferSize - 2] << 8) + | au8Buffer[u8BufferSize - 1]); // combine the crc Low & High bytes + if ( calcCRC( u8BufferSize-2 ) != u16MsgCRC ) + { + u16errCnt ++; + return NO_REPLY; + } + + // check exception + if ((au8Buffer[ FUNC ] & 0x80) != 0) + { + u16errCnt ++; + return ERR_EXCEPTION; + } + + // check fct code + boolean isSupported = false; + for (uint8_t i = 0; i< sizeof( fctsupported ); i++) + { + if (fctsupported[i] == au8Buffer[FUNC]) + { + isSupported = 1; + break; + } + } + if (!isSupported) + { + u16errCnt ++; + return EXC_FUNC_CODE; + } + + return 0; // OK, no exception code thrown +} + +/** + * @brief + * This method builds an exception message + * + * @ingroup buffer + */ +void Modbus::buildException( uint8_t u8exception ) +{ + uint8_t u8func = au8Buffer[ FUNC ]; // get the original FUNC code + + au8Buffer[ ID ] = u8id; + au8Buffer[ FUNC ] = u8func + 0x80; + au8Buffer[ 2 ] = u8exception; + u8BufferSize = EXCEPTION_SIZE; +} + +/** + * This method processes functions 1 & 2 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + * TODO: finish its implementation + */ +void Modbus::get_FC1() +{ + uint8_t u8byte, i; + u8byte = 0; + + // for (i=0; i< au8Buffer[ 2 ] /2; i++) { + // au16regs[ i ] = word( + // au8Buffer[ u8byte ], + // au8Buffer[ u8byte +1 ]); + // u8byte += 2; + // } +} + +/** + * This method processes functions 3 & 4 (for master) + * This method puts the slave answer into master data buffer + * + * @ingroup register + */ +void Modbus::get_FC3() +{ + uint8_t u8byte, i; + u8byte = 3; + + for (i=0; i< au8Buffer[ 2 ] /2; i++) + { + au16regs[ i ] = word( + au8Buffer[ u8byte ], + au8Buffer[ u8byte +1 ]); + u8byte += 2; + } +} + +/** + * @brief + * This method processes functions 1 & 2 + * This method reads a bit array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC1( uint16_t *regs, uint8_t u8size ) +{ + uint8_t u8currentRegister, u8currentBit, u8bytesno, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + + // get the first and last coil from the message + uint16_t u16StartCoil = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ] ); + uint16_t u16Coilno = word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ] ); + + // put the number of bytes in the outcoming message + u8bytesno = (uint8_t) (u16Coilno / 8); + if (u16Coilno % 8 != 0) u8bytesno ++; + au8Buffer[ ADD_HI ] = u8bytesno; + u8BufferSize = ADD_LO; + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t) (u16coil / 16); + u8currentBit = (uint8_t) (u16coil % 16); + + bitWrite( + au8Buffer[ u8BufferSize ], + u8bitsno, + bitRead( regs[ u8currentRegister ], u8currentBit ) ); + u8bitsno ++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8BufferSize++; + } + } + + // send outcoming message + if (u16Coilno % 8 != 0) u8BufferSize ++; + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes functions 3 & 4 + * This method reads a word array and transfers it to the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC3( uint16_t *regs, uint8_t u8size ) +{ + + uint8_t u8StartAdd = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ] ); + uint8_t u8regsno = word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ] ); + uint8_t u8CopyBufferSize; + uint8_t i; + + au8Buffer[ 2 ] = u8regsno * 2; + u8BufferSize = 3; + + for (i = u8StartAdd; i < u8StartAdd + u8regsno; i++) + { + au8Buffer[ u8BufferSize ] = highByte(regs[i]); + u8BufferSize++; + au8Buffer[ u8BufferSize ] = lowByte(regs[i]); + u8BufferSize++; + } + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 5 + * This method writes a value assigned by the master to a single bit + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC5( uint16_t *regs, uint8_t u8size ) +{ + uint8_t u8currentRegister, u8currentBit; + uint8_t u8CopyBufferSize; + uint16_t u16coil = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ] ); + + // point to the register and its bit + u8currentRegister = (uint8_t) (u16coil / 16); + u8currentBit = (uint8_t) (u16coil % 16); + + // write to coil + bitWrite( + regs[ u8currentRegister ], + u8currentBit, + au8Buffer[ NB_HI ] == 0xff ); + + + // send answer to master + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 6 + * This method writes a value assigned by the master to a single word + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC6( uint16_t *regs, uint8_t u8size ) +{ + + uint8_t u8add = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ] ); + uint8_t u8CopyBufferSize; + uint16_t u16val = word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ] ); + + regs[ u8add ] = u16val; + + // keep the same header + u8BufferSize = RESPONSE_SIZE; + + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 15 + * This method writes a bit array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup discrete + */ +int8_t Modbus::process_FC15( uint16_t *regs, uint8_t u8size ) +{ + uint8_t u8currentRegister, u8currentBit, u8frameByte, u8bitsno; + uint8_t u8CopyBufferSize; + uint16_t u16currentCoil, u16coil; + boolean bTemp; + + // get the first and last coil from the message + uint16_t u16StartCoil = word( au8Buffer[ ADD_HI ], au8Buffer[ ADD_LO ] ); + uint16_t u16Coilno = word( au8Buffer[ NB_HI ], au8Buffer[ NB_LO ] ); + + + // read each coil from the register map and put its value inside the outcoming message + u8bitsno = 0; + u8frameByte = 7; + for (u16currentCoil = 0; u16currentCoil < u16Coilno; u16currentCoil++) + { + + u16coil = u16StartCoil + u16currentCoil; + u8currentRegister = (uint8_t) (u16coil / 16); + u8currentBit = (uint8_t) (u16coil % 16); + + bTemp = bitRead( + au8Buffer[ u8frameByte ], + u8bitsno ); + + bitWrite( + regs[ u8currentRegister ], + u8currentBit, + bTemp ); + + u8bitsno ++; + + if (u8bitsno > 7) + { + u8bitsno = 0; + u8frameByte++; + } + } + + // send outcoming message + // it's just a copy of the incomping frame until 6th byte + u8BufferSize = 6; + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + return u8CopyBufferSize; +} + +/** + * @brief + * This method processes function 16 + * This method writes a word array assigned by the master + * + * @return u8BufferSize Response to master length + * @ingroup register + */ +int8_t Modbus::process_FC16( uint16_t *regs, uint8_t u8size ) +{ + uint8_t u8func = au8Buffer[ FUNC ]; // get the original FUNC code + uint8_t u8StartAdd = au8Buffer[ ADD_HI ] << 8 | au8Buffer[ ADD_LO ]; + uint8_t u8regsno = au8Buffer[ NB_HI ] << 8 | au8Buffer[ NB_LO ]; + uint8_t u8CopyBufferSize; + uint8_t i; + uint16_t temp; + + // build header + au8Buffer[ NB_HI ] = 0; + au8Buffer[ NB_LO ] = u8regsno; + u8BufferSize = RESPONSE_SIZE; + + // write registers + for (i = 0; i < u8regsno; i++) + { + temp = word( + au8Buffer[ (BYTE_CNT + 1) + i * 2 ], + au8Buffer[ (BYTE_CNT + 2) + i * 2 ]); + + regs[ u8StartAdd + i ] = temp; + } + u8CopyBufferSize = u8BufferSize +2; + sendTxBuffer(); + + return u8CopyBufferSize; +} diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.cpp b/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.cpp new file mode 100644 index 0000000..b42f681 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.cpp @@ -0,0 +1,1647 @@ +#include "OmronMx2.h" +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ + +#define MODBUSMASTER_DEBUG +#undef MODBUS_FREERTOS + +//#include // Using ModbusMaster modified for OMRON MX2 https://github.com/4-20ma/ModbusMaster +#include "ModbusMaster.h" // Using ModbusMaster modified for OMRON MX2 https://github.com/4-20ma/ModbusMaster + +const char *nameOmron = {" Omron MX2 "}; // Name, brand of inverter +const char *cYes = {" Yes "}; +const char *cNo = {" No "}; +const char *cOne = {" 1 "}; +const char *cZero = {" 0 "}; +const char *cOk = {" Ok "}; +const char *cError = {" error "}; +const char *cInvalid = {" invalid "}; +const char *cStrEnd = {" \ n "}; +const char *cErrorRS485 = {" % s : Read error % s , code = % d repeat ... \ n "}; // name, function, code +const char *cErrorMutex = {" Function % s : % s , mutex is buzy \ n "}; // function, mutex +const char *cAddHeat = {" + "}; + +__attribute__((always_inline)) inline void _delay(int t) +{ + delay(t); +} + +const char *noteFC_OK = {" Modbus communication established "}; // All right +const char *noteFC_NO = {" Modbus communication lost, the inverter is locked "}; +const char *noteFC_NONE = {" missing in this configuration "}; + +const char *fc_ON_OFF = {" ON_OFF "}; // Flag for turning on / off (frequency control) +const char *fc_INFO = {" INFO "}; // Get information from the inverter (table !!) +const char *fc_NAME = {" NAME "}; // Inverter name +const char *fc_NOTE = {" NOTE "}; // Get a description of the frequency converter. Line 80 + 1 +const char *fc_PIN = {" PIN "}; // Get the pin number where analog FC is attached +const char *fc_PRESENT = {" PRESENT "}; // The presence of FC in the configuration. +const char *fc_STATE = {" STATE "}; // Status of the inverter (read) +const char *fc_FC = {" FC "}; // The target frequency of the inverter is 0.01 +const char *fc_cFC = {" cFC "}; // Current inverter frequency (read) +const char *fc_cPOWER = {" cPOWER "}; // Current power (read) +const char *fc_INFO1 = {" INFO1 "}; // The first line below the inverter picture in the circuit +const char *fc_cCURRENT = {" cCURRENT "}; // Current current (read) +const char *fc_AUTO_RESET_FAULT = {" ARSTFLT "}; // Flag to automatically reset non-critical inverter error +const char *fc_LogWork = {" LOGW "}; // flag log while running +const char *fc_ANALOG = {" AN "}; // Flag of analog control +const char *fc_DAC = {" DAC "}; // Get the current DAC value +const char *fc_LEVEL0 = {" L0 "}; // Frequency level 0 in the DAC samples +const char *fc_LEVEL100 = {" L100 "}; // Frequency level 100% in the DAC samples +const char *fc_LEVELOFF = {" LOFF "}; // Minimum power at which the chastotnik turns off (minimum power limit) +const char *fc_BLOCK = {" BLOCK "}; // flag inverter global error - inverter operation is disabled; blocking can be reset by setting 0 +const char *fc_ERROR = {" ERROR "}; // Get the error code +const char *fc_UPTIME = {" UPTIME "}; // Pid controller update algorithm time (ms) The main control loop +const char *fc_PID_STOP = {" PID_STOP "}; // Percentage of the level of protection (power, current, pressure, temperature) at which the frequency increase is blocked by the pid +const char *fc_PID_FREQ_STEP = {" PID_STEP "}; // The maximum step (to increase) the frequency change with PID control of 0.01 Hz It is necessary that the ERV be in time +const char *fc_START_FREQ = {" FRQ "}; // Inverter starting frequency (cm compressor) at 0.01 Hz +const char *fc_START_FREQ_BOILER = {" FRQB "}; // Starting frequency of the inverter (cm compressor) in 0.01 GHz of hot water +const char *fc_MIN_FREQ = {" MIN "}; // Minimum inverter frequency (cm compressor) in 0.01 Hz +const char *fc_MIN_FREQ_COOL = {" MINC "}; // The minimum frequency of the inverter during cooling at 0.01 Hz +const char *fc_MIN_FREQ_BOILER = {" MINB "}; // The minimum frequency of the inverter when heating the hot water in 0.01 Hz +const char *fc_MIN_FREQ_USER = {" MINU "}; // Minimum inverter frequency MANUAL MODE (cm compressor) at 0.01 Hz +const char *fc_MAX_FREQ = {" MAX "}; // Maximum inverter frequency (cm compressor) at 0.01 Hz +const char *fc_MAX_FREQ_COOL = {" MAXC "}; // Maximum inverter frequency in cooling mode at 0.01 Hz +const char *fc_MAX_FREQ_BOILER = {" MAXB "}; // The maximum frequency of the inverter in the DHW mode at 0.01 Hz the absorption of the boiler is usually less than CO +const char *fc_MAX_FREQ_USER = {" MAXU "}; // Maximum inverter frequency MANUAL MODE (cm compressor) at 0.01 Hz +const char *fc_STEP_FREQ = {" STEP "}; // Step to decrease the inverter when reaching the maximum temperature, power and current (cm compressor) at 0.01 Hz +const char *fc_STEP_FREQ_BOILER = {" STEPB "}; // Step to decrease the inverter when reaching the maximum temperature, power and dhw current of 0.01 Hz +const char *fc_DT_COMP_TEMP = {" DTC "}; // Protection by compressor temperature - how many degrees does not reach the maximum (TCOMP) and at the same time there is a decrease in frequency +const char *fc_DT_TEMP = {" DT "}; // Exceeding the temperature from the settings (feed) at which the protection is triggered (frequency decreases) in hundredths of a degree +const char *fc_DT_TEMP_BOILER = {" DTB "}; // Exceeding the temperature from the settings (supply) at which the DHW protection in hundredths of a degree is triggered +const char *fc_MB_ERR = {" MB_ERR "}; // Modbus errors +const char *fc_FC_TIME_READ = {" TR "}; // Poll time +const char *fc_fFC_RetOil = {" FRO "}; // Flag oil return +const char *fc_FC_RETOIL_FREQ = {" FRF "}; // Frequency +const char *fc_ReturnOilPeriod = {" ROP "}; // Oil return time +const char *fc_ReturnOilPerDivHz = {" ROPH "}; // The frequency at which oil returns +const char *fc_ReturnOilEEV = {" ROE "}; // Steps of the EDS at which oil is returned +const boolean DEVICEFC = false; // Наличие Частотного преобразователя в конфигурации +#define fModbus 1 // флаг наличие modbus +typedef QueueHandle_t SemaphoreHandle_t; +SemaphoreHandle_t xModbusSemaphore; // Семафор Modbus, инвертор запас на счетчик +#define MODBUS_PORT_NUM Serial3 // Аппаратный порт куда прицеплен Modbus +#define MODBUS_PORT_SPEED 19200 // Скорость порта куда прицеплен частотник и счетчик +#define MODBUS_PORT_CONFIG SERIAL_8N1 // Конфигурация порта куда прицеплен частотник и счетчик +#define MODBUS_TIME_WAIT 2000 // Время ожидания захвата мютекса для modbus мсек + +inline void SemaphoreGive(QueueHandle_t xSemaphore) +{ + //if(xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) xSemaphoreGive(xSemaphore); +} +unsigned int i10toa(int value, char *string, unsigned int zero_pad) +{ + char *pbuffer = string; + unsigned char negative; + if (value < 0) + { + negative = 1; + value = -value; + } + else + negative = 0; + do + { + *(pbuffer++) = '0' + value % 10; + value /= 10; + } while (value > 0); + for (unsigned int i = (pbuffer - string); i < zero_pad; i++) + *(pbuffer++) = '0'; + if (negative) + *(pbuffer++) = '-'; + *(pbuffer) = '\0'; + unsigned int len = (pbuffer - string); + for (unsigned int i = 0; i < len / 2; i++) + { + char j = string[i]; + string[i] = string[len - i - 1]; + string[len - i - 1] = j; + } + return len; +} +uint8_t _ftoa(char *outstr, float val, unsigned char precision) +{ + while (*outstr) + outstr++; + char *instr = outstr; + + // compute the rounding factor and fractional multiplier + float roundingFactor = 0.5f; + unsigned long mult = 1; + unsigned char padding = precision; + while (precision--) + { + roundingFactor /= 10.0f; + mult *= 10; + } + if (val < 0.0f) + { + *outstr++ = '-'; + val = -val; + } + val += roundingFactor; + outstr += i10toa((long)val, outstr, 0); + if (padding > 0) + { + *(outstr++) = '.'; + outstr += i10toa((val - (long)val) * mult, outstr, padding); + } + return outstr - instr; +} +char *_itoa(int value, char *string) +{ + char *ret = string; + while (*string) + string++; + + char *pbuffer = string; + unsigned char negative = 0; + + if (value < 0) + { + negative = 1; + value = -value; + } + + /* This builds the string back to front ... */ + do + { + *(pbuffer++) = '0' + value % 10; + value /= 10; + } while (value > 0); + + if (negative) + *(pbuffer++) = '-'; + + *(pbuffer) = '\0'; + + /* ... now we reverse it (could do it recursively but will + * conserve the stack space) */ + uint32_t len = (pbuffer - string); + for (uint32_t i = 0; i < len / 2; i++) + { + char j = string[i]; + string[i] = string[len - i - 1]; + string[len - i - 1] = j; + } + + return ret; +} + +static void jprintf(const char *format, ...) +{ + Serial.println(format); +} +int8_t set_Error(int8_t _err, char *nam) +{ + Serial.println("error"); + Serial.println(_err); + Serial.println(nam); + + return OK; +} +// End class +static uint8_t Modbus_Entered_Critical = 0; +static inline void idle() // задержка между чтениями отдельных байт по Modbus +{ + // delay(1); // Не отдает время другим задачам + _delay(1); // Отдает время другим задачам +} +static inline void preTransmission() // Функция вызываемая ПЕРЕД началом передачи +{ +#ifdef PIN_MODBUS_RSE + digitalWriteDirect(PIN_MODBUS_RSE, HIGH); +#endif + _delay(10); // что бы слейв не терял первый бит + // Modbus_Entered_Critical = TaskSuspendAll(); // Запрет других задач во время передачи по Modbus + + //Serial.println("critical"); +} +static inline void postTransmission() // Функция вызываемая ПОСЛЕ окончания передачи +{ + if (Modbus_Entered_Critical) + { + // xTaskResumeAll(); + Serial.println("critical postTransmission"); + Modbus_Entered_Critical = 0; + } +#ifdef PIN_MODBUS_RSE +#if MODBUS_TIME_TRANSMISION != 0 + _delay(MODBUS_TIME_TRANSMISION); // Минимальная пауза между командой и ответом 3.5 символа +#endif + digitalWriteDirect(PIN_MODBUS_RSE, LOW); +#endif +} + +// Инициализация Modbus без проверки связи связи +int8_t devModbus::initModbus() +{ +#ifdef MODBUS_PORT_NUM + + flags = 0x00; + SETBIT1(flags, fModbus); // модбас присутствует +#ifdef PIN_MODBUS_RSE + pinMode(PIN_MODBUS_RSE, OUTPUT); // Подготовка управлением полудуплексом + digitalWriteDirect(PIN_MODBUS_RSE, LOW); +#endif + // Controllino_RS485Init(); + MODBUS_PORT_NUM.begin(MODBUS_PORT_SPEED, MODBUS_PORT_CONFIG); // SERIAL_8N1 - настройки по умолчанию + RS485.begin(1, MODBUS_PORT_NUM); + + // Назначение функций обратного вызова + RS485.preTransmission(preTransmission); + RS485.postTransmission(postTransmission); + RS485.idle(idle); + err = OK; // Связь есть +#else + flags = 0x00; + SETBIT0(flags, fModbus); // модбас отсутвует + err = ERR_NO_MODBUS; +#endif + return err; +} + +int8_t devModbus::LinkTestOmronMX2() +{ + uint16_t result, ret; + err = OK; + RS485.set_slave(FC_MODBUS_ADR); + + + result = RS485.LinkTestOmronMX2Only(TEST_NUMBER); // Послать команду проверки связи + Serial.println("test : LinkTestOmronMX2"); + Serial.println(result); + if (result == RS485.ku8MBSuccess) + ret = RS485.getResponseBuffer(0); // Получить данные с ответа + else + return err = ERR_485_INIT; // Ошибка инициализации + if (TEST_NUMBER != ret) + return err = ERR_MODBUS_MX2_0x05; // Контрольные данные не совпали + return err; +} +static devModbus Modbus; +// ------------------------------------------------ ------------------------------------------ +// FREQUENCY CONVERTER ONLY ONE PIECE ALWAYS (not an array) --------------------------- +// class initialization +int8_t devOmronMX2::initFC() +{ + + err = OK; // ошибка частотника (работа) при ошибке останов ТН + numErr = 0; // число ошибок чтение по модбасу для статистики + number_err = 0; // Число ошибок связи при превышении FC_NUM_READ блокировка инвертора + FC = 0; // Целевая частота частотика + freqFC = 0; // текущая частота инвертора + power = 0; // Тееущая мощность частотника + current = 0; // Текуший ток частотника + startCompressor = 0; // время старта компрессора + state = ERR_LINK_FC; // Состояние - нет связи с частотником + dac = 0; // Текущее значение ЦАП + testMode = NORMAL; // Значение режима тестирования + name = (char *)nameOmron; // Имя + note = (char *)noteFC_NONE; // Описание инвертора типа нет его + // Настройки по умолчанию + _data.Uptime = DEF_FC_UPTIME; // Время обновления алгоритма пид регулятора (мсек) Основной цикл управления + _data.PidFreqStep = DEF_FC_PID_FREQ_STEP; // Максимальный шаг (на увеличение) изменения частоты при ПИД регулировании в 0.01 Гц Необходимо что бы ЭРВ успевал + _data.PidStop = DEF_FC_PID_STOP; // Проценты от уровня защит (мощность, ток, давление, темпеартура) при которой происходит блокировка роста частоты пидом + _data.dtCompTemp = DEF_FC_DT_COMP_TEMP; // Защита по температуре компрессора - сколько градусов не доходит до максимальной (TCOMP) и при этом происходит уменьшение частоты + _data.startFreq = DEF_FC_START_FREQ; // Стартовая скорость инвертора (см компрессор) в 0.01 + _data.startFreqBoiler = DEF_FC_START_FREQ_BOILER; // Стартовая скорость инвертора (см компрессор) в 0.01 ГВС + _data.minFreq = DEF_FC_MIN_FREQ; // Минимальная скорость инвертора (см компрессор) в 0.01 + _data.minFreqCool = DEF_FC_MIN_FREQ_COOL; // Минимальная скорость инвертора при охлаждении в 0.01 + _data.minFreqBoiler = DEF_FC_MIN_FREQ_BOILER; // Минимальная скорость инвертора при нагреве ГВС в 0.01 + _data.minFreqUser = DEF_FC_MIN_FREQ_USER; // Минимальная скорость инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 + _data.maxFreq = DEF_FC_MAX_FREQ; // Максимальная скорость инвертора (см компрессор) в 0.01 + _data.maxFreqCool = DEF_FC_MAX_FREQ_COOL; // Максимальная скорость инвертора в режиме охлаждения в 0.01 + _data.maxFreqBoiler = DEF_FC_MAX_FREQ_BOILER; // Максимальная скорость инвертора в режиме ГВС в 0.01 Гц поглощение бойлера обычно меньше чем СО + _data.maxFreqUser = DEF_FC_MAX_FREQ_USER; // Максимальная скорость инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 + _data.stepFreq = DEF_FC_STEP_FREQ; // Шаг уменьшения инвертора при достижении максимальной температуры, мощности и тока (см компрессор) в 0.01 + _data.stepFreqBoiler = DEF_FC_STEP_FREQ_BOILER; // Шаг уменьшения инвертора при достижении максимальной температуры, мощности и тока ГВС в 0.01 + _data.dtTemp = DEF_FC_DT_TEMP; // Привышение температуры от уставок (подача) при которой срабатыват защита (уменьшается частота) в сотых градуса + _data.dtTempBoiler = DEF_FC_DT_TEMP_BOILER; // Привышение температуры от уставок (подача) при которой срабатыват защита ГВС в сотых градуса +#ifdef FC_ANALOG_CONTROL + _data.level0 = 0; // Отсчеты ЦАП соответсвующие 0 мощности + _data.level100 = 4096; // Отсчеты ЦАП соответсвующие 100 мощности + _data.levelOff = 10; // Минимальная мощность при котором частотник отключается (ограничение минимальной мощности) +#endif + + if (Modbus.initModbus() == OK) + jprintf(" modbus OK\r\n"); // выводим сообщение об установлении связи + else + { + jprintf(" modbus not present config\r\n"); + } + + flags = 0x00; // флаги 0 - наличие FC + _data.setup_flags = 0x00; // флаги + Serial.println("mb presetn test"); + if (!Modbus.get_present()) // modbus отсутствует + { + SETBIT0(flags, fFC); // Инвертор не рабоатет + jprintf("%s, modbus not found, block.\n", name); + err = ERR_NO_MODBUS; + return err; + } + else if (DEVICEFC == true) + { + SETBIT1(flags, fFC); // наличие частотника в текушей конфигурации + } + + if (get_present()) + { + jprintf("Invertor %s: present config\r\n", name); + } + else + { + jprintf("Invertor %s: none config\r\n", name); + // return err; + } // выходим если нет инвертора + + note = (char *)noteFC_OK; // Описание инвертора есть + err = Modbus.LinkTestOmronMX2(); // проверка связи с инвертором xModbusSemaphore не используем так как в один поток + check_blockFC(); + if (err != OK) + { + Serial.println("link test:"); + Serial.println(note); + Serial.println(err); + return err; // связи нет выходим + } + + jprintf("Test link Modbus %s: OK\r\n", name); // Тест пройден + + return; + // Если частотник работает то остановить его + get_readState(); // Получить состояние частотника + switch (state) // В зависимости от состояния + { + case 0: + case 2: + break; // ОСТАНОВКА ничего не делаем + case 3: + stop_FC(); // ВРАЩЕНИЕ Послать команду стоп и ждать остановки + while ((state != 2) || (state != 4)) + { + get_readState(); + // jprintf("Wait stop %s . . .\r\n", name); + _delay(3000); + } + break; + case 4: // ОСТАНОВКА С ВЫБЕГОМ ждать остановки + break; + case 5: + stop_FC(); // ТОЛЧОВЫЙ ХОД Послать команду стоп и ждать остановки + while ((state != 2) || (state != 4)) + { + get_readState(); + // jprintf("Wait stop %s . . .\r\n", name); + _delay(3000); + } + break; + case 6: // ТОРМОЖЕНИЕ ПОСТОЯННЫМ ТОКОМ + case 7: + err = ERR_MODBUS_STATE; + set_Error(err, name); + break; // ВЫПОЛНЕНИЕ ПОВТОРНОЙ ПОПЫТКИ Подъем ошибки на верх и останов ТН + case 8: + break; // АВАРИЙНОЕ ОТКЛЮЧЕНИЕ + case 9: + break; // ПОНИЖЕНОЕ ПИТАНИЕ + case -1: + break; + default: + err = ERR_MODBUS_STATE; + set_Error(err, name); + break; // Подъем ошибки на верх и останов ТН + } + if (err != OK) + return err; + + // Установить стартовую частоту + set_target(_data.startFreq, true, _data.minFreqUser, _data.maxFreqUser); // режим н знаем по этому границы развигаем + return err; +} + +#define progOK " Register% s to% d \ r \ n " // Line for displaying a message about successful register programming +#define progErr " Error setting register% s \ r \ n " // Line for displaying a message about failed register programming + +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT +// Program a separate inverter register +// adrReg - register address +// nameReg - register name +// valReg - register value +int8_t devOmronMX2::progReg16(uint16_t adrReg, char *nameReg, uint16_t valReg) +{ + _delay(50); + if ((err = write_0x06_16(adrReg, valReg)) == OK) + { + jprintf(progOK, nameReg, valReg); + } + else + { + jprintf(progErr, nameReg); + } + return err; +} +int8_t devOmronMX2 ::progReg32(uint16_t adrReg, char *nameReg, uint32_t valReg) +{ + _delay(50); + if ((err = write_0x10_32(adrReg, valReg)) == OK) + { + jprintf(progOK, nameReg, valReg); + } + else + { + jprintf(progErr, nameReg); + } + return err; +} +#endif // NOT ANALOGUE MANAGEMENT + +// Programming the inverter for a specific compressor +int8_t devOmronMX2 ::progFC() +{ +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT \ + // jprintf(" Programming% s.. \ r \ n ", name); + // Setting the inverter for a specific compressor Registers Hxxx Permanent magnet motor (PM motor) + progReg16(MX2_b171, (char *)"b171", 0x03); // b171 IF mode selection b171 read / write 0 (off), 1 (IM mode), 2 (high frequency mode), 3 (PM mode) = 03 + progReg16(MX2_b180, (char *)"b180", 0x01); // b180 Starting the initialization process + // while (read_0x03_16 (MX2_H102) == 1) _delay (100); // Delay on initialization of the inverter - wait until the P102 register appears + //jprintf ( " Wait initialization.. \ r \ n " ); + _delay(7000); + progReg16(MX2_H102, (char *)"H102", valH102); // H102 Setting the PM motor code 00 (standard Omron data) 01 (auto-tuning data) = 1 + progReg16(MX2_H103, (char *)"H103", valH103); // H103 PM engine power (0.1 / 0.2 / 0.4 / 0.55 / 0.75 / 1.1 / 1.5 / 2.2 / 3.0 / 3.7 / 4, 0 / 5.5 / 7.5 / 11.0 / 15.0 / 18.5) = 7 + progReg16(MX2_H104, (char *)"H104", valH104); // H104 Setting the number of poles of the PM motor = 4 + progReg16(MX2_H105, (char *)"H105", valH105); // H105 Rated current of the PM motor = 1000 (this is 11A) + progReg16(MX2_H106, (char *)"H106", valH106); // H106 PM motor constant R From 0.001 to 65.535 ohms = 0.55 * 1000 + progReg16(MX2_H107, (char *)"H107", valH107); // H107 Ld constant of the PM engine From 0.01 to 655.35 mH = 2.31 * 100 + progReg16(MX2_H108, (char *)"H108", valH108); + progReg16(MX2_H109, (char *)"H109", valH109); + progReg32(MX2_H110, (char *)"H110", valH110); // H110 Constant J PM-engine From 0.001 to 9999,000 kg / m² = 0.01 + progReg16(MX2_H119, (char *)"H119", valH119); // H119 Engine PM stabilization constant 0 to 120% s = 100 + progReg16(MX2_H121, (char *)"H121", valH121); // H121 Minimum frequency of the PM motor From 0.0 to 25.5% = 10 (default) + progReg16(MX2_H122, (char *)"H122", valH122); // H122 Idling current PM of the motor From 0.00 to 100.00% = 50 (default) + progReg16(MX2_C001, (char *)"C001", valC001); // C001 Input function [1] 0 (FW: go forward) = 0 + progReg16(MX2_C004, (char *)"C004", valC004); // C004 Input function [4] 18 (RS: reset) = 18 +#ifndef DEMO // for the demo you do not need to configure thermal protection otherwise the eternal error E35.1 + progReg16(MX2_C005, (char *)" C005 ", valC005); // C005 Input function [5] [also input “PTC”] = 19 PTC Thermistor with positive TCS for thermal protection (only C005) +#endif + progReg16(MX2_C026, (char *)" C026 ", valC026); // C026 Relay output function 5 (AL: error signal) = 05 + progReg16(MX2_b091, (char *)" b091 ", valb091); // b091 Choice of stopping method 0 (braking to a complete stop), 1 (coasting stop) = 1 + progReg16(MX2_b021, (char *)" b021 ", valb021); // b021 Operating mode with overload limitation = 1 + progReg16(MX2_b022, (char *)" b022 ", valb022); // b022 Overload restriction level 200 ... 2000 (0.1%) = + progReg16(MX2_b023, (char *)" b023 ", valb023); // b023 Braking time with overload limitation (0.1 sec) = 10 + progReg16(MX2_A001, (char *)" A001 ", valA001); // A001 Frequency reference source = 03 + progReg16(MX2_A002, (char *)" A002 ", valA002); // A002 Source of the “Move” command + progReg16(MX2_A003, (char *)" A003 ", FC_BASE_FREQ / 10); // A003 fundamental frequency + progReg16(MX2_A004, (char *)" A004 ", DEF_FC_MAX_FREQ / 10); // A004 setting the maximum frequency + progReg32(MX2_F002, (char *)" F002 ", FC_ACCEL_TIME); // F002 Acceleration Time + progReg32(MX2_F002, (char *)" F003 ", FC_DEACCEL_TIME); // F003 Acceleration Braking + jprintf(" ... OK \ r \ n "); +#else + jprintf(" Analog control - no support programm Omron MX2 \ r \ n "); +#endif // NOT ANALOGUE MANAGEMENT + return err; +} + +// Set Target Frequency +// parameter to show message message or not, two remaining border parameters +int8_t devOmronMX2::set_target(int16_t x, boolean show, int16_t _min, int16_t _max) +{ + err = OK; +#ifdef DEMO + if ((x > = _ min) && (x <= _ max)) // Check the range of allowed frequencies + { + FC = x; + if (show) + jprintf(" Set% s:% .2f [Hz] \ r \ n ", name, FC / 100.0); + return err; + } // set the frequency OK - display a message if necessary + else + { + jprintf(" % s: Wrong frequency% .2f \ n ", name, x / 100.0); + return WARNING_VALUE; + } +#else // Battle option + uint16_t hWord, lWord; + uint8_t i; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + if ((x >= _min) && (x <= _max)) // Check the range of allowed frequencies + { +#ifndef FC_ANALOG_CONTROL // Non-analog control + // Write to the inverter registers the set frequency + for (i = 0; i < FC_NUM_READ; i++) // Make FC_NUM_READ attempts + { + err = write_0x10_32(MX2_TARGET_FR, x); + if (err == OK) + break; // Command completed + _delay(100); + jprintf(" % s: repeat set frequency \ n ", name); // Display a message about the second command + } + + if (err == OK) + { + FC = x; + if (show) + jprintf(" Set% s:% .2f [Hz] \ r \ n ", name, FC / 100.0); + return err; + } // set the frequency OK - display a message if necessary + else + { + err = ERR_LINK_FC; + SETBIT1(flags, fErrFC); + set_Error(err, name); + return err; + } // error generation + // Check for frequency setting and inverter adequacy + if (x != read_0x03_32(MX2_TARGET_FR)) + { + err = ERR_FC_ERROR; + SETBIT1(flags, fErrFC); + set_Error(err, name); + return err; + } +#else // Analog Control + FC = x; + dac = ((level100 - level0) * FC - 0 * level100) / (100 - 0); + switch (testMode) // REAL Actions depending on the mode + { + case NORMAL: + analogWrite(pin, dac); + break; // Operation mode is not a test, we turn everything on + case SAFE_TEST: + break; // Do not include anything + case TEST: + break; // Turn on everything except the compressor + case HARD_TEST: + analogWrite(pin, dac); + break; // Turn on everything and the compressor too + } + if (show) + jprintf(" Set% s:% .2f [Hz] \ r \ n ", name, FC / 100.0); // frequency setting OK - display a message if necessary +#endif + return err; + } // if ((x> = _ min) && (x <= _ max)) + else + { + jprintf(" % s: Wrong frequency% .2f \ n ", name, x / 100.0); + return WARNING_VALUE; + } +#endif // DEMO +} + +// Set DAC readings corresponding to 0 power +int8_t devOmronMX2::set_level0(int16_t x) +{ + if ((x >= 0) && (x <= 4096)) + { + level0 = x; + return OK; + } // Only valid values + return WARNING_VALUE; +} +// Set DAC readings corresponding to 100 power +int8_t devOmronMX2::set_level100(int16_t x) +{ + if ((x >= 0) && (x <= 4096)) + { + level100 = x; + return OK; + } // Only valid values + return WARNING_VALUE; +} +// Set the minimum power at which the chastotnik turns off (minimum power limit) +int8_t devOmronMX2::set_levelOff(int16_t x) +{ + if ((x >= 0) && (x <= 100)) + { + levelOff = x; + return OK; + } // Only valid values + return WARNING_VALUE; +} + +// Set the ban on the use of the inverter if the error limit is reached +void devOmronMX2::check_blockFC(){ +#ifndef FC_ANALOG_CONTROL // Non-analog control +/* + if ((xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) && (err ! = OK)) // if free rtos is not running then block it the first time + { + SETBIT1(flags, fErrFC); // Set flag + note = (char *)noteFC_NO; + set_Error(err, (char *)name); // Raise the error to the top and stop the VT + return statement; + } + + if (err ! = OK) + number_err++; + else + { + number_err = 0; + return; + } // Increase the error counter + if (number_err > FC_NUM_READ) // if the number of errors is increased, then the lock + { + SemaphoreGive(xModbusSemaphore); // unlock semaphore + SETBIT1(flags, fErrFC); // Set flag + note = (char *)noteFC_NO; + set_Error(err, (char *)name); // Raise the error to the top and stop the VT + } + */ +#endif +} + +// Read (internal variables are updated) the state of the Inverter, returns either OK or an error +// The period FC_TIME_READ is called from the task of reading sensors +int8_t devOmronMX2::get_readState() +{ + /* + uint8_t i; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + err = OK; +#ifndef FC_ANALOG_CONTROL // Non-analog control + // Read the state of the inverter, if an error occurs, generate a common VT error and stop + for (i = 0; i < FC_NUM_READ; i++) // do FC_NUM_READ attempts to read + { + state = read_0x03_16(MX2_STATE); // read the state + err = Modbus.get_err(); // Copy error + if (err == OK) // Read correctly + { + if ((GETBIT(flags, fOnOff)) && (state ! = 3)) + continue; + else + break; // VT turned on the compressor and the inverter does not have the correct state, we try to read one more time in the opposite case everything is ok + } + _delay(FC_DELAY_REPEAT); +// jprintf(cErrorRS485, name, __FUNCTION__, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + if (err ! = OK) // Modbass error + { + state = ERR_LINK_FC; // sign of loss of communication with the inverter + SETBIT1(flags, fErrFC); // Inverter block + set_Error(err, name); // error generation + return err; // Return + } + // else if ((testMode == NORMAL) || (testMode == HARD_TEST)) // Operation mode and hard test, analyze the state, + // if ((GETBIT (flags, fOnOff)) && (state! = 3)) // Invalid state + // { + // err = ERR_MODBUS_STATE; // Error Invalid Inverter Status + // jprintf ("% s: Compressor ON and wrong read state:% d \ n", name, state); + // set_Error (err, name); + // return err; // Return + // } + // Read the state and it’s correct; we read everything else + _delay(FC_DELAY_READ); + freqFC = read_0x03_32(MX2_CURRENT_FR); // read the current frequency + err = Modbus.get_err(); // Copy error + if (err ! = OK) + { + state = ERR_LINK_FC; + } // We exit the error + + _delay(FC_DELAY_READ); + power = read_0x03_16(MX2_POWER); // read power + err = Modbus.get_err(); // Copy error + if (err ! = OK) + { + state = ERR_LINK_FC; + } // We exit the error + + _delay(FC_DELAY_READ); + current = read_0x03_16(MX2_AMPERAGE); // read current + err = Modbus.get_err(); // Copy error + if (err ! = OK) + { + state = ERR_LINK_FC; + } // We exit the error +#else // Analog Control + freqFC = FC; + power = 0; + current = 0; +#endif + return err; + */ +} + +// Run command to the inverter (target frequency DOES NOT SET) +// A command can be issued through the relay and through modbas depending on the compilation keys +int8_t devOmronMX2::start_FC() +{ + /* + if (((testMode == NORMAL) || (testMode == HARD_TEST)) && (((FC < _data.minFreq) || (FC > _data.maxFreq)))) + { + jprintf(" % s: Wrong frequency, ignore start \ n ", name); + return err; + } // checking the frequency is not in test mode + err = OK; +#ifndef FC_ANALOG_CONTROL // Non-analog control +#ifdef DEMO + +#else // DEMO + // Warhead + if (((testMode == NORMAL) || (testMode == HARD_TEST)) && (((!get_present()) || (GETBIT(flags, fErrFC))))) + return err; // exit if there is no inverter or it is blocked by mistake + + // set_target (startFreq, true); // Writing the start frequency to the inverter register is NOT always the start frequency - superboiler + + err = OK; + if ((testMode == NORMAL) || (testMode == HARD_TEST)) // Operation mode and hard test, turn everything on, + { +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_ON(); // BAD through a global variable +#else // give a run / stop command through modbas + err = write_0x05_bit(MX2_START, true); // Command Move +#endif + } + if (err == OK) + { + SETBIT1(flags, fOnOff); + startCompressor = rtcSAM3X8.unixtime(); + jprintf(" % s ON \ n ", name); + } + else + { + state = ERR_LINK_FC; + SETBIT1(flags, fErrFC); + set_Error(err, name); + } // error generation +#endif +#else // FC_ANALOG_CONTROL +#ifdef DEMO +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_ON(); // BAD through a global variable +#endif // FC_USE_RCOMP + SETBIT1(flags, fOnOff); + startCompressor = rtcSAM3X8.unixtime(); + jprintf(" % s ON \ n ", name); +#else // DEMO \ + // Warhead + if (((testMode == NORMAL) || (testMode == HARD_TEST)) && (((!get_present()) || (GETBIT(flags, fErrFC))))) + return err; // exit if there is no inverter or it is blocked by mistake + err = OK; + if ((testMode == NORMAL) || (testMode == HARD_TEST)) // Operation mode and hard test, turn everything on, + { +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_ON(); // BAD through a global variable +#else + state = ERR_LINK_FC; + err = ERR_FC_CONF_ANALOG; + SETBIT1(flags, fErrFC); + set_Error(err, name); // configuration error +#endif + } + SETBIT1(flags, fOnOff); + startCompressor = rtcSAM3X8.unixtime(); + jprintf(" % s ON \ n ", name); +#endif +#endif +*/ + return err; +} + +// Stop command to inverter Return error code +int8_t devOmronMX2::stop_FC() +{ + // uint8_t i; + err = OK; +#ifndef FC_ANALOG_CONTROL // Non-analog control +#ifdef DEMO +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_OFF(); // BAD through a global variable +#endif // FC_USE_RCOMP + if (err == OK) + { + SETBIT0(flags, fOnOff); + startCompressor = 0; + jprintf(" % s OFF \ n ", name); + } + else + { + state = ERR_LINK_FC; + SETBIT1(flags, fErrFC); + set_Error(err, name); + } // error generation +#else // not DEMO + if (!get_present()) + return err; // if there is no inverter, exit + // if (((testMode == NORMAL) || (testMode == HARD_TEST)) && (((! get_present ()) || (GETBIT (flags, fErrFC))))) return err; // exit if not inverter or it is blocked by mistake + err = OK; + if ((testMode == NORMAL) || (testMode == HARD_TEST)) // Operation mode and hard test, turn everything on, + { +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command with verification of progress + +#else // give a run / stop command through modbas + err = write_0x05_bit(MX2_START, false); // Stop command +#endif + } + if (err == OK) + { + SETBIT0(flags, fOnOff); + startCompressor = 0; + jprintf(" % s OFF \ n ", name); + } + else + { + state = ERR_LINK_FC; + SETBIT1(flags, fErrFC); + set_Error(err, name); + } // error generation +#endif +#else // FC_ANALOG_CONTROL +#ifdef DEMO +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_OFF(); // BAD through a global variable +#endif // FC_USE_RCOMP + SETBIT0(flags, fOnOff); + startCompressor = 0; + jprintf(" % s OFF \ n ", name); +#else // not DEMO + if (((testMode == NORMAL) || (testMode == HARD_TEST)) && (((!get_present()) || (GETBIT(flags, fErrFC))))) + return err; // exit if there is no inverter or it is blocked by mistake + if ((testMode == NORMAL) || (testMode == HARD_TEST)) // Operation mode and hard test, turn everything on, + { +#ifdef FC_USE_RCOMP // Use a separate wire for the run / stop command + HP dRelay[RCOMP].set_OFF(); // BAD through a global variable +#else // give a run / stop command through modbas + state = ERR_LINK_FC; + err = ERR_FC_CONF_ANALOG; + SETBIT1(flags, fErrFC); + set_Error(err, name); // configuration error +#endif + } + SETBIT0(flags, fOnOff); + startCompressor = 0; + jprintf(" % s OFF \ n ", name); +#endif +#endif // FC_ANALOG_CONTROL + return err; +} + +// Get the inverter parameter as a string, the result is ADDED to ret +void devOmronMX2::get_paramFC(char *var, char *ret) +{ + if (strcmp(var, fc_ON_OFF) == 0) + { + if (GETBIT(flags, fOnOff)) + strcat(ret, (char *)cOne); + else + strcat(ret, (char *)cZero); + } + else if (strcmp(var, fc_INFO) == 0) + { +#ifndef FC_ANALOG_CONTROL + get_infoFC(ret); +#else + strcat(ret, " | Data not available, work through analog input |; "); +#endif + } + else if (strcmp(var, fc_NAME) == 0) + { + strcat(ret, name); + } + else if (strcmp(var, fc_NOTE) == 0) + { + strcat(ret, note); + } + else if (strcmp(var, fc_PIN) == 0) + { + _itoa(pin, ret); + } + else if (strcmp(var, fc_PRESENT) == 0) + { + if (GETBIT(flags, fFC)) + strcat(ret, (char *)cOne); + else + strcat(ret, (char *)cZero); + } + else if (strcmp(var, fc_STATE) == 0) + { + _itoa(state, ret); + } + else if (strcmp(var, fc_FC) == 0) + { + _ftoa(ret, (float)FC / 100.0, 2); + } + else if (strcmp(var, fc_cFC) == 0) + { + _ftoa(ret, (float)freqFC / 100.0, 2); + } + else if (strcmp(var, fc_cPOWER) == 0) + { + _ftoa(ret, (float)power / 10.0, 1); + } + else if (strcmp(var, fc_INFO1) == 0) + { + _ftoa(ret, (float)power / 10.0, 1); + strcat(ret, " kW "); + } + else if (strcmp(var, fc_cCURRENT) == 0) + { + _ftoa(ret, (float)current / 100.0, 2); + } + else if (strcmp(var, fc_AUTO_RESET_FAULT) == 0) + { + strcat(ret, (char *)(GETBIT(_data.setup_flags, fAutoResetFault) ? cOne : cZero)); + } + else if (strcmp(var, fc_LogWork) == 0) + { + strcat(ret, (char *)(GETBIT(_data.setup_flags, fLogWork) ? cOne : cZero)); + } + else if (strcmp(var, fc_ANALOG) == 0) + { // Analog control flag +#ifdef FC_ANALOG_CONTROL + strcat(ret, (char *)cOne); +#else + strcat(ret, (char *)cZero); +#endif + } + else if (strcmp(var, fc_DAC) == 0) + { + _itoa(dac, ret); + } + else +#ifdef FC_ANALOG_CONTROL + +#endif + if (strcmp(var, fc_BLOCK) == 0) + { + if (GETBIT(flags, fErrFC)) + strcat(ret, (char *)cOne); + else + strcat(ret, (char *)cZero); + } + else if (strcmp(var, fc_ERROR) == 0) + { + _itoa(err, ret); + } + else if (strcmp(var, fc_UPTIME) == 0) + { + _itoa(_data.Uptime, ret); + } + else // output in seconds + if (strcmp(var, fc_PID_STOP) == 0) + { + _itoa(_data.PidStop, ret); + } + else if (strcmp(var, fc_DT_COMP_TEMP) == 0) + { + _ftoa(ret, (float)_data.dtCompTemp / 100.0, 2); + } + else // degrees + if (strcmp(var, fc_PID_FREQ_STEP) == 0) + { + _ftoa(ret, (float)_data.PidFreqStep / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_START_FREQ) == 0) + { + _ftoa(ret, (float)_data.startFreq / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_START_FREQ_BOILER) == 0) + { + _ftoa(ret, (float)_data.startFreqBoiler / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MIN_FREQ) == 0) + { + _ftoa(ret, (float)_data.minFreq / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_COOL) == 0) + { + _ftoa(ret, (float)_data.minFreqCool / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_BOILER) == 0) + { + _ftoa(ret, (float)_data.minFreqBoiler / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_USER) == 0) + { + _ftoa(ret, (float)_data.minFreqUser / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MAX_FREQ) == 0) + { + _ftoa(ret, (float)_data.maxFreq / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_COOL) == 0) + { + _ftoa(ret, (float)_data.maxFreqCool / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_BOILER) == 0) + { + _ftoa(ret, (float)_data.maxFreqBoiler / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_USER) == 0) + { + _ftoa(ret, (float)_data.maxFreqUser / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_STEP_FREQ) == 0) + { + _ftoa(ret, (float)_data.stepFreq / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_STEP_FREQ_BOILER) == 0) + { + _ftoa(ret, (float)_data.stepFreqBoiler / 100.0, 2); + } + else // Hz + if (strcmp(var, fc_DT_TEMP) == 0) + { + _ftoa(ret, (float)_data.dtTemp / 100.0, 2); + } + else // degrees + if (strcmp(var, fc_DT_TEMP_BOILER) == 0) + { + _ftoa(ret, (float)_data.dtTempBoiler / 100.0, 2); + } + else // degrees + if (strcmp(var, fc_MB_ERR) == 0) + { + _itoa(numErr, ret); + } + else if (strcmp(var, fc_FC_TIME_READ) == 0) + { + _itoa(FC_TIME_READ, ret); + } + else + strcat(ret, (char *)cInvalid); +} + +// Set the inverter parameter from the string +boolean devOmronMX2::set_paramFC(char *var, float x) +{ + if (strcmp(var, fc_ON_OFF) == 0) + { + if (x == 0) + stop_FC(); + else + start_FC(); + return true; + } + else if (strcmp(var, fc_FC) == 0) + { + if ((x * 100 >= _data.minFreqUser) && (x * 100 <= _data.maxFreqUser)) + { + set_target(x * 100, true, _data.minFreqUser, _data.maxFreqUser); + return true; + } + else + return false; + } + else if (strcmp(var, fc_AUTO_RESET_FAULT) == 0) + { + if (x == 0) + SETBIT0(_data.setup_flags, fAutoResetFault); + else + SETBIT1(_data.setup_flags, fAutoResetFault); + return true; + } + else if (strcmp(var, fc_LogWork) == 0) + { + _data.setup_flags = (_data.setup_flags & ~(1 << fLogWork)) | ((x != 0) << fLogWork); + return true; + } + else + +#ifdef FC_ANALOG_CONTROL + +#endif + if (strcmp(var, fc_BLOCK) == 0) + { + SemaphoreGive(xModbusSemaphore); // give the semaphore ALWAYS + if (x == 0) + { + SETBIT0(flags, fErrFC); + note = (char *)noteFC_OK; + } + else + { + SETBIT1(flags, fErrFC); + note = (char *)noteFC_NO; + } + return true; + } + else if (strcmp(var, fc_UPTIME) == 0) + { + if ((x >= 3) && (x < 600)) + { + _data.Uptime = x; + return true; + } + else + return false; + } + else // storage in sec + if (strcmp(var, fc_PID_STOP) == 0) + { + if ((x >= 50) && (x <= 100)) + { + _data.PidStop = x; + return true; + } + else + return false; + } + else // % of the target + if (strcmp(var, fc_DT_COMP_TEMP) == 0) + { + if ((x >= 1) && (x <= 25)) + { + _data.dtCompTemp = x * 100; + return true; + } + else + return false; + } + else // degrees + + if (strcmp(var, fc_PID_FREQ_STEP) == 0) + { + if ((x > 0) && (x <= 5)) + { + _data.PidFreqStep = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_START_FREQ) == 0) + { + if ((x >= 20) && (x <= 120)) + { + _data.startFreq = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_START_FREQ_BOILER) == 0) + { + if ((x >= 20) && (x <= 150)) + { + _data.startFreqBoiler = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MIN_FREQ) == 0) + { + if ((x >= 20) && (x <= 80)) + { + _data.minFreq = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_COOL) == 0) + { + if ((x >= 20) && (x <= 80)) + { + _data.minFreqCool = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_BOILER) == 0) + { + if ((x >= 20) && (x <= 80)) + { + _data.minFreqBoiler = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MIN_FREQ_USER) == 0) + { + if ((x >= 20) && (x <= 80)) + { + _data.minFreqUser = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MAX_FREQ) == 0) + { + if ((x >= 40) && (x <= 240)) + { + _data.maxFreq = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_COOL) == 0) + { + if ((x >= 40) && (x <= 240)) + { + _data.maxFreqCool = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_BOILER) == 0) + { + if ((x >= 40) && (x <= 240)) + { + _data.maxFreqBoiler = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_MAX_FREQ_USER) == 0) + { + if ((x >= 40) && (x <= 240)) + { + _data.maxFreqUser = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_STEP_FREQ) == 0) + { + if ((x >= 0.2) && (x <= 10)) + { + _data.stepFreq = x * 100; + return true; + } + else + return false; + } + else // Hz + if (strcmp(var, fc_STEP_FREQ_BOILER) == 0) + { + if ((x >= 0.2) && (x <= 10)) + { + _data.stepFreqBoiler = x * 100; + return true; + } + else + return false; + } // Hz + + if (strcmp(var, fc_DT_TEMP) == 0) + { + if ((x > 0) && (x < 10)) + { + _data.dtTemp = x * 100; + return true; + } + else + return false; + } + else // degrees + if (strcmp(var, fc_DT_TEMP_BOILER) == 0) + { + if ((x > 0) && (x < 10)) + { + _data.dtTempBoiler = x * 100; + return true; + } + else + return false; + } + else // degrees + return false; +} + +// Get information about the chastotnik, information is added to buf +char *devOmronMX2::get_infoFC(char *buf) +{ + // #ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + /* + if (!HP.dFC.get_present()) + { + strcat(buf, " | Data not available (no inverter) |; "); + return buf; + } // The inverter is not in the configuration + if (HP.dFC.get_blockFC()) + { + strcat(buf, " | Data not available (no Modbus communication, inverter locked) |; "); + return buf; + } // Inverter locked + int8_t i; + strcat(buf, " - | Inverter state [0: Initial state, 2: Stop 3: Turn 4: Coast stop 5: Jog 6: DC braking "); + strcat(buf, " 7: Retrying 8: Failing 9: Undervoltage -1: Blocking] | "); + _itoa(read_0x03_16(MX2_STATE), buf); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat(buf, " d001 | Output frequency control (Hz) | "); + _ftoa(buf, (float)read_0x03_32(MX2_CURRENT_FR) / 100.0, 2); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat(buf, " d003 | Output current control (A) | "); + _ftoa(buf, (float)read_0x03_16(MX2_AMPERAGE) / 100.0, 2); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat(buf, " d014 | Power control (kW) | "); + _ftoa(buf, (float)read_0x03_16(MX2_POWER) / 10.0, 1); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat(buf, " d013 | Monitoring the output voltage (V) | "); + _ftoa(buf, (float)read_0x03_16(MX2_VOLTAGE) / 10.0, 1); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat(buf, " d015 | Watt-hour control (kW / h) | "); + _ftoa(buf, (float)read_0x03_32(MX2_POWER_HOUR) / 10.0, 1); + strcat(buf, " ; "); + _delay(FC_DELAY_READ); + strcat (buf, " d016 | Runtime monitoring in \" Run \ " mode (h) | " ); _itoa ( read_0x03_32 (MX2_HOUR), buf); strcat (buf, " ; " ); + _delay (FC_DELAY_READ); + strcat (buf, " d017 | Runtime monitoring with power on (h) | " ); _itoa ( read_0x03_32 (MX2_HOUR1), buf); strcat (buf, " ; " ); + _delay (FC_DELAY_READ); + strcat (buf, " d018 | Radiator temperature control (° C) | " ); _ftoa (buf, ( float ) read_0x03_16 (MX2_TEMP) / 10.0 , 2 ); strcat (buf, " ; " ); + _delay (FC_DELAY_READ); + strcat (buf, " d102 | DC voltage control (V) | " ); _ftoa (buf, ( float ) read_0x03_16 (MX2_VOLTAGE_DC) / 10.0 , 1 ); strcat (buf, " ; " ); + _delay (FC_DELAY_READ); + strcat (buf, " d080 | Counter of emergency shutdowns (pcs) | " ); _itoa ( read_0x03_16 (MX2_NUM_ERR), buf); strcat (buf, " ; " ); + for (i = 0 ; i < 6 ; i ++) // Scan By Errors + { + strcat(buf, " d0 "); + _itoa(81 + i, buf); + strcat(buf, " | State at the time of the error "); + read_0x03_error(MX2_ERROR1 + i * 0x0a); + // Formation of the answer in line + strcat(buf, " [F: "); + _ftoa(buf, (float)error.MX2.fr / 100.0, 2); + strcat(buf, " I: "); + _ftoa(buf, (float)error.MX2.cur / 100.0, 2); + strcat(buf, " V: "); + _ftoa(buf, (float)error.MX2.vol / 10.0, 2); + strcat(buf, " T1: "); + _itoa(error.MX2.time1, buf); + strcat(buf, " T2: "); + _itoa(error.MX2.time2, buf); + strcat(buf, " ] Error code: | "); + if (error.MX2.code < 10) + strcat(buf, " E0 "); + else + strcat(buf, " E "); + _itoa(error.MX2.code, buf); + strcat(buf, " . "); + _itoa(error.MX2.status, buf); + strcat(buf, " ; "); + } +#endif +return buf; +*/ +} +// Reset inverter errors by modbass +boolean devOmronMX2 ::reset_errorFC() +{ +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + write_0x06_16(MX2_INIT_DEF, 0x01); // set the initialization mode - erasing errors + _delay(FC_DELAY_READ); + if ((read_0x03_16(MX2_INIT_DEF) == 0x01) && (err = OK)) // issue an initialization command if only errors have been erased + { + write_0x06_16(MX2_INIT_RUN, 0x01); + // jprintf(" Reset error% s \ r \ n ", name); + } + else + // jprintf(" $ WARNING: bad read from MX2_INIT_DEF, no reset error \ r \ n "); +#endif + if (err == OK) + return true; + else + return false; +} + +// Reset the inverter via modbas +boolean devOmronMX2::reset_FC() +{ +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + write_0x05_bit(MX2_RESET, true); // send a command to reset by modbas +// jprintf ("Reset% s use Modbus \ r \ n", name); +#endif + if (err == OK) + return true; + else + return false; +} + +// Current state of the inverter +// +int16_t devOmronMX2::read_stateFC() +{ +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + state = read_0x03_16(MX2_STATE); // read the state + if (GETBIT(_data.setup_flags, fLogWork) && GETBIT(flags, fOnOff)) + { + // jprintf_time(" FC:% Xh,% .2fHz,% .2fA,% .2fkW \ n ", state, (float)freqFC / 100.0, (float)current / 100.0, (float)get_power() / 1000.0); + } + return state; +#else + return 0; +#endif +} + +// Radiator temperature +int16_t devOmronMX2::read_tempFC() +{ +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + return read_0x03_16(MX2_TEMP); +#else + return 0; +#endif +} +// Communication functions on the inverter modbas Read registers +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT +// Reading a single bit into the cmd register returns a code, the error is updated +// Implemented FC_NUM_READ read / write attempts to the inverter +boolean devOmronMX2 ::read_0x01_bit(uint16_t cmd) +{ + uint8_t i; + boolean result; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return false; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ attempts to read Read the inverter status, if an error occurs, generate a common VT error and stop + { + err = Modbus.readCoil(FC_MODBUS_ADR, cmd - 1, &result); // send a request, Numbering of registers MX2 from ZERO !!!! + if (err == OK) + break; // Read successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + + check_blockFC(); // check for blocking + return result; +} +// Function 0x03 read 2 bytes, returns a value, the error is updated +// Implemented FC_NUM_READ read / write attempts to the inverter +int16_t devOmronMX2::read_0x03_16(uint16_t cmd) +{ + uint8_t i; + uint16_t result; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return 0; // exit if there is no inverter or it is blocked by mistake + + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ attempts to read Read the inverter status, if an error occurs, generate a common VT error and stop + { + err = Modbus.readHoldingRegisters16(FC_MODBUS_ADR, cmd - 1, &result); // Send a request, MX2 register numbering from ZERO !!!! + if (err == OK) + break; // Read successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __FUNCTION__, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + check_blockFC(); // check for blocking + return result; +} + +// Function 0x03 read 4 bytes +// Implemented FC_NUM_READ read / write attempts to the inverter +uint32_t devOmronMX2::read_0x03_32(uint16_t cmd) +{ + uint8_t i; + uint32_t result; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return 0; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ attempts to read Read the inverter status, if an error occurs, generate a common VT error and stop + { + err = Modbus.readHoldingRegisters32(FC_MODBUS_ADR, cmd - 1, &result); // send a request, Numbering of registers MX2 from ZERO !!!! + if (err == OK) + break; // Read successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + check_blockFC(); // check for blocking + return result; +} + +// Modbus function 0x03 error description num NUMBERING from 0 (total data length 10 words, 2 bytes each) +// Returns the error code and puts a description in the buffer +// Implemented FC_NUM_READ read / write attempts to the inverter +int16_t devOmronMX2::read_0x03_error(uint16_t cmd) +{ + uint8_t i; + uint16_t tmp; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < 0x0a; i++) + error.inputBuf[i] = 0; + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ attempts to read Read the inverter status, if an error occurs, generate a common VT error and stop + { + err = Modbus.readHoldingRegistersNN(FC_MODBUS_ADR, cmd - 1, 0x0a, error.inputBuf); // send a request, Numbering of registers from ZERO !!!! + if (err == OK) + break; // Read successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + if (err == OK) // For times, rearrange the words (2 bytes), i.e., the leading 2 bytes then the lower + { + tmp = error.inputBuf[6]; + error.inputBuf[6] = error.inputBuf[7]; + error.inputBuf[7] = tmp; // Total operating time in the "Run" mode to the time of shutdown + tmp = error.inputBuf[8]; + error.inputBuf[8] = error.inputBuf[9]; + error.inputBuf[9] = tmp; // The total operating time of the inverter with the power on at the time the output is turned off + } + check_blockFC(); // check for blocking + return err; +} + +// Writing a single bit to the cmd register returns an error code +// Implemented FC_NUM_READ read / write attempts to the inverter +int8_t devOmronMX2::write_0x05_bit(uint16_t cmd, boolean f) +{ + uint8_t i; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ write attempts + { + if (f) + err = Modbus.writeSingleCoil(FC_MODBUS_ADR, cmd - 1, 1); // send a request, Numbering of registers from ZERO !!!! + else + err = Modbus.writeSingleCoil(FC_MODBUS_ADR, cmd - 1, 0); + if (err == OK) + break; // Written successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + check_blockFC(); // check for blocking + return err; +} +// Writing data (2 bytes) to the cmd register returns an error code +// Implemented FC_NUM_READ read / write attempts to the inverter +int8_t devOmronMX2::write_0x06_16(uint16_t cmd, uint16_t data) +{ + uint8_t i; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ write attempts + { + err = Modbus.writeHoldingRegisters16(FC_MODBUS_ADR, cmd - 1, data); // send a request, Numbering of registers from ZERO !!!! + if (err == OK) + break; // Written successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + check_blockFC(); // check for blocking + return err; +} +// Writing data (4 bytes) to the cmd register returns an error code +int8_t devOmronMX2 ::write_0x10_32(uint16_t cmd, uint32_t data) +{ + uint8_t i; + err = OK; + if ((!get_present()) || (GETBIT(flags, fErrFC))) + return err; // exit if there is no inverter or it is blocked by mistake + for (i = 0; i < FC_NUM_READ; i++) // make FC_NUM_READ write attempts + { + err = Modbus.writeHoldingRegisters32(FC_MODBUS_ADR, cmd - 1, data); // send a request, Numbering of registers from ZERO !!!! + if (err == OK) + break; // Written successfully + _delay(FC_DELAY_REPEAT); + // jprintf(cErrorRS485, name, __ FUNCTION __, err); // Display a message about re-reading + numErr++; // number of errors reading by modbass + // jprintf_time (cErrorRS485, name, err); // Output the error code to the log + } + check_blockFC(); // check for blocking + return err; +} +#endif // FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.h b/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.h new file mode 100644 index 0000000..6fad179 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/OmronMx2.h @@ -0,0 +1,497 @@ +// ------------------------------------------------ -------------------------------- +// Description: Omron MX2 inverter operation class +// Public class methods are unified for all inverters +// ------------------------------------------------ -------------------------------- +#ifndef OmronFC_h +#define OmronFC_h +#include +#include "ModbusMaster.h" + +// #include "Constant.h " // All configuration and project constants Must be first !!!! +#define GETBIT(b, f) ((b & (1 << (f))) ? true : false) +#define SETBIT1(b, f) (b |= (1 << (f))) +#define SETBIT0(b, f) (b &= ~(1 << (f))) + +#define ERR_LINK_FC 0xFF // Inertor state - no communication. +#define fFC 0 // flag the presence of an inverter +#define fFC_RetOil 1 // Oil Return +#define fPower 2 // flag power limitation mode (reserve - limitation is always now) +#define fOnOff 3 // enable / disable flag +#define fErrFC 4 // flag global inverter error - inverter operation is prohibited +#define fAutoResetFault 5 // flag Auto- reset of non-critical inverter failure +#define fLogWork 6 // flag log parameters during operation +#define fFC_RetOilSt 7 // Work oil return +#define FC_SAVED_FLAGS ((1 << fAutoResetFault) | (1 << fLogWork) | (1 << fFC_RetOil)) + + +#ifndef FC_VACON + + +#define WARNING_VALUE 1 // Attempt to set a value outside the range of the query type SET \ + // Icon for heating hot water +#define OK 0 // No errors +#define ERR_MINTEMP -1 // Exit the lower limit of the temperature sensor +#define ERR_MAXTEMP -2 // Exit the upper limit of the temperature sensor +#define ERR_MINPRESS -3 // Exit the lower limit of the pressure sensor +#define ERR_MAXPRESS -4 // Go beyond the upper limit of the pressure sensor +#define ERR_SENSOR -5 // Sensor is not allowed in the current configuration +#define ERR_ADDRESS -6 // Temperature sensor address not set +#define ERR_DINPUT -7 // Contact sensor trips - alarm +#define ERR_MAX_EEV -8 // Going out of range (in steps) at the top +#define ERR_MIN_EEV -9 // Out of range (in steps) at the bottom +#define ERR_DEVICE -10 // The device is prohibited in the current configuration +#define ERR_ONEWIRE -11 // Reset error on the OneWire bus (open or short) +#define ERR_OVERHEAT -12 // ERV received a negative overheat +#define ERR_MEM_FREERTOS -13 // Free RTOS cannot create a task - not enough memory +#define ERR_PEVA_EEV -14 // There is no pressure sensor, and the ERV algorithm that uses it is selected +#define ERR_SAVE_EEPROM -15 // Error writing settings to eeprom I2C +#define ERR_LOAD_EEPROM -16 // Error reading settings from eeprom I2C +#define ERR_CRC16_EEPROM -17 // Checksum error for settings +#define ERR_BAD_LEN_EEPROM -18 // Data size mismatch while reading settings +#define ERR_HEADER_EEPROM -19 // Settings data not found in eeprom I2C +#define ERR_SAVE1_EEPROM -20 // Error writing status to eeprom I2C +#define ERR_LOAD1_EEPROM -21 // Error reading state from eeprom I2C +#define ERR_HEADER1_EEPROM -22 // Status data not found in eeprom I2C +#define ERR_SAVE2_EEPROM -23 // Error writing counters to eeprom I2C +#define ERR_LOAD2_EEPROM -24 // Error reading counters from eeprom I2C +#define ERR_WRONG_HARD_STATE -25 // Invalid VT state +#define ERR_DTEMP_CON -26 // The temperature difference on the condenser has been increased +#define ERR_DTEMP_EVA -27 // Excessive temperature difference on the evaporator +#define ERR_PUMP_CON -28 // There is no pump on the condenser, check the configuration +#define ERR_PUMP_EVA -29 // There is no pump on the evaporator, check the configuration +#define ERR_READ_PRESS -30 // Error reading pressure sensor (data not ready) +#define ERR_NO_COMPRESS -31 // There is no compressor, check the configuration +#define ERR_NO_WORK -32 // Everything is off and VT is on +#define ERR_COMP_ERR -33 // Attempt to turn on the compressor on error (contact the developer) +#define ERR_CONFIG -34 // Internal configuration failed (contact the developer) +#define ERR_SD_INIT -35 // Error initializing the SD card +#define ERR_SD_INDEX -36 // Index.xxx file not found on SD card +#define ERR_SD_READ -37 // Error reading file from SD card +#define ERR_TYPE_OVERHEAT -38 // The rule for calculating overheating does not match the sensors (contact the developer) +#define ERR_485_INIT -39 // Inverter on Modbus was not found (inverter operation is prohibited) +#define ERR_485_BUZY -40 // When accessing port 485, the waiting time for its release was exceeded +// Errors described in the modbus protocol +#define ERR_MODBUS_0x01 -41 // Modbus 0x01 protocol illegal function exception +#define ERR_MODBUS_0x02 -42 // Modbus 0x02 protocol illegal data address exception +#define ERR_MODBUS_0x03 -43 // Modbus 0x03 protocol illegal data value exception +#define ERR_MODBUS_0x04 -44 // Modbus 0x4 protocol slave device failure exception +#define ERR_MODBUS_0xe0 -45 // Modbus 0xe0 Master invalid response slave ID exception +#define ERR_MODBUS_0xe1 -46 // Modbus 0xe1 Master invalid response function exception +#define ERR_MODBUS_0xe2 -47 // Modbus 0xe2 Master response timed out exception +#define ERR_MODBUS_0xe3 -48 // Modbus 0xe3 Master invalid response CRC exception +#define ERR_MODBUS_MX2_0x01 -49 // Omron mx2 Exception code 0x01 The specified function is not supported +#define ERR_MODBUS_MX2_0x02 -50 // Omron mx2 Exception code 0x02 The specified function was not found. +#define ERR_MODBUS_MX2_0x03 -52 // Omron mx2 Exception code 0x03 Unacceptable data format +#define ERR_MODBUS_MX2_0x05 -52 // Omron mx2 communication error over Modbus (function communication check 0x08 Omron mx2) +#define ERR_MODBUS_MX2_0x21 -53 // Omron mx2 Exception code 0x21 Data written to the storage register is outside the inverter +#define ERR_MODBUS_MX2_0x22 -54 // Omron mx2 Exception code 0x22 These functions are not available for the inverter +#define ERR_MODBUS_MX2_0x23 -55 // Omron mx2 Exception code 0x23 The register (bit) into which the value should be written is read-only +#define ERR_MODBUS_UNKNOW -56 // Modbus unknown error (protocol failure) +#define ERR_MODBUS_STATE -57 // Forbidden ( invalid ) state of the inverter +#define ERR_MODBUS_BLOCK -58 // Attempt to turn on the VT with the inverter locked +#define ERR_PID_FEED -59 // PID algorithm - reaching the maximum flow temperature (protection) The flow is the objective function, the protection is higher, and this should not be +#define ERR_OUT_OF_MEMORY -60 // Not enough memory to allocate arrays +#define ERR_SAVE_PROFILE -61 // Error writing profile in eeprom I2C +#define ERR_LOAD_PROFILE -62 // Error reading profile from eeprom I2C +#define ERR_CRC16_PROFILE -63 // Checksum error for profile +#define ERR_BAD_LEN_PROFILE -64 // Data size mismatch while reading profile +#define ERR_DS2482_NOT_FOUND -65 // DS2482 master was not found on the bus, I2C bus error is possible +#define ERR_DS2482_ONEWIRE -66 // DS2482 master cannot reset the OneWire bus PPD bit is 0 +#define ERR_I2C_BUZY -67 // When accessing the I2C bus, the waiting time for its release was exceeded +#define ERR_DRV_EEV -68 // Driver L9333 ERV failed (driver protection worked) +#define ERR_HEADER2_EEPROM -69 // Counter header error in eeprom I2C +#define ERR_OPEN_I2C_JOURNAL -70 // Error opening the log in I2C memory (chip initialization) +#define ERR_READ_I2C_JOURNAL -71 // Error reading the log in I2C memory +#define ERR_WRITE_I2C_JOURNAL -72 // Error writing log in I2C memory +// #define ERR_ -73 // +#define ERR_MIN_FLOW -74 // The flow in the VET is below the set level +#define ERR_MAX_VOLTAGE -75 // Mains voltage too high (SDM120 data) +#define ERR_MAX_POWER -76 // Too much portable power (SDM120 data) +#define ERR_NO_MODBUS -77 // Modbus is required but not in the configuration +#define ERR_RESET_FC -78 // Failed to reset the inverter after an error +#define ERR_SEVA_FLOW -79 // There is no flow in the evaporator (SEVA operation) +#define ERR_COMP_NO_PUMP -80 // Attempt to turn on the compressor when the circuit pumps are not working. +#define ERR_DEFROST_R4WAY -81 // Erroneous configuration - attempt to defrost if it is not possible to switch to cooling (no R4WAY) +#define ERR_DEFROST -82 // Defrosting is required (there are conditions) during cooling +#define ERR_FC_CONF_ANALOG -83 // Error using analog control of the inverter without output +#define ERR_READ_TEMP -84 // Error reading the temperature sensor (read limit exceeded ) +// #define ERR_ -85 // +#define ERR_ONEWIRE_CRC -86 // CRC error while reading OneWire +#define ERR_ONEWIRE_RW -87 // error while reading / writing OneWire +#define ERR_FC_FAULT -88 // inverter failure +#define ERR_FC_ERROR -89 // inverter control program error +#define ERR_SD_WRITE -90 // error writing to SD card +#define ERR_FC_RCOMP -91 // It is not possible to stop the inverter using RCOMP + +#define ERR_ERRMAX -91 // Last error + +// Global parameters of the inverter inverter on modbas depend on the compressor !!!!!!!!! +#define FC_MODBUS_ADR 1 // Address of the frequency converter on the bus must not match SMD_MODBUS_ADR +#define FC_TIME_READ (8 * 1000) // Inverter polling time in Moscow time (it was 6) +#define FC_NUM_READ 4 // The number of attempts to read the inverter (in a row) by modbass before it stopped the VT in error +#define FC_DELAY_REPEAT 40 // ms The time between REPEAT read attempts was 100 +#define FC_DELAY_READ 5 // ms The time between consecutive requests was 20 +#define FC_WRITE_READ 10 // ms Time between sequential recording + +// SPECIFIC INVERTER OMRON MX2 -------------------------------------------- -------------------------------------------------- ---------------- +// Control is frequency in hertz. Inside the frequency is stored in hundredths of hertz, the maximum possible frequency is 650 Hz !! +// Power stored in 0.1 kW +// Voltage at 0.1 V + +// Omron MX2 Registers +#define MX2_STATE 0x0003 // (2 bytes) Status of the inverter +#define MX2_TARGET_FR 0x0001 // (4 bytes) Source (reference) of the frequency reference (0,01 [Hz]) +#define MX2_ACCEL_TIME 0x1103 // (4 bytes) Acceleration time (cm compressor) in 0.01 sec +#define MX2_DEACCEL_TIME 0x1105 // (4 bytes) Braking time (cm compressor) in 0.01 sec + +#define MX2_CURRENT_FR 0x1001 // (4 bytes) Output frequency control (0,01 [Hz]) +#define MX2_AMPERAGE 0x1003 // (2 bytes) Output current monitoring (0,01 [A]) +#define MX2_VOLTAGE 0x1011 // (2 bytes) Monitoring output voltage 0.1 [V] +#define MX2_POWER 0x1012 // (2 bytes) Power control 0.1 [kW] +#define MX2_POWER_HOUR 0x1013 // (4 bytes) Watt-hour control 0.1 [kW / h] +#define MX2_HOUR 0x1015 // (4 bytes) Control of operating time in the "Run" mode 1 [h] +#define MX2_HOUR1 0x1017 // (4 bytes) Monitoring of running hours with power on 1 [h] +#define MX2_TEMP 0x1019 // (2 bytes) Radiator temperature control (0.1 degree) -200 ... 1500 +#define MX2_VOLTAGE_DC 0x1026 // (2 bytes) DC voltage control (PN) 0.1 [V] +#define MX2_NUM_ERR 0x0011 // (2 bytes) Trip counter 0 ... 65530 +#define MX2_ERROR1 0x0012 // (20 bytes) Description 1 trip the remaining 5 lie sequentially behind the first address error are calculated MX2_ERROR1 + i * 0x0a +#define MX2_INIT_DEF 0x1357 // (2 bytes) Set the initialization mode to 0 (nothing), 1 (clearing the shutdown history), 2 (clearing the shutdown history and initializing data), 4 (clearing the shutdown history, initializing data and the program EzSQ) +#define MX2_INIT_RUN 0x13b7 // (2 bytes) Initialization start 0 (off), 1 (on) + +#define MX2_SOURCE_FR 0x1201 // (2 bytes) Frequency reference source +#define MX2_SOURCE_CMD 0x1202 // (2 bytes) Command source +#define MX2_BASE_FR 0x1203 // (2 bytes) Main frequency 300 ... "maximum frequency" 0.1 Hz +#define MX2_MAX_FR 0x1204 // (2 bytes) Maximum frequency 300 ... 4000 (10000) 0.1 Hz +#define MX2_DC_BRAKING 0x1245 // (2 bytes) Enable DC Braking +#define MX2_STOP_MODE 0x134e // (2 bytes) Choosing a stop method B091 = 01 +#define MX2_MODE 0x13ae // (2 bytes) IF mode selection b171 = 03 + +// Setting the inverter for a specific compressor Registers Hxxx Permanent magnet motor (PM motor) +#define MX2_b171 0x13ae // b171 Inverter selection b171 read / write 0 (off), 1 (IM mode), 2 (high frequency mode), 3 (PM mode) = 03 +#define MX2_b180 0x13b7 // b180 Initialization trigger = 01 +#define MX2_H102 0x1571 // H102 Setting the PM engine code 00 (standard Omron data) 01 (auto-tuning data) = 1 +#define MX2_H103 0x1572 // H103 PM engine power (0.1 / 0.2 / 0.4 / 0.55 / 0.75 / 1.1 / 1.5 / 2.2 / 3.0 / 3, 7 / 4.0 / 5.5 / 7.5 / 11.0 / 15.0 / 18.5) = 7 +#define MX2_H104 0x1573 // H104 Setting the number of poles of the PM motor = 4 +#define MX2_H105 0x1574 // H105 Rated current of the PM motor = 1000 (this is 11A) +#define MX2_H106 0x1575 // H106 PM motor constant R From 0.001 to 65.535 Ohms = 0.55 +#define MX2_H107 0x1576 // H107 PM Engine Ld Constant From 0.01 to 655.35 mH = 2.31 +#define MX2_H108 0x1577 // H108 Lq constant of PM engine From 0.01 to 655.35 mH = 2.7 +#define MX2_H109 0x1578 // H109 Ke Engine Constant PM-motor 0.0001 ... 6.5535 Vmax ./ (rad / s) = 750 must be selected it affects consumption and noise +#define MX2_H110 0x1579 // (4 bytes) H110 PM motor constant J From 0.001 to 9999,000 kg / m² = 0.01 +#define MX2_H111 0x157B // H111 Auto tuning constant R From 0.001 to 65.535 Ohms +#define MX2_H112 0x157C // H112 Auto-tuning constant Ld From 0.01 to 655.35 mH +#define MX2_H113 0x157D // H113 Auto tuning constant Lq From 0.01 to 655.35 mH +#define MX2_H116 0x1581 // H116 The response of the PM motor at a speed of 1 ... 1000 = 100 (default) +#define MX2_H117 0x1582 // H117 Starting current of the PM motor From 20.00 to 100.00% = 70 (default) +#define MX2_H118 0x1583 // H118 Starting time of the PM motor 0.01 ... 60.00 s = 1 (default) +#define MX2_H119 0x1584 // H119 Engine PM stabilization constant From 0 to 120% s = 100 +#define MX2_H121 0x1586 // H121 Minimum frequency of the PM motor From 0.0 to 25.5% = 0 +#define MX2_H122 0x1587 // H122 Idling current PM motor From 0.00 to 100.00% = 50 (default) +#define MX2_H123 0x1588 // H123 Choice of PM engine start method 00 (off) 01 (on) = 0 (default) +#define MX2_H131 0x158A // H131 Estimation of the initial position of the rotor of the PM motor: standby time 0 V 0 ... 255 = 10 (default) +#define MX2_H132 0x158B // H132 Assessment of the initial position of the rotor of the PM motor: waiting time for determination 0 ... 255 = 10 (default) +#define MX2_H133 0x158C // H133 Assessment of the initial position of the rotor of the PM motor: determination time 0 ... 255 = 30 (default) +#define MX2_H134 0x158D // H134 Assessment of the initial position of the rotor of the PM motor: voltage gain 0 ... 200 = 100 (default) +#define MX2_C001 0x1401 // C001 Input function [1] 0 (FW: go forward) = 0 +#define MX2_C004 0x1404 // C004 Input function [4] 18 (RS: reset) = 18 +#define MX2_C005 0x1405 // C005 Input function [5] [also input “PTC”] = 19 PTC Thermistor with positive TCS for thermal protection (only C005) +#define MX2_C026 0x1404 // C026 Relay output function 5 (AL: error signal) = 05 +#define MX2_b091 0x135E // b091 Choice of stopping method 0 (braking to a complete stop), 1 (coasting stop) = 1 +#define MX2_b021 0x1316 // b021 Operating mode with overload limitation 0 (off), 1 (enabled during acceleration and rotation at a constant speed), \ + // 2 (enabled during rotation at a constant speed), 3 (enabled during acceleration and rotation at a constant speed [increase \ + // speed in generator mode]) = 1 +#define MX2_b022 0x1317 // b022 Overload restriction level 200 ... 2000 (0.1%) = +#define MX2_b023 0x1318 // b023 Braking time with overload limitation (0.1 sec) = 10 +#define MX2_F002 0x1103 // (4 bytes) F002 Acceleration time (1) Standard, default acceleration, range from 0.001 to 3600 s (0.01 sec) = 20 * 100 +#define MX2_F003 0x1105 // (4 bytes) F003 Deceleration time (1) Standard, default acceleration, range from 0.001 to 3600 s (0.01 sec) = 20 * 100 +#define MX2_A001 0x1201 // A001 Frequency reference source 00 ... Potent. on external panels 01 ... Control terminals 02 ... Setting parameter F001 \ + // 03 ... Input via ModBus network 04 ... Add. card 06 ... Entrance imp. after 07 ... via EzSQ 10 ... Result of arithmetic operation = 03 +#define MX2_A002 0x1202 // A002 Source of the “Run” command 01 .. Control terminals 02 ... “Run” key on the keypad or digital panel 03 ... Input via the ModBus network 04 ... Add. card = 01 +#define MX2_A003 0x1203 // A003 Main frequency Can be set in the range from 30 Hz to the maximum frequency (A004) (0.1 Hz) = 120 * 10 +#define MX2_A004 0x1204 // A004 Maximum frequency Can be set in the range from the fundamental frequency to 400 Hz (0.1 Hz) = 120 * 10 + +// Omron MX2 Bits +#define MX2_START 0x0001 // (bit) Run command 1: Run, 0: Stop (valid with A002 = 03) +#define MX2_SET_DIR 0x0002 // (bit) Command of direction of rotation 1: Reverse rotation, 0: Rotation in the forward direction (valid with A002 = 03) +#define MX2_RESET 0x0004 // (bit) Reset emergency shutdown (RS) 1: Reset +#define MX2_READY 0x0011 // (bit) Ready IF 1: Ready, 0: Not ready +#define MX2_DIRECTION 0x0010 // (bit) Direction of rotation 1: Reverse rotation, 0: Rotation in the forward direction (deadlock with "d003") + +#define TEST_NUMBER 1234 // Verification code for function 0x08 + +// Default register values ​​for NC (needed for programming the inverter (progFC method), required for a specific inverter and compressor) +#define valH102 0x01 // H102 Setting the PM engine code 00 (standard Omron data) 01 (auto-tuning data) = 1 +#define valH103 7 // H103 PM engine power (0.1 / 0.2 / 0.4 / 0.55 / 0.75 / 1.1 / 1.5 / 2.2 / 3.0 / 3, 7 / 4.0 / 5.5 / 7.5 / 11.0 / 15.0 / 18.5) = 7 +#define valH104 0x04 // H104 Setting the number of poles of the PM motor = 4 +#define valH105 1000 // H105 Rated current of the PM motor = 1000 (this is 11A) +#define valH106 550 // H106 PM motor constant R From 0.001 to 65.535 Ohms = 0.55 * 1000 +#define valH107 231 // H107 Constant Ld of the PM engine From 0.01 to 655.35 mH = 2.31 * 100 +#define valH108 270 // H108 Lq constant of PM engine From 0.01 to 655.35 mH = 2.7 * 100 +#define valH109 810 // H109 Constant Ke of the PM motor 0.0001 ... 6.5535 Vmax ./ (rad / s) = 750 must be selected influences consumption and noise +#define valH110 10 // H110 PM motor constant J From 0.001 to 9999,000 kg / m² = 0.01 +#define valH119 100 // H119 Engine PM stabilization constant From 0 to 120% s = 100 +#define valH121 10 // H121 Minimum frequency of the PM engine From 0.0 to 25.5% = 10 (default) (no need to change) +#define valH122 10 // H122 Idling current PM motor From 0.00 to 100.00% = 50 (default) (no need to change) +#define valC001 0 // C001 Input function [1] 0 (FW: go forward) = 0 +#define valC004 18 // C004 Input function [4] 18 (RS: reset) = 18 +#define valC005 19 // C005 Input function [5] [also PTC input] = 19 PTC Thermistor with positive TCS for thermal protection (only C005) (no need to change) +#define valC026 5 // C026 Relay output function 5 (AL: error signal) = 05 +#define valb091 1 // b091 Choice of stopping method 0 (braking to a complete stop), 1 (coasting stop) = 1 (no need to change) +#define valb021 1 // b021 Operating mode with overload limitation = 1 (no need to change) +#define valb022 1000 // b022 Overload restriction level 200 ... 2000 (0.1%) = +#define valb023 10 // b023 Braking time with overload limitation (0.1 sec) = 10 +#define valA001 3 // A001 Frequency reference source = 03 (no need to change) +#define valA002 1 // A002 Source of the “Move” command = 1 (no need to change) + +#define DEF_FC_DT_COMP_TEMP (5 * 100) // Защита по температуре компрессора - сколько градусов не доходит до максимальной (TCOMP) и при этом происходит уменьшение частоты +#define DEF_FC_UPTIME (10) // Время обновления алгоритма пид регулятора (мсек) Основной цикл управления +#define DEF_FC_PID_FREQ_STEP (2 * 100) // Максимальный шаг (на увеличение) изменения частоты при ПИД регулировании в 0.01 Гц Необходимо что бы ЭРВ успевал +#define DEF_FC_PID_STOP 90 // Проценты от уровня защит (мощность, ток, давление, темпеартура) при которой происходит блокировка роста частоты пидом (плавный подход к границе) +#define DEF_FC_START_FREQ (55 * 100) // Стартовая частота частота инвертора отопление/охлаждение (см компрессор) в 0.01 Гц +#define DEF_FC_START_FREQ_BOILER (45 * 100) // Стартовая частота частота инвертора ГВС (см компрессор) в 0.01 Гц ГВС +#define DEF_FC_MIN_FREQ (40 * 100) // Минимальная частота инвертора при нагреве (см компрессор) в 0.01 Гц +#define DEF_FC_MIN_FREQ_COOL (60 * 100) // Минимальная частота инвертора при охлаждении в 0.01 Гц +#define DEF_FC_MIN_FREQ_BOILER (40 * 100) // Минимальная частота инвертора при нагреве ГВС в 0.01 Гц +#define DEF_FC_MIN_FREQ_USER (35 * 100) // Минимальная частота инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 Гц +#define DEF_FC_MAX_FREQ (110 * 100) // Максимальная частота инвертора при нагреве (см компрессор) в 0.01 Гц +#define DEF_FC_MAX_FREQ_COOL (100 * 100) // Максимальная частота инвертора в режиме охлаждения в 0.01 Гц +#define DEF_FC_MAX_FREQ_BOILER (50 * 100) // Максимальная частота инвертора в режиме ГВС в 0.01 Гц поглощение бойлера обычно меньше чем СО +#define DEF_FC_MAX_FREQ_USER (120 * 100) // Максимальная частота инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 Гц +#define DEF_FC_STEP_FREQ (2 * 100) // Шаг уменьшения частоты инвертора при достижении максимальной температуры, мощности и тока (см компрессор) в 0.01 Гц +#define DEF_FC_STEP_FREQ_BOILER (5 * 100) // Шаг уменьшения частоты инвертора при достижении максимальной температуры, мощности и тока ГВС в 0.01 Гц +#define DEF_FC_DT_TEMP (1 * 100) // Привышение температуры от уставок (подача) при которой срабатыват защита (уменьшается частота) в сотых градуса +#define DEF_FC_DT_TEMP_BOILER (2 * 100) // Привышение температуры от уставок (подача) при которой срабатыват защита ГВС в сотых градуса + +#define FC_DT_CON_PRESS 50 // Защита по давлению компрессора - сколько сотых бара не доходит до максимальной (PCON) и при этом происходит уменьшение частоты +#define FC_MAX_POWER (1.8 * 1000) // Максимальная мощность инвертора (см компрессор) в 0.1 кВт +#define FC_MAX_POWER_BOILER (1.3 * 1000) // Максимальная мощность инвертора в режиме ГВС (см компрессор) в 0.1 кВт +#define FC_MAX_CURRENT (10.0 * 100) // Максимальный ток инвертора (см компрессор) в 0.01 А +#define FC_MAX_CURRENT_BOILER (11.0 * 100) // Максимальный ток инвертора для ГВС в 0.01 А +#define FC_BASE_FREQ (120 * 100) // Основная частота инвертора (см компрессор) в 0.01 Гц +#define FC_ACCEL_TIME (60 * 100) // Время разгона (см компрессор) в 0.01 сек +#define FC_DEACCEL_TIME (60 * 100) // Время торможения (см компрессор) в 0.01 сек +#define FC_START_PID_DELAY (30 * 100) // Задержка ПИД после старта компрессора + +// Значения по умолчанию (начало DEF_) не Константы +#define DEF_FC_DT_COMP_TEMP (5 * 100) // Защита по температуре компрессора - сколько градусов не доходит до максимальной (TCOMP) и при этом происходит уменьшение частоты +#define DEF_FC_UPTIME (10) // Время обновления алгоритма пид регулятора (мсек) Основной цикл управления +#define DEF_FC_PID_FREQ_STEP (2 * 100) // Максимальный шаг (на увеличение) изменения частоты при ПИД регулировании в 0.01 Гц Необходимо что бы ЭРВ успевал +#define DEF_FC_PID_STOP 90 // Проценты от уровня защит (мощность, ток, давление, темпеартура) при которой происходит блокировка роста частоты пидом (плавный подход к границе) +#define DEF_FC_START_FREQ (55 * 100) // Стартовая частота частота инвертора отопление/охлаждение (см компрессор) в 0.01 Гц +#define DEF_FC_START_FREQ_BOILER (45 * 100) // Стартовая частота частота инвертора ГВС (см компрессор) в 0.01 Гц ГВС +#define DEF_FC_MIN_FREQ (40 * 100) // Минимальная частота инвертора при нагреве (см компрессор) в 0.01 Гц +#define DEF_FC_MIN_FREQ_COOL (60 * 100) // Минимальная частота инвертора при охлаждении в 0.01 Гц +#define DEF_FC_MIN_FREQ_BOILER (40 * 100) // Минимальная частота инвертора при нагреве ГВС в 0.01 Гц +#define DEF_FC_MIN_FREQ_USER (35 * 100) // Минимальная частота инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 Гц +#define DEF_FC_MAX_FREQ (130 * 100) // Максимальная частота инвертора при нагреве (см компрессор) в 0.01 Гц +#define DEF_FC_MAX_FREQ_COOL (100 * 100) // Максимальная частота инвертора в режиме охлаждения в 0.01 Гц +#define DEF_FC_MAX_FREQ_BOILER (50 * 100) // Максимальная частота инвертора в режиме ГВС в 0.01 Гц поглощение бойлера обычно меньше чем СО +#define DEF_FC_MAX_FREQ_USER (120 * 100) // Максимальная частота инвертора РУЧНОЙ РЕЖИМ (см компрессор) в 0.01 Гц +#define DEF_FC_STEP_FREQ (2 * 100) // Шаг уменьшения частоты инвертора при достижении максимальной температуры, мощности и тока (см компрессор) в 0.01 Гц +#define DEF_FC_STEP_FREQ_BOILER (5 * 100) // Шаг уменьшения частоты инвертора при достижении максимальной температуры, мощности и тока ГВС в 0.01 Гц +#define DEF_FC_DT_TEMP (1 * 100) // Привышение температуры от уставок (подача) при которой срабатыват защита (уменьшается частота) в сотых градуса +#define DEF_FC_DT_TEMP_BOILER (2 * 100) // Привышение температуры от уставок (подача) при которой срабатыват защита ГВС в сотых градуса + +struct type_errorMX2 // error structure +{ + uint16_t code; // reason + uint16_t status; // Inverter status on shutdown + uint16_t noUse; // Not used + uint16_t fr; // IF frequency during shutdown + uint16_t cur; // IF current on shutdown + uint16_t vol; // IF voltage when disconnected + uint32_t time1; // Total running time in STROKE mode when disconnected + uint32_t time2; // Total operating time of the inverter with the power on at the time of shutdown +}; + +union union_errorFC // Omron Error Translation +{ + type_errorMX2 MX2; + uint16_t inputBuf[10]; +}; + + +typedef void *QueueHandle_t; + + +class devOmronMX2 // Class frequency converter Omron MX2 +{ + enum TEST_MODE + { + NORMAL = 0, + SAFE_TEST, + TEST, + HARD_TEST // Обязательно должен быть последним, добавляем ПЕРЕД!!! + }; + +public: + int8_t initFC(); // Initialize Frequency + int8_t progFC(); // Programming the inverter for a specific compressor + + __attribute__((always_inline)) inline boolean get_present() { return GETBIT(flags, fFC); } // The presence of the drive in the current configuration + int8_t get_err() { return err; } // Get the last chastotnik error + uint16_t get_numErr() { return numErr; } // Get the number of read errors + void get_paramFC(char *var, char *ret); // Get the inverter parameter as a string + boolean set_paramFC(char *var, float x); // Set the inverter parameter from the string + + // Get individual values + uint16_t get_Uptime() { return _data.Uptime; } // Update time of the pid controller algorithm (sec) Main control loop + uint16_t get_PidFreqStep() { return _data.PidFreqStep; } // The maximum step (to increase) the frequency change with PID control of 0.01 Hz. + uint16_t get_PidStop() { return _data.PidStop; } // Percentage of the level of protection (power, current, pressure, temperature) at which the frequency increase is blocked by the pid + uint16_t get_dtCompTemp() { return _data.dtCompTemp; } // Protection by compressor temperature - how many degrees does not reach the maximum (TCOMP) and at the same time the frequency decreases + uint16_t get_startFreq() { return _data.startFreq; } // Inverter start frequency (see compressor) at 0.01 + uint16_t get_startFreqBoiler() { return _data.startFreqBoiler; } // Starting frequency of the inverter (cm compressor) in 0.01 d.h.w. + uint16_t get_minFreq() { return _data.minFreq; } // The minimum frequency of the inverter (see compressor) is 0.01 + uint16_t get_minFreqCool() { return _data.minFreqCool; } // Minimum frequency of the inverter during cooling at 0.01 + uint16_t get_minFreqBoiler() { return _data.minFreqBoiler; } // The minimum frequency of the inverter when heating the hot water in 0.01 + uint16_t get_minFreqUser() { return _data.minFreqUser; } // Minimum frequency of the inverter MANUAL MODE (see compressor) in 0.01 + uint16_t get_maxFreq() { return _data.maxFreq; } // The maximum frequency of the inverter (see compressor) is 0.01 + uint16_t get_maxFreqCool() { return _data.maxFreqCool; } // The maximum frequency of the inverter in cooling mode is 0.01 + uint16_t get_maxFreqBoiler() { return _data.maxFreqBoiler; } // The maximum frequency of the inverter in the DHW mode at 0.01 Hz the absorption of the boiler is usually less than CO + uint16_t get_maxFreqUser() { return _data.maxFreqUser; } // Maximum frequency of the inverter MANUAL MODE (cm compressor) in 0.01 + uint16_t get_stepFreq() { return _data.stepFreq; } // Step to decrease the inverter when reaching the maximum temperature, power and current (see compressor) in 0.01 + uint16_t get_stepFreqBoiler() { return _data.stepFreqBoiler; } // Step to decrease the inverter when reaching the maximum temperature, power and DHW current of 0.01 + uint16_t get_dtTemp() { return _data.dtTemp; } // Temperature increase from the settings (feed) at which protection is activated (frequency decreases) in hundredths of a degree + uint16_t get_dtTempBoiler() { return _data.dtTempBoiler; } // Temperature increase from the settings (feed) at which the DHW protection in hundredths of a degree is triggered + + // Modbas control Common for all chastotnikov + int16_t get_target() { return FC; } // Get the target frequency of 0.01 hertz + int8_t set_target(int16_t x, boolean show, int16_t _min, int16_t _max); // Set the target frequency to 0.01 hertz show - show message or not + borders + __attribute__((always_inline)) inline uint16_t get_power() { return power * 100; } // Get the current power. Watt unit + __attribute__((always_inline)) inline uint16_t get_current() { return current; } // Get the current current at 0.01A + char *get_infoFC(char *bufn); // Get information about the chastotnik + boolean reset_errorFC(); // Reset Inverter Errors + boolean reset_FC(); // Reset the inverter via modbas + int16_t read_stateFC(); // Current state of the inverter + int16_t read_tempFC(); // Radiator temperature + + int16_t get_frequency() { return freqFC; } // Get the current frequency of 0.01 Hz + uint32_t get_startTime() { return startCompressor; } // Get the compressor start time + int8_t get_readState(); // Read (internal variables are updated) the state of the Inverter, returns either OK or an error + int8_t start_FC(); // Command move to inverter (target frequency set) + int8_t stop_FC(); // Stop command to the inverter + boolean isfOnOff() { return GETBIT(flags, fOnOff); } // get the inverter status on or off + + void check_blockFC(); // Set the ban on the use of the inverter + boolean get_blockFC() { return GETBIT(flags, fErrFC); } // Get the inverter lock flag + union_errorFC get_errorFC() { return error; } // Get structure with an error + + // Analog control + int16_t get_DAC() { return dac; }; // Get the set DAC value + int16_t get_level0() { return level0; } // Get DAC samples corresponding to 0 frequency + int16_t get_level100() { return level100; } // Get DAC samples corresponding to the maximum frequency + int16_t get_levelOff() { return levelOff; } // Get The minimum frequency at which the frequency converter is turned off (minimum power limit) + int8_t set_level0(int16_t x); // Set DAC readings corresponding to 0 power + int8_t set_level100(int16_t x); // Set DAC readings corresponding to 100 power + int8_t set_levelOff(int16_t x); // Set the minimum power at which the chastotnik turns off (limiting the minimum frequency) + uint8_t get_pinA() { return pin; } // Leg where FC is attached + + // Service + TEST_MODE get_testMode() { return testMode; }; // Get the current mode of operation + void set_testMode(TEST_MODE t) { testMode = t; }; // Set the value to the current mode of operation + char *get_note() { return note; } // Get a description + char *get_name() { return name; } // Get the name + uint8_t *get_save_addr(void) { return (uint8_t *)&_data; } // Address of the save structure + uint16_t get_save_size(void) { return sizeof(_data); } // Size of the save structure + +private: + int8_t err; // error chastotnika (work) with an error stop TN + uint16_t numErr; // number of errors reading by modbass + uint8_t number_err; // The number of communication errors when exceeding FC_NUM_READ inverter lock + // 485 control + uint16_t FC; // Inverter target frequency in 0.01 hertz + uint16_t freqFC; // Read: current inverter frequency in 0.01 hertz + uint16_t power; // Read: Current inverter power in 100 watt units (3 is 300 watts) + uint16_t current; // Read: Current inverter current in 0.01 Amp units + + int16_t state; // Read: Status of the inverter register MX2_STATE + uint32_t startCompressor; // compressor start time + union_errorFC error; // Structure for decoding the inverter error + + // Analog control + int16_t dac; // Current DAC value + int16_t level0; // DAC samples corresponding to 0 frequency + int16_t level100; // DAC readings corresponding to the maximum frequency + int16_t levelOff; // Minimum power at which the chastotnik turns off (minimum power limit) + uint8_t pin; // Leg where FC is attached + + TEST_MODE testMode; // The value of the test mode + char *note; // Description + char *name; // Inverter name + + // Structure for saving settings, Uptime is always the first + struct + { + uint16_t Uptime; // Pid controller update algorithm time (sec) Main control loop + uint16_t PidFreqStep; // The maximum step (to increase) the frequency change with PID control of 0.01 Hz It is necessary that the ERV be in time + uint16_t PidStop; // Percentage of the level of protection (power, current, pressure, temperature) at which the frequency increase is blocked by the pid + uint16_t dtCompTemp; // Protection by compressor temperature - how many degrees does not reach the maximum (TCOMP) and at the same time there is a decrease in frequency + int16_t startFreq; // Starting frequency of the inverter (cm compressor) in 0.01 + int16_t startFreqBoiler; // Starting frequency of the inverter (cm compressor) in 0.01 d.h.w. + int16_t minFreq; // The minimum frequency of the inverter (cm compressor) is 0.01 + int16_t minFreqCool; // The minimum frequency of the inverter during cooling is 0.01 + int16_t minFreqBoiler; // The minimum frequency of the inverter when heating the hot water in 0.01 + int16_t minFreqUser; // The minimum frequency of the inverter MANUAL MODE (see compressor) in 0.01 + int16_t maxFreq; // The maximum frequency of the inverter (cm compressor) is 0.01 + int16_t maxFreqCool; // The maximum frequency of the inverter in cooling mode is 0.01 + int16_t maxFreqBoiler; // The maximum frequency of the inverter in the DHW mode at 0.01 Hz the absorption of the boiler is usually less than CO + int16_t maxFreqUser; // Maximum inverter frequency MANUAL MODE (see compressor) at 0.01 + int16_t stepFreq; // Step to decrease the inverter when reaching the maximum temperature, power and current (see compressor) in 0.01 + int16_t stepFreqBoiler; // Step to decrease the inverter when reaching the maximum temperature, power and current of hot water in 0.01 + uint16_t dtTemp; // Temperature increase from the settings (feed) at which the protection is activated (frequency decreases) in hundredths of a degree + uint16_t dtTempBoiler; // Temperature increase from the settings (supply) at which the DHW protection in hundredths of a degree is triggered +#ifdef FC_ANALOG_CONTROL + int16_t level0; // DAC samples corresponding to 0 frequency + int16_t level100; // DAC readings corresponding to the maximum frequency + int16_t levelOff; // Minimum power at which the chastotnik turns off (minimum power limit) +#endif + uint8_t setup_flags; // setting flags + } _data; // Structure for saving settings, setup_flags is always the last! + uint8_t flags; // setting flags + +// Functions with OMRON MX2 Reading Registers +#ifndef FC_ANALOG_CONTROL // NOT ANALOGUE MANAGEMENT + int8_t write_0x10_32(uint16_t cmd, uint32_t data); // Writing data (4 bytes) to the cmd register returns an error code + int16_t read_0x03_16(uint16_t cmd); // Modbus function 0x03 read 2 bytes + uint32_t read_0x03_32(uint16_t cmd); // Modbus function 0x03 read 4 bytes + int16_t read_0x03_error(uint16_t cmd); // Modbus function 0x03 error description num + int8_t write_0x05_bit(uint16_t cmd, boolean f); // Writing a single bit to the cmd register returns an error code + boolean read_0x01_bit(uint16_t cmd); // Reading a single bit into the cmd register returns an error code + int8_t write_0x06_16(uint16_t cmd, uint16_t data); // Writing data (2 bytes) to the cmd register returns an error code + int8_t progReg16(uint16_t adrReg, char *nameReg, uint16_t valReg); // Programming a separate inverter register with writing to the results log + int8_t progReg32(uint16_t adrReg, char *nameReg, uint32_t valReg); // Programming two inverter registers with writing to the results log +#endif +}; + +class devModbus +{ +public: + int8_t initModbus(); // Инициализация Modbus и проверка связи возвращает ошибку + __attribute__((always_inline)) inline boolean get_present() { return GETBIT(flags, 0); } // Наличие Modbus в текущей конфигурации + int8_t readInputRegisters16(uint8_t id, uint16_t cmd, uint16_t *ret); + int8_t readInputRegisters32(uint8_t id, uint16_t cmd, uint32_t *ret); // LITTLE-ENDIAN! + int8_t readInputRegistersFloat(uint8_t id, uint16_t cmd, float *ret); // Получить значение 2-x (Modbus function 0x04 Read Input Registers) регистров (4 байта) в виде float возвращает код ошибки данные кладутся в ret + int8_t readHoldingRegisters16(uint8_t id, uint16_t cmd, uint16_t *ret); // Получить значение регистра (2 байта) МХ2 в виде целого числа возвращает код ошибки данные кладутся в ret + int8_t readHoldingRegisters32(uint8_t id, uint16_t cmd, uint32_t *ret); // Получить значение 2-x регистров (4 байта) МХ2 в виде целого числа возвращает код ошибки данные кладутся в ret + int8_t readHoldingRegistersFloat(uint8_t id, uint16_t cmd, float *ret); // Получить значение 2-x регистров (4 байта) в виде float возвращает код ошибки данные кладутся в ret + int8_t readHoldingRegistersNN(uint8_t id, uint16_t cmd, uint16_t num, uint16_t *buf); // Получить значение N регистров (2*N байта) МХ2 (положить в buf) возвращает код ошибки + int8_t writeSingleCoil(uint8_t id, uint16_t cmd, uint8_t u8State); // установить битовый вход, возвращает код ошибки Modbus function 0x05 Write Single Coil. + int8_t readCoil(uint8_t id, uint16_t cmd, boolean *ret); // прочитать отдельный бит, возвращает ошибку Modbus function 0x01 Read Coils. + int8_t writeHoldingRegisters16(uint8_t id, uint16_t cmd, uint16_t data); // Установить значение регистра (2 байта) МХ2 в виде целого числа возвращает код ошибки данные data + int8_t writeHoldingRegistersFloat(uint8_t id, uint16_t cmd, float dat); // Записать float как 2 регистра числа возвращает код ошибки данные data +#ifndef FC_VACON + int8_t LinkTestOmronMX2(); // Тестирование связи c МХ2 (актуально только с omronom) возвращает код ошибки +#endif + int8_t writeHoldingRegisters32(uint8_t id, uint16_t cmd, uint32_t data); // Записать 2 регистра подряд возвращает код ошибки + int8_t get_err() { return err; } // Получить код ошибки +private: + // Переменные + int8_t flags; // Флаги + int8_t err; // Ошибки модбас + ModbusMaster RS485; // Класс модбас 485 + int8_t translateErr(uint8_t result); // Перевод ошибки протокола Модбас в ошибки ТН +}; // End class + +#endif + +#endif \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/mtestom.ino b/extrusion/lydia-print-head-v1/firmware/test/mtestom/mtestom.ino new file mode 100644 index 0000000..8b1e306 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/mtestom.ino @@ -0,0 +1,23 @@ +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ + +#define POWER_0 CONTROLLINO_R10 // Primary power circuit +#define POWER_1 CONTROLLINO_R11 // Secondary power circuit +#define PLUNGER_MOTOR_1_DIR_PIN CONTROLLINO_R15 +#define PLUNGER_MOTOR_1_STEP_PIN CONTROLLINO_R14 +#define PLUNGER_MOTOR_2_STEP_PIN CONTROLLINO_R9 + +void setup() +{ + Serial.begin(19200); + digitalWrite(POWER_0, HIGH); + digitalWrite(POWER_1, HIGH); +} + +void loop() +{ + digitalWrite(PLUNGER_MOTOR_1_DIR_PIN, 1); + digitalWrite(PLUNGER_MOTOR_2_STEP_PIN, LOW); + digitalWrite(PLUNGER_MOTOR_1_STEP_PIN, HIGH); + delay(1000); + // dFC.initFC(); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/crc16.h b/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/crc16.h new file mode 100644 index 0000000..3ed528e --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/crc16.h @@ -0,0 +1,88 @@ +/** +@file +CRC Computations + +@defgroup util_crc16 "util/crc16.h": CRC Computations +@code#include "util/crc16.h"@endcode + +This header file provides functions for calculating +cyclic redundancy checks (CRC) using common polynomials. +Modified by Doc Walker to be processor-independent (removed inline +assembler to allow it to compile on SAM3X8E processors). + +@par References: +Jack Crenshaw's "Implementing CRCs" article in the January 1992 issue of @e +Embedded @e Systems @e Programming. This may be difficult to find, but it +explains CRC's in very clear and concise terms. Well worth the effort to +obtain a copy. + +*/ +/* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz + Copyright (c) 2005, 2007 Joerg Wunsch + Copyright (c) 2013 Dave Hylands + Copyright (c) 2013 Frederic Nadeau + Copyright (c) 2015 Doc Walker + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + + +#ifndef _UTIL_CRC16_H_ +#define _UTIL_CRC16_H_ + + +/** @ingroup util_crc16 + Processor-independent CRC-16 calculation. + + Polynomial: x^16 + x^15 + x^2 + 1 (0xA001)
+ Initial value: 0xFFFF + + This CRC is normally used in disk-drive controllers. + + @param uint16_t crc (0x0000..0xFFFF) + @param uint8_t a (0x00..0xFF) + @return calculated CRC (0x0000..0xFFFF) +*/ +uint16_t crc16_update(uint16_t crc, uint8_t a); +/*{ + int i; + + crc ^= a; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; + else + crc = (crc >> 1); + } + + return crc; +} +*/ + +#endif /* _UTIL_CRC16_H_ */ diff --git a/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/word.h b/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/word.h new file mode 100644 index 0000000..c72ad94 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/mtestom/util/word.h @@ -0,0 +1,64 @@ +/** +@file +Utility Functions for Manipulating Words + +@defgroup util_word "util/word.h": Utility Functions for Manipulating Words +@code#include "util/word.h"@endcode + +This header file provides utility functions for manipulating words. + +*/ +/* + + word.h - Utility Functions for Manipulating Words + + This file is part of ModbusMaster. + + ModbusMaster is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ModbusMaster is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ModbusMaster. If not, see . + + Written by Doc Walker (Rx) + Copyright © 2009-2015 Doc Walker <4-20ma at wvfans dot net> + +*/ + + +#ifndef _UTIL_WORD_H_ +#define _UTIL_WORD_H_ + + +/** @ingroup util_word + Return low word of a 32-bit integer. + + @param uint32_t ww (0x00000000..0xFFFFFFFF) + @return low word of input (0x0000..0xFFFF) +*/ +static inline uint16_t lowWord(uint32_t ww) +{ + return (uint16_t) ((ww) & 0xFFFF); +} + + +/** @ingroup util_word + Return high word of a 32-bit integer. + + @param uint32_t ww (0x00000000..0xFFFFFFFF) + @return high word of input (0x0000..0xFFFF) +*/ +static inline uint16_t highWord(uint32_t ww) +{ + return (uint16_t) ((ww) >> 16); +} + + +#endif /* _UTIL_WORD_H_ */ diff --git a/extrusion/lydia-print-head-v1/firmware/test/next/next.ino b/extrusion/lydia-print-head-v1/firmware/test/next/next.ino new file mode 100644 index 0000000..3b4fcec --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/next/next.ino @@ -0,0 +1,151 @@ +#include +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ + +#define MAX_BUFFER 64 //!< maximum size for the communication buffer in bytes + +int incomingByte = 0; // for incoming serial data +uint8_t au8Buffer[MAX_BUFFER]; +uint8_t au8RBuffer[MAX_BUFFER]; +uint8_t u8BufferSize = 6; + +long u16RegAdd = 0; +long u16CoilsNo = 2001; + +uint16_t calcCRC(uint8_t u8length) +{ + unsigned int temp, temp2, flag; + temp = 0xFFFF; + for (unsigned char i = 0; i < u8length; i++) + { + temp = temp ^ au8Buffer[i]; + Serial.println(au8Buffer[i], DEC); + for (unsigned char j = 1; j <= 8; j++) + { + flag = temp & 0x0001; + temp >>= 1; + if (flag) + temp ^= 0xA001; + } + } + // Reverse byte order. + temp2 = temp >> 8; + temp = (temp << 8) | temp2; + temp &= 0xFFFF; + // the returned value is already swapped + // crcLo byte is first & crcHi byte is last + return temp; +} +void write() +{ + + /** + * 10 Coils : 01 03 00 00 00 0A C5 CD + * + * SP = 100 : 01 06 26 01 00 64 D2 A9 + * SP = 20 : 01 06 26 01 00 14 D3 4D + */ + + Controllino_RS485TxEnable(); + Serial.println("sending..."); + uint8_t u8BufferSize = 6; + + au8Buffer[0] = 1; + au8Buffer[1] = 3; + au8Buffer[2] = 0; + au8Buffer[3] = 0; + au8Buffer[4] = 0; + au8Buffer[5] = 0xA; + +/* + au8Buffer[0] = 1; + au8Buffer[1] = 3; + au8Buffer[2] = highByte(u16RegAdd); + au8Buffer[3] = lowByte(u16RegAdd); + au8Buffer[4] = highByte(u16CoilsNo); + au8Buffer[5] = lowByte(u16CoilsNo); + */ + + // uint16_t u16crc = 50187; + uint16_t u16crc = calcCRC(u8BufferSize); + + Serial.print("---- calc CRC : HEX : "); + + Serial.print(u16crc, DEC); + Serial.print(" - HEX : "); + Serial.print(u16crc, HEX); + Serial.print(" - "); + Serial.print(u8BufferSize); + Serial.print("\n"); + + au8Buffer[u8BufferSize] = u16crc >> 8; + u8BufferSize++; + au8Buffer[u8BufferSize] = u16crc & 0x00ff; + u8BufferSize++; + + Serial.print("Send Hex : "); + for(int i = 0 ; i < u8BufferSize ; i++){ + Serial.print(au8Buffer[i], HEX); + Serial.print(" : "); + } + Serial.println(""); + + Serial3.write(au8Buffer, u8BufferSize); + Serial3.flush(); // wait until the trasmission is complete + Controllino_RS485RxEnable(); +} + +void setup() +{ + + /* Initialize serial port for debug messages. */ + Serial.begin(19200); + + /* Initialize CONTROLLINO RS485 direction control DE/RE pins and Serial3 */ + Controllino_RS485Init(19200); + write(); +} +boolean bBuffOverflow = false; +void loop() +{ + + // send data only when you receive data: + uint8_t ru8BufferSize = 0; + while (Serial3.available()) + { + au8RBuffer[ru8BufferSize] = Serial3.read(); + Serial.print("got data : "); + Serial.println(au8RBuffer[ru8BufferSize]); + ru8BufferSize++; + + if (ru8BufferSize >= MAX_BUFFER) + { + bBuffOverflow = true; + break; + } + } + + if (ru8BufferSize > 0) + { + // Serial.println("got data"); + // Serial.println(ru8BufferSize); + } + + /* + + if (Serial3.available() > 0) + { + Serial.println("data"); + + // read the incoming byte from RS485 + byte incomingByte = Serial3.read(); + // say what you got: + Serial.print("I received (DEC): "); + Serial.println(incomingByte, DEC); + // and send it back to RS485 + // Controllino_RS485TxEnable(); + } + */ + + delay(1000); + write(); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.cpp b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.cpp new file mode 100644 index 0000000..5c5356c --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.cpp @@ -0,0 +1,236 @@ +/* + Mudbus.cpp - an Arduino library for a Modbus TCP slave. + Copyright (C) 2011 Dee Wykoff + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "Mudbus.h" + +// For Arduino 0022 +// Server MbServer(MB_PORT); +// For Arduino 1.0 +EthernetServer MbServer(MB_PORT); + +Mudbus::Mudbus() +{ +} + +void Mudbus::Run() +{ + Runs = 1 + Runs * (Runs < 999); + + //****************** Read from socket **************** + // For Arduino 0022 + // Client client = MbServer.available(); + // For Arduino 1.0 + EthernetClient client = MbServer.available(); + if(client.available()) + { + Reads = 1 + Reads * (Reads < 999); + int i = 0; + while(client.available()) + { + ByteArray[i] = client.read(); + i++; + } + SetFC(ByteArray[7]); //Byte 7 of request is FC + if(!Active) + { + Active = true; + PreviousActivityTime = millis(); + #ifdef MbDebug + Serial.println("Mb active"); + #endif + } + } + if(millis() > (PreviousActivityTime + 60000)) + { + if(Active) + { + Active = false; + #ifdef MbDebug + Serial.println("Mb not active"); + #endif + } + } + + int Start, WordDataLength, ByteDataLength, CoilDataLength, MessageLength; + + //****************** Read Coils ********************** + if(FC == MB_FC_READ_COILS) + { + Start = word(ByteArray[8],ByteArray[9]); + CoilDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = CoilDataLength / 8; + if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; + CoilDataLength = ByteDataLength * 8; + #ifdef MbDebug + Serial.print(" MB_FC_READ_COILS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(CoilDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + ByteArray[8] = ByteDataLength; //Number of bytes after this one (or number of bytes of data). + for(int i = 0; i < ByteDataLength ; i++) + { + for(int j = 0; j < 8; j++) + { + bitWrite(ByteArray[9 + i], j, C[Start + i * 8 + j]); + } + } + MessageLength = ByteDataLength + 9; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Read Registers ****************** + if(FC == MB_FC_READ_REGISTERS) + { + Start = word(ByteArray[8],ByteArray[9]); + WordDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = WordDataLength * 2; + #ifdef MbDebug + Serial.print(" MB_FC_READ_REGISTERS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(WordDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + ByteArray[8] = ByteDataLength; //Number of bytes after this one (or number of bytes of data). + for(int i = 0; i < WordDataLength; i++) + { + ByteArray[ 9 + i * 2] = highByte(R[Start + i]); + ByteArray[10 + i * 2] = lowByte(R[Start + i]); + } + MessageLength = ByteDataLength + 9; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Write Coil ********************** + if(FC == MB_FC_WRITE_COIL) + { + Start = word(ByteArray[8],ByteArray[9]); + C[Start] = word(ByteArray[10],ByteArray[11]) > 0; + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_COIL C"); + Serial.print(Start); + Serial.print("="); + Serial.println(C[Start]); + #endif + ByteArray[5] = 2; //Number of bytes after this one. + MessageLength = 8; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + //****************** Write Register ****************** + if(FC == MB_FC_WRITE_REGISTER) + { + Start = word(ByteArray[8],ByteArray[9]); + R[Start] = word(ByteArray[10],ByteArray[11]); + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_REGISTER R"); + Serial.print(Start); + Serial.print("="); + Serial.println(R[Start]); + #endif + ByteArray[5] = 6; //Number of bytes after this one. + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + + //****************** Write Multiple Coils ********************** + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + if(FC == MB_FC_WRITE_MULTIPLE_COILS) + { + Start = word(ByteArray[8],ByteArray[9]); + CoilDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = CoilDataLength / 8; + if(ByteDataLength * 8 < CoilDataLength) ByteDataLength++; + CoilDataLength = ByteDataLength * 8; + #ifdef MbDebug + Serial.print(" MB_FC_WRITE_MULTIPLE_COILS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(CoilDataLength); + #endif + ByteArray[5] = ByteDataLength + 5; //Number of bytes after this one. + for(int i = 0; i < ByteDataLength ; i++) + { + for(int j = 0; j < 8; j++) + { + C[Start + i * 8 + j] = bitRead( ByteArray[13 + i], j); + } + } + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + + //****************** Write Multiple Registers ****************** + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + if(FC == MB_FC_WRITE_MULTIPLE_REGISTERS) + { + Start = word(ByteArray[8],ByteArray[9]); + WordDataLength = word(ByteArray[10],ByteArray[11]); + ByteDataLength = WordDataLength * 2; + #ifdef MbDebug + Serial.print(" MB_FC_READ_REGISTERS S="); + Serial.print(Start); + Serial.print(" L="); + Serial.println(WordDataLength); + #endif + ByteArray[5] = ByteDataLength + 3; //Number of bytes after this one. + for(int i = 0; i < WordDataLength; i++) + { + R[Start + i] = word(ByteArray[ 13 + i * 2],ByteArray[14 + i * 2]); + } + MessageLength = 12; + client.write(ByteArray, MessageLength); + Writes = 1 + Writes * (Writes < 999); + FC = MB_FC_NONE; + } + + #ifdef MbDebug + Serial.print("Mb runs: "); + Serial.print(Runs); + Serial.print(" reads: "); + Serial.print(Reads); + Serial.print(" writes: "); + Serial.print(Writes); + Serial.println(); + #endif +} + + +void Mudbus::SetFC(int fc) +{ + if(fc == 1) FC = MB_FC_READ_COILS; + if(fc == 3) FC = MB_FC_READ_REGISTERS; + if(fc == 5) FC = MB_FC_WRITE_COIL; + if(fc == 6) FC = MB_FC_WRITE_REGISTER; + if(fc == 15) FC = MB_FC_WRITE_MULTIPLE_COILS; + if(fc == 16) FC = MB_FC_WRITE_MULTIPLE_REGISTERS; +} diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.h b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.h new file mode 100644 index 0000000..d7ee017 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus.h @@ -0,0 +1,96 @@ +/* + Mudbus.h - an Arduino library for a Modbus TCP slave. + Copyright (C) 2011 Dee Wykoff + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +//#define MbDebug + +// For Arduino 0022 +// #include "WProgram.h" +// For Arduino 1.0 +#include "Arduino.h" + +#include +#include + +#ifndef Mudbus_h +#define Mudbus_h + +#define MB_N_R 125 //Max 16 bit registers for Modbus is 125 +#define MB_N_C 128 //Max coils for Modbus is 2000 - dont need that many so here is a multiple of 8 +#define MB_PORT 502 + +/* +enum MB_FC { + MB_FC_NONE = 0, + MB_FC_READ_COILS = 1, + MB_FC_READ_REGISTERS = 3, + MB_FC_WRITE_COIL = 5, + MB_FC_WRITE_REGISTER = 6, + //Function codes 15 & 16 by Martin Pettersson http://siamect.com + MB_FC_WRITE_MULTIPLE_COILS = 15, + MB_FC_WRITE_MULTIPLE_REGISTERS = 16 +}; +*/ + +class Mudbus +{ +public: + Mudbus(); + void Run(); + int R[MB_N_R]; + bool C[MB_N_C]; + bool Active; + unsigned long PreviousActivityTime; + int Runs, Reads, Writes; +private: + uint8_t ByteArray[260]; + MB_FC FC; + void SetFC(int fc); +}; + +#endif + +/* Speculations on Modbus message structure: +********************************************** +**********Master(PC) request frames*********** +00 ID high 0 +01 ID low 1 +02 Protocol high 0 +03 Protocol low 0 +04 Message length high 0 +05 Message length low 6 (6 bytes after this) +06 Slave number 1 +07 Function code +08 Start address high maybe 0 +09 Start address low maybe 0 +10 Length high maybe 125 or Data high if write +11 Length low maybe 125 or Data low if write +********************************************** +**********Slave(Arduino) response frames****** +00 ID high echo / 0 +01 ID low echo / slave ID 1 +02 Protocol high echo +03 Protocol low echo +04 Message length high echo +05 Message length low num bytes after this +06 Slave number echo +07 Function code echo +08 Start address high num bytes of data +09 Data high +10 Data low +********************************************** +*/ diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/Keywords.txt b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/Keywords.txt new file mode 100644 index 0000000..cc3ad1d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/Keywords.txt @@ -0,0 +1,25 @@ +####################################### +# Syntax Coloring Map For Mudbus +####################################### + +####################################### +# Datatypes (KEYWORD1) +####################################### + +Mudbus KEYWORD1 + +####################################### +# Methods and Functions (KEYWORD2) +####################################### + +Run KEYWORD2 +R KEYWORD2 +C KEYWORD2 + +####################################### +# Constants (LITERAL1) +####################################### + +MB_N_R LITERAL1 +MB_N_C LITERAL1 +MB_PORT LITERAL1 diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Light/Light.pde b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Light/Light.pde new file mode 100644 index 0000000..5a4867d --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Light/Light.pde @@ -0,0 +1,77 @@ +#include +#include + +#include "Mudbus.h" + +//#define DEBUG + +Mudbus Mb; +//Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) +//signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C +//Port 502 (defined in Mudbus.h) MB_PORT + +void setup() +{ + uint8_t mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 }; + uint8_t ip[] = { 192, 168, 1, 8 }; + uint8_t gateway[] = { 192, 168, 1, 1 }; + uint8_t subnet[] = { 255, 255, 255, 0 }; + Ethernet.begin(mac, ip, gateway, subnet); + //Avoid pins 4,10,11,12,13 when using ethernet shield + + delay(5000); //Time to open the terminal + Serial.begin(9600); + + pinMode(7, OUTPUT); + pinMode(8, OUTPUT); + + //Pick a reasonable threshold level to start with. + Mb.R[2] = 1500; //Is V x 1000 so 1500=1.5Volts + +} + +void loop() +{ + Mb.Run(); + + //Analog inputs 0-1023 + Mb.R[0] = analogRead(A0); //Raw signal from sensor. + //Photocell 5-10KOhms when light and about 200KOhms when dark. + //Photocell to 5V and A0. Pulldown 10KOhm resistor from A0 to Gnd. + double Volts = double(Mb.R[0]) / 1023 * 5; + Mb.R[1] = Volts * 1000; //Volts on A0 (x1000 to get digits to the right of the decimal). + double Threshold = double(Mb.R[2]) / 1000; //Below threshold = dark. Above threshold = light. + + //Analog outputs 0-255 + int Rescaled = map(Mb.R[0], 0, 1023, 0, 255); + analogWrite(6, Rescaled); //Send rescaled copy of analog input to an analog output. + + //Digital outputs + Mb.C[0] = Volts > Threshold; + digitalWrite(7, Mb.C[0]); //pin 7 indicates light. + + Mb.C[1] = Volts < Threshold; + digitalWrite(8, Mb.C[1]); //pin 8 indicates that darkness approaches. + +#ifdef DEBUG + delay(1000); + Serial.print("A0="); + Serial.print(Mb.R[0]); + Serial.print(" Volts="); + Serial.print(Volts); + Serial.print(" Threshold="); + Serial.print(Threshold); + Serial.print(" "); + if(Mb.C[0]) Serial.println("It is light"); + if(Mb.C[1]) Serial.println("Darkness approaches"); +#endif +} + +/* +Modpoll commands + Read the registers Mb.R[0], Mb.R[1], and Mb.R[2] + ./modpoll -m tcp -t4 -r 1 -c 3 192.168.1.8 + Read the coil Mb.C[0] + ./modpoll -m tcp -t0 -r 1 -c 1 192.168.1.8 +*/ + diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Mb/Mb.pde b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Mb/Mb.pde new file mode 100644 index 0000000..ba1d445 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Mb/Mb.pde @@ -0,0 +1,49 @@ +#include +#include + +#include "Mudbus.h" + +Mudbus Mb; +//Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) +//signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C +//Port 502 (defined in Mudbus.h) MB_PORT + +void setup() +{ + uint8_t mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 }; + uint8_t ip[] = { 192, 168, 1, 8 }; + uint8_t gateway[] = { 192, 168, 1, 1 }; + uint8_t subnet[] = { 255, 255, 255, 0 }; + Ethernet.begin(mac, ip, gateway, subnet); + //Avoid pins 4,10,11,12,13 when using ethernet shield + + delay(5000); + Serial.begin(9600); + + pinMode(7, INPUT); + pinMode(8, OUTPUT); +} + +void loop() +{ + Mb.Run(); + + //Analog inputs 0-1023 + Mb.R[0] = analogRead(A0); //pin A0 to Mb.R[0] + Mb.R[1] = analogRead(A1); + Mb.R[2] = analogRead(A2); + Mb.R[3] = analogRead(A3); + Mb.R[4] = analogRead(A4); + Mb.R[5] = analogRead(A5); + + //Analog outputs 0-255 + analogWrite(6, Mb.R[6]); //pin ~6 from Mb.R[6] + + //Digital inputs + Mb.C[7] = digitalRead(7); //pin 7 to Mb.C[7] + + //Digital outputs + digitalWrite(8, Mb.C[8]); //pin 8 from Mb.C[8] +} + + diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Temp/Temp.pde b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Temp/Temp.pde new file mode 100644 index 0000000..df712d0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Temp/Temp.pde @@ -0,0 +1,63 @@ +#include +#include + +#include "Mudbus.h" + +//#define DEBUG + +Mudbus Mb; +//Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) +//signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C +//Port 502 (defined in Mudbus.h) MB_PORT + +void setup() +{ + uint8_t mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 }; + uint8_t ip[] = { 192, 168, 1, 8 }; + uint8_t gateway[] = { 192, 168, 1, 1 }; + uint8_t subnet[] = { 255, 255, 255, 0 }; + Ethernet.begin(mac, ip, gateway, subnet); + //Avoid pins 4,10,11,12,13 when using ethernet shield + + delay(5000); //Time to open the terminal + Serial.begin(9600); + + analogReference(EXTERNAL); //Power the sensor with the 3.3V supply and run a wire from there to the AREF pin. +} + +#define AREF_VOLTS 3.33 + +void loop() +{ + Mb.Run(); + + //Analog inputs 0-1023 + Mb.R[6] = analogRead(A2); //Raw signal from sensor. + //TMP36 analog temperature sensor 1=5V 2=Signal 3=Gnd + //From 0.1V to 2.0V = -40 to 150 C / -40 to 302 F + //Seems like the TMP36 needs a cap on the output or it reads 10F low. Don't know what value cap, about the size of a tic. + double Volts = double(Mb.R[6]) / 1023 * AREF_VOLTS; + Mb.R[7] = Volts * 1000; //Volts on A2 (x1000 to get digits to the right of the decimal). + Mb.R[8] = map(Mb.R[7], 100, 2000, -400, 1500); //Degrees C x 10 + Mb.R[9] = map(Mb.R[7], 100, 2000, -400, 3020); //Degrees F x 10 + + +#ifdef DEBUG + delay(1000); + Serial.print("A2="); + Serial.print(Mb.R[6]); + Serial.print(" Volts="); + Serial.print(Mb.R[7] / 1000); + Serial.print(" C="); + Serial.print(Mb.R[8] / 10); + Serial.print(" F="); + Serial.println(Mb.R[9] / 10); +#endif +} + +/* +Modpoll commands + Read the registers Mb.R[6], Mb.R[7], and Mb.R[8] + ./modpoll -m tcp -t4 -r7 -c4 192.168.1.8 +*/ + diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Touch/Touch.pde b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Touch/Touch.pde new file mode 100644 index 0000000..a9f98ad --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/Mudbus/examples/Touch/Touch.pde @@ -0,0 +1,65 @@ +#include +#include + +#include "Mudbus.h" + +//#define DEBUG + +Mudbus Mb; +//Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) +//signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C +//Port 502 (defined in Mudbus.h) MB_PORT + +void setup() +{ + uint8_t mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x51, 0x06 }; + uint8_t ip[] = { 192, 168, 1, 8 }; + uint8_t gateway[] = { 192, 168, 1, 1 }; + uint8_t subnet[] = { 255, 255, 255, 0 }; + Ethernet.begin(mac, ip, gateway, subnet); + //Avoid pins 4,10,11,12,13 when using ethernet shield + + delay(5000); //Time to open the terminal + Serial.begin(9600); + + //Pick a reasonable threshold level to start with. + Mb.R[5] = 500; //Is V x 1000 so 5=0.5Volts + +} + +void loop() +{ + Mb.Run(); + + //Analog inputs 0-1023 + Mb.R[3] = analogRead(A1); //Raw signal from sensor. + //Photocell 5-10KOhms when light and about 200KOhms when dark. + //Photocell to 5V and A0. Pulldown 10KOhm resistor from A0 to Gnd. + double Volts = double(Mb.R[3]) / 1023 * 5; + Mb.R[4] = Volts * 1000; //Volts on A1 (x1000 to get digits to the right of the decimal). + double Threshold = double(Mb.R[5]) / 1000; //Below threshold = dark. Above threshold = light. + + Mb.C[2] = Volts > Threshold; //Indicates touch. + +#ifdef DEBUG + delay(1000); + Serial.print("A1="); + Serial.print(Mb.R[3]); + Serial.print(" Volts="); + Serial.print(Volts); + Serial.print(" Threshold="); + Serial.print(Threshold); + Serial.print(" "); + if(Mb.C[2]) Serial.println("Touching"); + if(!Mb.C[2]) Serial.println("Not Touching"); +#endif +} + +/* +Modpoll commands + Read the registers Mb.R[3], Mb.R[4], and Mb.R[5] + ./modpoll -m tcp -t4 -r 4 -c 3 192.168.1.8 + Read the coil Mb.C[2] + ./modpoll -m tcp -t0 -r 3 -c 1 192.168.1.8 +*/ + diff --git a/extrusion/lydia-print-head-v1/firmware/test/tcp/tcp.ino b/extrusion/lydia-print-head-v1/firmware/test/tcp/tcp.ino new file mode 100644 index 0000000..b484b14 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/tcp/tcp.ino @@ -0,0 +1,57 @@ +#include +#include +#include + +#include "Mudbus.h" + +Mudbus Mb; + +int D0 = CONTROLLINO_D0; +int D1 = CONTROLLINO_D1; +int R0 = CONTROLLINO_R0; +int A0_ = CONTROLLINO_A0; + +//Function codes 1(read coils), 3(read registers), 5(write coil), 6(write register) +//signed int Mb.R[0 to 125] and bool Mb.C[0 to 128] MB_N_R MB_N_C +//Port 502 (defined in Mudbus.h) MB_PORT + +void setup() +{ + uint8_t mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}; + uint8_t ip[] = {192, 168, 1, 111}; + uint8_t gateway[] = {192, 168, 1, 1}; + uint8_t subnet[] = {255, 255, 255, 0}; + Ethernet.begin(mac, ip, gateway, subnet); + + delay(5000); + Serial.begin(19200); + Serial.println("Started"); + + pinMode(D0, OUTPUT); + pinMode(D1, INPUT); + pinMode(R0, OUTPUT); + pinMode(A0_, INPUT); +} + +int l = 0; + +void loop() +{ + + Mb.Run(); + + analogWrite(D0, Mb.R[0]); + digitalWrite(R0, Mb.R[2]); + Mb.R[1] = l + 4; + Mb.R[3] = l + 2; + + l++; + if (l % 100) + { + Serial.println("l"); + } + if(l > 5000){ + l = 0; + } + delay(1); +} \ No newline at end of file diff --git a/extrusion/lydia-print-head-v1/firmware/test/test_RS485/DemoRS485.ino b/extrusion/lydia-print-head-v1/firmware/test/test_RS485/DemoRS485.ino new file mode 100644 index 0000000..c568a3f --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/test_RS485/DemoRS485.ino @@ -0,0 +1,65 @@ +#include +#include /* Usage of CONTROLLINO library allows you to use CONTROLLINO_xx aliases in your sketch. */ +#define POWER_0 CONTROLLINO_R10 // Primary power circuit +#define POWER_1 CONTROLLINO_R11 // Secondary power circuit + +/* + CONTROLLINO - Demonstration of RS485 interface usage, Version 02.00 + + Compatible with CONTROLLINO MAXI and MEGA. + + IMPORTANT INFORMATION! + Please, select proper target board in Tools->Board->Controllino MAXI/MEGA before Upload to your CONTROLLINO. + + (Refer to https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library if you do not see the CONTROLLINOs in the Arduino IDE menu Tools->Board.) + + This example sketch requires external 12V or 24V power supply for your CONTROLLINO and RS485 communication partner device (e.g. RS485-USB converter and PC). + + Created 12 Jan 2017, Updated 20.09.2018 + by Lukas + + https://controllino.biz/ + + (Check https://github.com/CONTROLLINO-PLC/CONTROLLINO_Library for the latest CONTROLLINO related software stuff.) +*/ + +int incomingByte = 0; // for incoming serial data + +void setup() { + + + digitalWrite(POWER_0, HIGH); + digitalWrite(POWER_1, HIGH); + delay(2000); + + /* Initialize serial port for debug messages. */ + Serial.begin(19200); + + /* Initialize CONTROLLINO RS485 direction control DE/RE pins and Serial3 */ + Controllino_RS485Init(19200); + Controllino_RS485RxEnable(); + Controllino_RS485TxEnable(); + + Serial.println("Recieving RS485..."); +} + +void loop() { + + // send data only when you receive data: + if (Serial3.available() > 0) + { + // read the incoming byte from RS485 + incomingByte = Serial3.readString(); + // say what you got: + Serial.print("I received (DEC): "); + Serial.println(incomingByte, DEC); + + // and send it back to RS485 + + Serial3.write(incomingByte); + Serial3.flush(); // wait until the trasmission is complete + } + +} + +/* 2018-09-20: The sketch was successfully tested with Arduino 1.8.5, Controllino Library 3.0.2 and CONTROLLINO MAXI and MEGA. */ diff --git a/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.cpp b/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.cpp new file mode 100644 index 0000000..fe23efc --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.cpp @@ -0,0 +1,200 @@ +/* + RS485 protocol library. + + Devised and written by Nick Gammon. + Date: 14 November 2011 + Version: 1.1 + + Version 1.1 reset the timeout period after getting STX. + + Can send from 1 to 255 bytes from one node to another with: + + * Packet start indicator (STX) + * Each data byte is doubled and inverted to check validity + * Packet end indicator (ETX) + * Packet CRC (checksum) + + + To allow flexibility with hardware (eg. Serial, SoftwareSerial, I2C) + you provide three "callback" functions which send or receive data. Examples are: + + void fWrite (const byte what) + { + Serial.write (what); + } + + int fAvailable () + { + return Serial.available (); + } + + int fRead () + { + return Serial.read (); + } + + +PERMISSION TO DISTRIBUTE + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + + LIMITATION OF LIABILITY + + The software is provided "as is", without warranty of any kind, express or implied, + including but not limited to the warranties of merchantability, fitness for a particular + purpose and noninfringement. In no event shall the authors or copyright holders be liable + for any claim, damages or other liability, whether in an action of contract, + tort or otherwise, arising from, out of or in connection with the software + or the use or other dealings in the software. + + */ + + +#include + +const byte STX = '\2'; +const byte ETX = '\3'; + +// calculate 8-bit CRC +static byte crc8 (const byte *addr, byte len) +{ + byte crc = 0; + while (len--) + { + byte inbyte = *addr++; + for (byte i = 8; i; i--) + { + byte mix = (crc ^ inbyte) & 0x01; + crc >>= 1; + if (mix) + crc ^= 0x8C; + inbyte >>= 1; + } // end of for + } // end of while + return crc; +} // end of crc8 + +// send a byte complemented, repeated +// only values sent would be (in hex): +// 0F, 1E, 2D, 3C, 4B, 5A, 69, 78, 87, 96, A5, B4, C3, D2, E1, F0 +void sendComplemented (WriteCallback fSend, const byte what) +{ +byte c; + + // first nibble + c = what >> 4; + fSend ((c << 4) | (c ^ 0x0F)); + + // second nibble + c = what & 0x0F; + fSend ((c << 4) | (c ^ 0x0F)); + +} // end of sendComplemented + +// send a message of "length" bytes (max 255) to other end +// put STX at start, ETX at end, and add CRC +void sendMsg (WriteCallback fSend, const byte * data, const byte length) +{ + fSend (STX); // STX + for (byte i = 0; i < length; i++) + sendComplemented (fSend, data [i]); + fSend (ETX); // ETX + sendComplemented (fSend, crc8 (data, length)); +} // end of sendMsg + +// receive a message, maximum "length" bytes, timeout after "timeout" milliseconds +// if nothing received, or an error (eg. bad CRC, bad data) return 0 +// otherwise, returns length of received data +byte recvMsg (AvailableCallback fAvailable, // return available count + ReadCallback fRead, // read one byte + byte * data, // buffer to receive into + const byte length, // maximum buffer size + unsigned long timeout) // milliseconds before timing out + { + + unsigned long start_time = millis (); + + bool have_stx = false; + + // variables below are set when we get an STX + bool have_etx; + byte input_pos; + bool first_nibble; + byte current_byte; + + while (millis () - start_time < timeout) + { + if (fAvailable () > 0) + { + byte inByte = fRead (); + + switch (inByte) + { + + case STX: // start of text + have_stx = true; + have_etx = false; + input_pos = 0; + first_nibble = true; + start_time = millis (); // reset timeout period + break; + + case ETX: // end of text + have_etx = true; + break; + + default: + // wait until packet officially starts + if (!have_stx) + break; + + // check byte is in valid form (4 bits followed by 4 bits complemented) + if ((inByte >> 4) != ((inByte & 0x0F) ^ 0x0F) ) + return 0; // bad character + + // convert back + inByte >>= 4; + + // high-order nibble? + if (first_nibble) + { + current_byte = inByte; + first_nibble = false; + break; + } // end of first nibble + + // low-order nibble + current_byte <<= 4; + current_byte |= inByte; + first_nibble = true; + + // if we have the ETX this must be the CRC + if (have_etx) + { + if (crc8 (data, input_pos) != current_byte) + return 0; // bad crc + return input_pos; // return received length + } // end if have ETX already + + // keep adding if not full + if (input_pos < length) + data [input_pos++] = current_byte; + else + return 0; // overflow + break; + + } // end of switch + } // end of incoming data + } // end of while not timed out + + return 0; // timeout +} // end of recvMsg + diff --git a/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.h b/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.h new file mode 100644 index 0000000..00c45c7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/test/test_RS485_protocol/RS485_protocol.h @@ -0,0 +1,16 @@ +#if defined(ARDUINO) && ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WConstants.h" +#endif + +typedef void (*WriteCallback) (const byte what); // send a byte to serial port +typedef int (*AvailableCallback) (); // return number of bytes available +typedef int (*ReadCallback) (); // read a byte from serial port + +void sendMsg (WriteCallback fSend, + const byte * data, const byte length); +byte recvMsg (AvailableCallback fAvailable, ReadCallback fRead, + byte * data, const byte length, + unsigned long timeout = 500); + diff --git a/extrusion/lydia-print-head-v1/firmware/tools/MbPoll_v9.4.0_cracked.exe b/extrusion/lydia-print-head-v1/firmware/tools/MbPoll_v9.4.0_cracked.exe new file mode 100644 index 0000000..fc4061a --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/tools/MbPoll_v9.4.0_cracked.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61b5ed4b1aaf646830fdb448e60f018c03e8bbad34468ea7dc0a0b28c398e9c3 +size 2693120 diff --git a/extrusion/lydia-print-head-v1/firmware/tools/MbSlave_v7.3.0_cracked.exe b/extrusion/lydia-print-head-v1/firmware/tools/MbSlave_v7.3.0_cracked.exe new file mode 100644 index 0000000..79d87f0 --- /dev/null +++ b/extrusion/lydia-print-head-v1/firmware/tools/MbSlave_v7.3.0_cracked.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5713b6a68bc4960a9c0f0808867c67fe027edb14cf6b266e377260eb9c3678db +size 2075136 diff --git a/extrusion/lydia-print-head-v1/media/gallery/IMG_20201219_152926.jpg b/extrusion/lydia-print-head-v1/media/gallery/IMG_20201219_152926.jpg new file mode 100644 index 0000000..886de11 --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/IMG_20201219_152926.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28f28e66ba7c92f81b58beb838d815b25436a495d82c536695dff94bb732cd94 +size 1377638 diff --git a/extrusion/lydia-print-head-v1/media/gallery/abb-irb-6600_1.jpg b/extrusion/lydia-print-head-v1/media/gallery/abb-irb-6600_1.jpg new file mode 100644 index 0000000..6802b62 --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/abb-irb-6600_1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b843beb485796dd4e79da55ec9734e57e5191aa4b48dc1dc4aac2c0759631c2 +size 403243 diff --git a/extrusion/lydia-print-head-v1/media/gallery/abbstudio.png b/extrusion/lydia-print-head-v1/media/gallery/abbstudio.png new file mode 100644 index 0000000..3aa1764 --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/abbstudio.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01828bc14de69bea3a8cd7bac5c19f5d00ce2362e9b5e044de68cd4b32f2e544 +size 101536 diff --git a/extrusion/lydia-print-head-v1/media/gallery/perspective.JPG b/extrusion/lydia-print-head-v1/media/gallery/perspective.JPG new file mode 100644 index 0000000..224c8f7 --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/perspective.JPG @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a717ee5034c2a858b3d951f0f136b18433f271b561073241c39a19fc8c7ccedc +size 416588 diff --git a/extrusion/lydia-print-head-v1/media/gallery/preview.jpg b/extrusion/lydia-print-head-v1/media/gallery/preview.jpg new file mode 100644 index 0000000..b8d645b --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/preview.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf7e0543bac93b0bb2242f4a87086e0f1c2c8055de99067b2b31ef3c3f25c99b +size 961183 diff --git a/extrusion/lydia-print-head-v1/media/gallery/preview.jpg.jpg b/extrusion/lydia-print-head-v1/media/gallery/preview.jpg.jpg new file mode 100644 index 0000000..b8d645b --- /dev/null +++ b/extrusion/lydia-print-head-v1/media/gallery/preview.jpg.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf7e0543bac93b0bb2242f4a87086e0f1c2c8055de99067b2b31ef3c3f25c99b +size 961183 diff --git a/extrusion/lydia-print-head-v1/parts.xlsx b/extrusion/lydia-print-head-v1/parts.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..4947ffee8b13ecb207729a4fc6ffe8c729cc9912 GIT binary patch literal 10640 zcmeHt1y>x|)^_7fkl+v`xVr^+cXxMpcM0w;Avgho6WrZ{I|K_Z!Ck*j-nn;XGWYuh z_g1e}r@QMsd!4HDY^lAsyc7f^8UPvq1ONbp0K?-m{a{6N+pfdeR1 z3cQ`YiTx!;T3HqrFInLaNP@ZOmTc815!MPBP~f-li5 z<``V=T9;K_MP?uVJdLzDi8^CxLFuJ?u}Lcd8A;^z4Z~IUlRTli5~ZPHljD7=RJ#*J zBlE1j5%?-YNL(A@%GeroOFP?J85Zm>pCc|yH2dSMs5`v1y*)c9Vj?f)@0;JDo9oeP zW$_0P22L#iLeub3H`A?xXF-HT$2WA9UMq4^&CyCo#^R)p8uzg|HV4^ms>AO zkdfFwwpgmt#^PM5 zp*3RB=`-PKq;WbmY*^G!xFHxk=>eMkG8(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 z5oPw?Uyti-(DY20K@=K${S%2cl+H4N^?DEVtqD8j*z?YQu7e)N0~yY_x0cUr2RSqo zWG|n(K55i%kMxs2>F_gj6Kixbh1Z;N=2e)R)cc$~+Q`HDn;A+apra^k3! zk^A=RamUG_%S#XX3k^dSily6%+eg3FOh_m?;B1XQpK13Cu3ta@aKfFO z7lMDr12yrtv$+0!;Xh9#`ul}Vz!PHs{d}T->-qOFHNQ3O0mt_J>(H8iU;OU_M}A+d z3nUD<_&<&x`L~9DKbrkpgA3XpAJqQ0f`303_geuk?hhCKdP?r!m;U>Sq~Dj`;r|u- ze>|V`Z!Q09oWFHIK%|O8K>SA={rBbnTmt`oIl9!}F8{e8%1Ock=t4j|1irk0PCY6E H{_Fn%T%nqn literal 0 HcmV?d00001 diff --git a/extrusion/lydia-print-head-v1/research/at_200_3cm/at_100_warmstart_OmronE5_150_to_200.xlsx b/extrusion/lydia-print-head-v1/research/at_200_3cm/at_100_warmstart_OmronE5_150_to_200.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c9390de1447b73b7f1c0c8d39b35b4a2522708f9 GIT binary patch literal 15084 zcmeHug@G`Lx+Me(lC^CNryDj2+}2u3?U`mF*M&j zqtAPu^PKbj1@AljxM!H(+H3C>*R|Hoy|=O)DjGh@T@-W_6ckDnqn%U>y;~?KQD`VA zcqr(%b;RxMTukj;^wm5ZOr3RE+-+^1W})4t&p^2i$p7E#f3XLOWBU}_*&a#4r7y*o znPq1xUZ8Vt`*-0oyb^Bx7Sma1tdnMGd6O1=@klK5u@!GQ?$C@E$Nqptg`I7U|A)>7 z6^zh#-L2|+q`a&hU0XCQgv3xM?bo{*_@pn`iS_lv&5}_*I@Y$Ua7iqP$`+GYJSGr+ zyOcWJrGYcwS%*=mozLG5`}$K+V-AO}w_xb<$qEqx2t{LQ%F3ts*Glup9FECh|C2zHhJX>Ffo~0v_47c~X=5 zw8$tEMItI&rk^=oX%b5OybS)ndEGr<_*#{=jmf<2a)<9Nqe-6L;Gf{E*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3FInxx&A~_1F74V zdrtoUXGH#~=buLf{-tRbI6C={g9HB@{Lf9_{~BxrI1Cv4A6vlxso|fSJ^!Vl7&y29 zX!z&W&wncT=T4h{DR3b8y@dbSck|Do|J>v7uc7R~&WAsy|HqDpe`@*n!uc;9C@55% rC@B9?M*lhd-zo6#!xOmwHvA7ED$CsgqKks^0Qh+eRB8=A#9#jpWY_8s literal 0 HcmV?d00001 diff --git a/extrusion/lydia-print-head-v1/research/at_200_3cm/at_e5.md b/extrusion/lydia-print-head-v1/research/at_200_3cm/at_e5.md new file mode 100644 index 0000000..b41e777 --- /dev/null +++ b/extrusion/lydia-print-head-v1/research/at_200_3cm/at_e5.md @@ -0,0 +1,46 @@ +# Auto-Tuning - E5 + +## Setup + +* AT (100%) started at 80Degc +* 2 brass heaters (nozzle zone) | 300W with 3 cm gap, TC in the middle +* With screw, 40 mm barrel, 30mm screw +- no insulation +- no neighbour heating +- Control-Period : 2secs +- SP = 150 - 200 +- Start Heat : 80 DegC + +## Results + +- AT took 2 cycles (section 0) to settle PID params. Overshooting for each cycle was around 15 Degc +- After AT done, there was an average error of 1 DegC (secion 2), peaks at 2 DegC +- Little blows with breath only affect TC readings by up to 3 DegC, medium air circulation (at 20Degc) has affects of up to 5 DegC (non-insulated) + +![](./at_log_e5_hold.jpg) + +![](./at_log_e5_hold_long.jpg) + +After one hour holding 150 DegC, SP has been set to 200 DegC, just to see that the determined AT PID parameters are applied for other temperatures well. Again, mostly 1 DegC error. + +![](./at_log_e5_hold_long_200.jpg) + +Zoomed : + +![](./at_log_e5_hold_long_200_zoom.jpg) + + +See [more in the Excel trace, (output flags)](./at_100_warmstart_OmronE5_150_to_200.xlsx) + +### PID Params + +- Proportional Band : 28.9 +- Integral Time : 298 +- Derivative Time : 51 + +#### Registers (@todo) + +- Derivative Time (Cooling) : 328 +- Dead Band () : 1298 +- Hysteresis (Cooling) : 336 +- Open/Close Hysteresis : 901 diff --git a/extrusion/lydia-print-head-v1/research/at_200_6cm/at_100_warmstart_OmronE5.xlsx b/extrusion/lydia-print-head-v1/research/at_200_6cm/at_100_warmstart_OmronE5.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..55b1c956db08b6928b5f8ab64470cda9ecd42a5b GIT binary patch literal 60248 zcmeEsgBYP%})}74~T9iky%_TBjd zbq_Dpx268R4$U>5PtA+0bre)D>@+o2-jdQtT%pp{4KsO-^2)Zn@gBd_^o=_?)MjMl zVm{yEN17iHPd2^Bd#9Nx*fQEMrTAci_2Tpo`r7S-LJe#W~R%fl_25E*jsm8*_>*^IkGDUnkD>e?eVT3ubpqqZdq;h3uVZh02S(= zB=HrCirD}WsRSgUMmdM-V#RaH6K5McO9LAlOQ?GN;tVP%VPKd4+kbNIDad`~C91(a z4&-%y?L?DXgK|9RHUX|Hoy|@=0t8>tFKjh% zW`>YpxLvSX5yrIX+~`CsL}<&KSpTGIR1?a&#Lj(a)8kcZ2Hu zZ4rD|l-{2MOq{z7(%a|Os}D^ST)QkAQugs?XtU+$-wB9%1UN7Tw%lUyW`AKnlN?)h ze`VU?=0O{K-RL^3eRIX+du#LONs#G(LPqA!H+CfemweFf5P}r|GJk?4N453QD2NZm zPjRAZPEBUvXL^FNRuuSmNpHl>Ff+c*ijaO4dgoqgSn|n4gleg|{q0^I{;|#L8xu5L zJOp=M@aV9py?BFNS)^*h!tjfX!IwZ6KIU($ zm?b1*)TSKXes`yze-Cy0#)kNo^!-yc2?;&c$a%}SaCyga**h2Qy&mEa8Y^a87jWOT zZYb-#&v|jV$vjSqU;8lXYtsu7j=?+Lfy{_im&b83wqx-hleyEdvtt9(dg%oZ8;=SJr!qn>9qgVO2EsYgpG;CK24$*4-_DDG&3){pcXW_cS zFmb6lO9(Ca<$Y!AVfnbTi9G^JDtRHM1_d#9PW)*R&ecz4JDwl%9!I8rsxIDt;!|@V z?RHhZl;}1Zcg#$=mVYpxA%X|6N3EY1!w=$&?2}gm*-LzAg2` z1nD29r@(H%9V6q?+Zh|FIM|s#GPQ@)3K1_C zPI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fFJ%CY?fgoC9PCB-ZtsgDN*URu5OknY0#aDEv{2(O=_GdoflLBIz}I&PEPr<{ rg^BBfp#OT4{?o$cN8r-sVgpN-e>)JZ(Gox>1g!#}aG?6(5d81o5Y%ZC literal 0 HcmV?d00001 diff --git a/extrusion/lydia-print-head-v1/research/at_200_6cm/at_e5.md b/extrusion/lydia-print-head-v1/research/at_200_6cm/at_e5.md new file mode 100644 index 0000000..2cf1a67 --- /dev/null +++ b/extrusion/lydia-print-head-v1/research/at_200_6cm/at_e5.md @@ -0,0 +1,27 @@ +# Auto-Tuning - E5 + +## Setup + +* AT (100%) started at 80Degc +* 2 brass heaters (nozzle zone) | 300W with **6 cm gap**, TC in the middle +* With screw, 40 mm barrel, 30mm screw +- no insulation +- no neighbour heating +- Control-Period : 2 secs +- SP = 202 +- Start Heat : 80 DegC + +## Results + +compared with the 3 cm heatband layout + +- holding error by 2 fold (from 1 DegC to 3 DegC) but yet, no significant overshooting +- relay oscillation by 1.5 - 2x (@todo, check & map status flags into chart) + +![](./at_log_e5.jpg) + +### PID Params + +- Proportional Band : 9.5 +- Integral Time : 356 +- Derivative Time : 61 diff --git a/extrusion/lydia-print-head-v1/specs.xlsx b/extrusion/lydia-print-head-v1/specs.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..66637dc3a959dd71528f212a3cd7164acac5c0c5 GIT binary patch literal 5526 zcmaJ_cRXBe(_Xy-Czbg3i$0ePtSIvbfi8>csGCYc4Fp%ZiAcDsx!1R#&{OE| znW#y+_Ekq~7-!XH0}7Clk3d*JyoG;2BUi#qHe#vW?F{oL9^yBJ>9{zFx@xd6`pMp2 zG-68zK0s+|7X%bbG*Oeo9+Udc!UB=KbK5BtSILCbb*R#TD_f{5qjmAX)0E!N85uMU z$Q6W}^&Vk=6Lpx7ou|LfjX-tntz0^$+m@O!rq51#S7`LKh={|pM6$N9P8h%i0QCN+ zn=WJD@NpLOh9jJ;;czDb9~b911GMXu5M}cLFaE3x|2@a+MR-QFiGUf(Vsv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