├── .gitattributes ├── .github └── workflows │ └── build_g2.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .vscode ├── c_cpp_properties.json ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── Docker ├── Dockerfile └── entrypoint.sh ├── Historical ├── Motate_6_2.cppproj ├── TinyG2_6_2.atsln ├── TinyG2_6_2.cppproj ├── due-raspberrypi.gdb └── jlink.config ├── LICENSE ├── README.md ├── Resources ├── Documentation │ ├── SystemStates.graffle │ └── images │ │ ├── l_t_0_greater_than_zero.png │ │ └── l_t_0_less_than_zero.png ├── Post-Processors │ └── VCarve │ │ ├── G2Core_Arcs_inch.pp │ │ ├── G2Core_Arcs_mm.pp │ │ ├── G2Core_Laser_Arcs_inch.pp │ │ ├── G2Core_Laser_Arcs_mm.pp │ │ ├── G2Core_WrapX2A_inch.pp │ │ ├── G2Core_WrapX2A_mm.pp │ │ ├── G2Core_WrapY2A_inch.pp │ │ ├── G2Core_WrapY2A_mm.pp │ │ ├── G2Core_inch.pp │ │ └── G2Core_mm.pp ├── Slic3r-plugin │ └── TinyG2.py ├── TinyG2-OSX-Programmer │ ├── DueFromOSX.sh │ └── ReadMe.txt ├── TinyGv2.inf ├── debug │ ├── mb.gdb │ ├── mb_analyze.py │ └── mb_analyze_tab.py ├── error.py ├── gcode │ ├── gcode_bigcircle_smallcircle.h │ ├── gcode_boxes_400mm.h │ ├── gcode_braid2d.h │ ├── gcode_braid_short.h │ ├── gcode_braid_short_001.h │ ├── gcode_braid_short_002.h │ ├── gcode_circles2.h │ ├── gcode_contraptor_circle.h │ ├── gcode_debug_tests.h │ ├── gcode_drift_pattern.h │ ├── gcode_hacdc.h │ ├── gcode_hokanson.h │ ├── gcode_infinity_002.h │ ├── gcode_line_X_800mm.h │ ├── gcode_line_Xa_800mm.h │ ├── gcode_mickey_test.h │ ├── gcode_mudflap.h │ ├── gcode_nfinity_001.h │ ├── gcode_reilly_111115.h │ ├── gcode_roadrunner.h │ ├── gcode_square_pocket.h │ ├── gcode_star_1x1.h │ ├── gcode_startup_tests.h │ ├── gcode_straight_600mm.h │ ├── gcode_test001.h │ ├── gcode_test_002.h │ ├── gcode_tests.h │ ├── gcode_xyzcurve.h │ └── gcode_zoetrope.h ├── generate_dins_cfgArray.js ├── generate_motors_cfgArray.js └── generate_motors_default_config.js ├── g2core.atsln └── g2core ├── .gitattributes ├── .gitignore ├── LICENSE-gpl-2.0.txt ├── Makefile ├── alarm.cpp ├── asciitable.txt ├── board ├── Archim.mk ├── Archim │ ├── 0_hardware.cpp │ ├── Archim-pinout.h │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── hardware.h │ └── motate_pin_assignments.h ├── ArduinoDue.gdb ├── ArduinoDue.mk ├── ArduinoDue │ ├── 0_hardware.cpp │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── gShield-pinout.h │ ├── hardware.h │ ├── motate_pin_assignments.h │ └── shopbotShield-pinout.h ├── G2v9.gdb ├── G2v9.mk ├── G2v9 │ ├── 0_hardware.cpp │ ├── G2v9k-pinout.h │ ├── bantam-checksum-flash.ld │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_spi.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── hardware.h │ └── motate_pin_assignments.h ├── g2_default.gdb ├── gquadratic.gdb ├── gquadratic.mk ├── gquadratic │ ├── 0_hardware.cpp │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── gquadratic-b-pinout.h │ ├── gquadratic-c-pinout.h │ ├── hardware.h │ └── motate_pin_assignments.h ├── gquintic.gdb ├── gquintic.mk ├── gquintic │ ├── 0_hardware.cpp │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── gquintic-b-pinout.h │ ├── gquintic-c-pinout.h │ ├── gquintic-d-pinout.h │ ├── hardware.h │ └── motate_pin_assignments.h ├── printrboardg2.gdb ├── printrboardg2.mk ├── printrboardg2 │ ├── 0_hardware.cpp │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── hardware.h │ ├── motate_pin_assignments.h │ └── printrboardG2v3-pinout.h ├── sbv300.gdb ├── sbv300.mk └── sbv300 │ ├── 0_hardware.cpp │ ├── board_gpio.cpp │ ├── board_gpio.h │ ├── board_stepper.cpp │ ├── board_stepper.h │ ├── board_xio.cpp │ ├── board_xio.h │ ├── hardware.h │ ├── motate_pin_assignments.h │ └── sbv300-pinout.h ├── boards.mk ├── canonical_machine.cpp ├── canonical_machine.h ├── config.cpp ├── config.h ├── config_app.cpp ├── config_app.h ├── controller.cpp ├── controller.h ├── coolant.cpp ├── coolant.h ├── cycle_feedhold.cpp ├── cycle_homing.cpp ├── cycle_jogging.cpp ├── cycle_probing.cpp ├── device ├── bantam_safety_manager │ ├── bantam_safety_manager.cpp │ └── bantam_safety_manager.h ├── bme280 │ └── bme280.h ├── esc_spindle │ └── esc_spindle.h ├── honeywell-trustability-ssc │ └── honeywell-trustability-ssc.h ├── i2c_as5601 │ └── i2c_as5601.h ├── i2c_eeprom │ └── i2c_eeprom.h ├── i2c_multiplexer │ └── i2c_multiplexer.h ├── laser_toolhead │ ├── laser_toolhead.cpp │ └── laser_toolhead.h ├── max31865 │ └── max31865.h ├── neopixel │ └── neopixel.h ├── sd_card │ ├── diskio.cpp │ ├── diskio.h │ ├── ff.c │ ├── ff.h │ ├── ffconf.h │ ├── sd_card.h │ ├── sd_persistence.cpp │ ├── sd_persistence.h │ └── syscall.c ├── step_dir_driver │ └── step_dir_driver.h ├── step_dir_hobbyservo │ └── step_dir_hobbyservo.h └── trinamic │ └── tmc2130.h ├── encoder.cpp ├── encoder.h ├── error.h ├── g2core.cppproj ├── g2core.h ├── g2core.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── G2 G2V9k.xcscheme │ ├── G2 V9 Shapeoko Dual-Y.xcscheme │ ├── G2 gQuadratic AxiDrawv3.xcscheme │ ├── G2 gQuadratic SMW3d r7.xcscheme │ ├── G2 gQuadratic Test.xcscheme │ ├── G2 gQuintic PrintrbotPlus.xcscheme │ ├── G2 gShield.xcscheme │ ├── G2 printrboardG2v3 PrintrbotPlus.xcscheme │ ├── G2 sbv300.xcscheme │ ├── G2Core.xcscheme │ └── index.xcscheme ├── g2core_info.h ├── gcode.h ├── gcode_parser.cpp ├── gcode_parser.h ├── gpio.cpp ├── gpio.h ├── help.cpp ├── help.h ├── jlink.config ├── json_parser.cpp ├── json_parser.h ├── kinematics.cpp ├── kinematics.h ├── kinematics_cartesian.h ├── kinematics_four_cable.h ├── kinematics_pressure.h ├── main.cpp ├── marlin_compatibility.cpp ├── marlin_compatibility.h ├── openocd.cfg.example ├── persistence.cpp ├── persistence.h ├── plan_arc.cpp ├── plan_arc.h ├── plan_exec.cpp ├── plan_line.cpp ├── plan_zoid.cpp ├── planner.cpp ├── planner.h ├── pwm.cpp ├── pwm.h ├── report.cpp ├── report.h ├── safety_manager.cpp ├── safety_manager.h ├── settings.h ├── settings ├── settings_Printrbot_Play.h ├── settings_Printrbot_Plus.h ├── settings_Printrbot_Simple_1403.h ├── settings_Printrbot_Simple_1608.h ├── settings_Ultimaker.h ├── settings_Ultimaker_2_Plus.h ├── settings_axidraw_v3.h ├── settings_cheapo_laser.h ├── settings_default.h ├── settings_drosmm_v1.h ├── settings_eggbot.h ├── settings_ender.h ├── settings_ender_laser.h ├── settings_fourcable.h ├── settings_liteplacer.h ├── settings_makeblock.h ├── settings_minimill.h ├── settings_othermill.h ├── settings_othermill_pro.h ├── settings_othermill_test.h ├── settings_probotixV90.h ├── settings_riley_minimill.h ├── settings_shapeoko2.h ├── settings_shapeoko2dualY.h ├── settings_shapeoko375_Dual.h ├── settings_shopbot_sbv300.h ├── settings_shopbot_test.h ├── settings_smw3d_r7.h ├── settings_smw3d_r7_v9k.h ├── settings_synthetos_pendulum_v2.h ├── settings_test.h ├── settings_watercolorbot_v2.h ├── settings_xcarve_extended.h └── settings_zen7x12.h ├── spindle.cpp ├── spindle.h ├── stepper.cpp ├── stepper.h ├── temperature.cpp ├── temperature.h ├── text_parser.cpp ├── text_parser.h ├── util.cpp ├── util.h ├── utils ├── enter_bootloader.sh └── g2flash.py ├── xio.cpp └── xio.h /.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt text 2 | *.md text 3 | -------------------------------------------------------------------------------- /.github/workflows/build_g2.yml: -------------------------------------------------------------------------------- 1 | name: Build G2 2 | 3 | on: 4 | push: 5 | branches: 6 | - edge 7 | - edge-preview 8 | - dev-* 9 | # pull_request: 10 | # branches: 11 | 12 | jobs: 13 | Build: 14 | name: Checkout and Build 15 | runs-on: ubuntu-latest 16 | steps: 17 | 18 | - uses: actions/checkout@v3 19 | with: 20 | submodules: recursive 21 | 22 | - name: Cache Tools 23 | id: cache-tools 24 | uses: actions/cache@v3 25 | with: 26 | path: ./Motate/Tools/linux 27 | key: ${{ runner.os }}-tools-03 # Change the number to invalidate the tools caches 28 | 29 | - name: prepare 30 | working-directory: ${{ github.workspace }}/g2core/ 31 | run: | 32 | mkdir -p ./bin/ARTIFACTS/ 33 | 34 | - name: make CONFIG=Othermill 35 | working-directory: ${{ github.workspace }}/g2core/ 36 | run: | 37 | make CONFIG=Othermill VERBOSE=2 COLOR=0 38 | cp ./bin/Othermill-g2v9k/g2core-summed.bin ./bin/ARTIFACTS/g2core-Othermill-g2v9k-`git describe --abbrev=4 --dirty --always --tags`.bin 39 | 40 | - name: make CONFIG=OthermillPro 41 | working-directory: ${{ github.workspace }}/g2core/ 42 | run: | 43 | make CONFIG=OthermillPro VERBOSE=2 COLOR=0 44 | cp ./bin/OthermillPro-g2v9k/g2core-summed.bin ./bin/ARTIFACTS/g2core-OthermillPro-g2v9k-`git describe --abbrev=4 --dirty --always --tags`.bin 45 | 46 | - name: Archive binaries 47 | uses: actions/upload-artifact@v1 48 | with: 49 | name: binaries 50 | path: ./g2core/bin/ARTIFACTS 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # From https://github.com/github/gitignore/blob/master/Objective-C.gitignore 2 | DerivedData 3 | 4 | ## Various settings 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | 15 | ## Other 16 | *.xccheckout 17 | *.moved-aside 18 | *.xcuserstate 19 | *.xcscmblueprint 20 | 21 | *.o 22 | *.d 23 | *.bin 24 | *.elf 25 | *.hex 26 | *.eep 27 | *.log 28 | *.lss 29 | *.map 30 | *.srec 31 | *.aws 32 | *.atsuo 33 | *.cproj 34 | *.log 35 | .project 36 | .cproject 37 | *.launch 38 | .settings 39 | \bin 40 | \build 41 | build/ 42 | bin/ 43 | .DS_Store 44 | TcfTransactionLog.csv 45 | *.xcbkptlist 46 | *.xccheckout 47 | .gdb_history 48 | JLink.log 49 | Tools/gcc-arm-none-eabi* 50 | openocd.cfg 51 | openocd.log 52 | */mb.txt 53 | Tools/gcc-arm-none-eabi-*.tar.bz2 54 | */TinyG2.componentinfo.xml 55 | g2core/g2core.componentinfo.xml 56 | .tags 57 | 58 | g2core/compile_commands.json 59 | .vscode/.cortex-debug.registers.state.json 60 | .vscode/.cortex-debug.peripherals.state.json 61 | .vscode/ipch 62 | g2core.code-workspace 63 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Motate"] 2 | path = Motate 3 | url = https://github.com/synthetos/Motate.git 4 | fetchRecurseSubmodules = yes 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | before_install: 4 | - sudo apt-get update -q 5 | 6 | install: 7 | - sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 8 | 9 | script: 10 | - cd ${TRAVIS_BUILD_DIR}/g2core 11 | - make VERBOSE=1 COLOR=0 CONFIG=TestV9 12 | - make VERBOSE=1 COLOR=0 CONFIG=Othermill 13 | - make VERBOSE=1 COLOR=0 CONFIG=sbv300 14 | - make VERBOSE=1 COLOR=0 CONFIG=PrintrbotPlus 15 | - make VERBOSE=1 COLOR=0 CONFIG=PrintrbotSimple1403 16 | - make VERBOSE=1 COLOR=0 CONFIG=PrintrbotSimple1608 17 | - make VERBOSE=1 COLOR=0 CONFIG=PrintrbotPlay 18 | 19 | # The tools take a while to download, and are rarely changed, 20 | # so we'll cache them. This is also nicer on launchpad, who hosts the arm tools. 21 | cache: 22 | directories: 23 | Motate/Tools/ 24 | 25 | before_deploy: 26 | - cd ${TRAVIS_BUILD_DIR}/g2core 27 | - mv bin/Othermill-g2v9k/g2core.elf bin/g2core-Othermill-g2v9k-${TRAVIS_TAG}.elf 28 | - mv bin/Othermill-g2v9k/g2core.bin bin/g2core-Othermill-g2v9k-${TRAVIS_TAG}.bin 29 | - mv bin/TestV9-g2v9k/g2core.elf bin/g2core-TestV9-g2v9k-${TRAVIS_TAG}.elf 30 | - mv bin/TestV9-g2v9k/g2core.bin bin/g2core-TestV9-g2v9k-${TRAVIS_TAG}.bin 31 | - mv bin/sbv300-sbv300/g2core.elf bin/g2core-sbv300-sbv300-${TRAVIS_TAG}.elf 32 | - mv bin/sbv300-sbv300/g2core.bin bin/g2core-sbv300-sbv300-${TRAVIS_TAG}.bin 33 | - mv bin/PrintrbotPlus-printrboardG2v3/g2core.elf bin/g2core-PrintrbotPlus-printrboardG2v3-${TRAVIS_TAG}.elf 34 | - mv bin/PrintrbotPlus-printrboardG2v3/g2core.bin bin/g2core-PrintrbotPlus-printrboardG2v3-${TRAVIS_TAG}.bin 35 | - mv bin/PrintrbotSimple1403-printrboardG2v3/g2core.elf bin/g2core-PrintrbotSimple1403-printrboardG2v3-${TRAVIS_TAG}.elf 36 | - mv bin/PrintrbotSimple1403-printrboardG2v3/g2core.bin bin/g2core-PrintrbotSimple1403-printrboardG2v3-${TRAVIS_TAG}.bin 37 | - mv bin/PrintrbotSimple1608-printrboardG2v3/g2core.elf bin/g2core-PrintrbotSimple1608-printrboardG2v3-${TRAVIS_TAG}.elf 38 | - mv bin/PrintrbotSimple1608-printrboardG2v3/g2core.bin bin/g2core-PrintrbotSimple1608-printrboardG2v3-${TRAVIS_TAG}.bin 39 | - mv bin/PrintrbotPlay-printrboardG2v3/g2core.elf bin/g2core-PrintrbotPlay-printrboardG2v3-${TRAVIS_TAG}.elf 40 | - mv bin/PrintrbotPlay-printrboardG2v3/g2core.bin bin/g2core-PrintrbotPlay-printrboardG2v3-${TRAVIS_TAG}.bin 41 | 42 | deploy: 43 | provider: releases 44 | # We'll mark these as prerelease, and we can later unmark them by hand. 45 | # OR, when we move to Master, we remove this setting. 46 | prerelease: true 47 | api_key: 48 | secure: SFQe2M+qWfu4Lm4Q4W6v+JkSv0d8u5/K6MpEBPT6KUvFcIJb0fm7aHzFcZ03Ul8cx9yjmuGbNGId1hNUXCWxM+MeaIWqnx1cvJAEIQpjZV0nQ6yHeO//jX5PRmEBykNmq/GLqILbHkRAFRxBC4TwtBcRFlS/p7kEC9q3tNac5gg= 49 | skip_cleanup: true 50 | file: 51 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-Othermill-g2v9k-${TRAVIS_TAG}.elf 52 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-Othermill-g2v9k-${TRAVIS_TAG}.bin 53 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-TestV9-g2v9k-${TRAVIS_TAG}.elf 54 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-TestV9-g2v9k-${TRAVIS_TAG}.bin 55 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-sbv300-sbv300-${TRAVIS_TAG}.elf 56 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-sbv300-sbv300-${TRAVIS_TAG}.bin 57 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotPlus-printrboardG2v3-${TRAVIS_TAG}.elf 58 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotPlus-printrboardG2v3-${TRAVIS_TAG}.bin 59 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotSimple1403-printrboardG2v3-${TRAVIS_TAG}.elf 60 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotSimple1403-printrboardG2v3-${TRAVIS_TAG}.bin 61 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotSimple1608-printrboardG2v3-${TRAVIS_TAG}.elf 62 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotSimple1608-printrboardG2v3-${TRAVIS_TAG}.bin 63 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotPlay-printrboardG2v3-${TRAVIS_TAG}.elf 64 | - ${TRAVIS_BUILD_DIR}/g2core/bin/g2core-PrintrbotPlay-printrboardG2v3-${TRAVIS_TAG}.bin 65 | on: 66 | repo: synthetos/g2 67 | tags: true 68 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Mac", 5 | "compileCommands": "${workspaceFolder}/g2core/compile_commands.json", 6 | "compilerPath": "${workspaceFolder}/Motate/Tools/osx/gcc-arm-none-eabi-12.2r1/bin/arm-none-eabi-gcc", 7 | "cStandard": "c11", 8 | "cppStandard": "c++17", 9 | "intelliSenseMode": "gcc-x64", 10 | "browse": { 11 | "path": ["${workspaceFolder}"] 12 | }, 13 | "configurationProvider": "ms-vscode.makefile-tools" 14 | } 15 | ], 16 | "version": 4 17 | } 18 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-vscode.cpptools", 4 | "marus25.cortex-debug" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "*.h": "cpp", 4 | "*.cpp": "cpp", 5 | "__config": "cpp", 6 | "__nullptr": "cpp", 7 | "cstddef": "cpp", 8 | "exception": "cpp", 9 | "initializer_list": "cpp", 10 | "new": "cpp", 11 | "stdexcept": "cpp", 12 | "type_traits": "cpp", 13 | "typeinfo": "cpp", 14 | "*.tcc": "cpp", 15 | "cstdint": "cpp", 16 | "random": "cpp", 17 | "__debug": "cpp", 18 | "__functional_03": "cpp", 19 | "__functional_base": "cpp", 20 | "__functional_base_03": "cpp", 21 | "__string": "cpp", 22 | "__tuple": "cpp", 23 | "algorithm": "cpp", 24 | "atomic": "cpp", 25 | "functional": "cpp", 26 | "iosfwd": "cpp", 27 | "iterator": "cpp", 28 | "limits": "cpp", 29 | "memory": "cpp", 30 | "string": "cpp", 31 | "string_view": "cpp", 32 | "tuple": "cpp", 33 | "utility": "cpp", 34 | "cmath": "cpp", 35 | "chrono": "cpp", 36 | "__bit_reference": "cpp", 37 | "__node_handle": "cpp", 38 | "bitset": "cpp", 39 | "deque": "cpp", 40 | "__memory": "cpp", 41 | "filesystem": "cpp", 42 | "optional": "cpp", 43 | "ratio": "cpp", 44 | "system_error": "cpp", 45 | "vector": "cpp", 46 | "array": "cpp", 47 | "istream": "cpp", 48 | "ostream": "cpp", 49 | "startup_sams70.c": "cpp", 50 | "valarray": "cpp", 51 | "locale": "cpp", 52 | "regex": "cpp", 53 | "scoped_allocator": "cpp", 54 | "cortex_handlers.c": "cpp", 55 | "*.def": "cpp", 56 | "__locale": "cpp", 57 | "rope": "cpp" 58 | }, 59 | "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 120 }", 60 | "C_Cpp.default.cppStandard": "c++17", 61 | // Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty. 62 | "editor.rulers": [ 63 | 120 64 | ], 65 | "C_Cpp.workspaceSymbols": "All" 66 | } 67 | -------------------------------------------------------------------------------- /Docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use a Debian-based image as a parent image 2 | FROM debian:buster-slim 3 | 4 | # Install build-essential, git, and uucp 5 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git wget xz-utils uucp bossa-cli 6 | 7 | # Set the working directory to /app 8 | WORKDIR /app 9 | 10 | # Clone the g2 GitHub repo 11 | RUN git clone https://github.com/synthetos/g2.git && \ 12 | cd g2 && \ 13 | git submodule init && \ 14 | git submodule update 15 | 16 | RUN mkdir -p /app/g2/Motate/Tools/linux && \ 17 | wget -P /app/g2/Motate/Tools/linux https://github.com/synthetos/gcc-arm-none-eabi-archive/releases/download/12.2.Rel1/arm-gnu-toolchain-12.2.rel1-linux-x86_64-arm-none-eabi.tar.xz 18 | 19 | 20 | 21 | #Extract the toolchain archive to the directory 22 | 23 | RUN cd /app/g2/Motate/Tools/linux && \ 24 | tar xf arm-gnu-toolchain-12.2.rel1-linux-x86_64-arm-none-eabi.tar.xz && \ 25 | rm -f "arm-gnu-toolchain-12.2.rel1-linux-x86_64-arm-none-eabi.tar.xz" 26 | 27 | RUN apt-get install dos2unix 28 | 29 | # Set the TERM environment variable 30 | ENV TERM=xterm 31 | 32 | # Set the working directory to the cloned repo directory 33 | WORKDIR /app/g2/g2core 34 | 35 | # Create a volume for storing build output 36 | VOLUME /app/g2/g2core/bin 37 | 38 | COPY entrypoint.sh /app/entrypoint.sh 39 | RUN dos2unix /app/entrypoint.sh 40 | ENTRYPOINT ["/app/entrypoint.sh"] 41 | 42 | 43 | # Define the default command to run the build 44 | #CMD ["BOARD=gShield", "SETTINGS=default_settings.h"] -------------------------------------------------------------------------------- /Docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | 6 | if [ "$1" == "--build" ]; then 7 | BOARD="$2" 8 | SETTINGS="$3" 9 | if [ -z "$2" ] || [ -z "$3" ]; then 10 | echo "Usage: $0 --build BOARD SETTING" 11 | exit 1 12 | fi 13 | 14 | if [ ! -f "/app/g2/g2core/settings/$SETTINGS" ]; then 15 | echo "Error: Settings file not found: /g2/g2core/settings/$SETTINGS" 16 | exit 1 17 | fi 18 | 19 | 20 | 21 | 22 | echo "Building g2core for board $BOARD with setting $SETTINGS" 23 | echo "Build started in 5 seconds..." 24 | sleep 5 25 | cd /app/g2/g2core 26 | make BOARD="$BOARD" SETTINGS_FILE="$SETTINGS" 27 | fi 28 | 29 | -------------------------------------------------------------------------------- /Historical/due-raspberrypi.gdb: -------------------------------------------------------------------------------- 1 | # For Sam, RaspberryPi, etc. 2 | set remote hardware-breakpoint-limit 6 3 | set remote hardware-watchpoint-limit 4 4 | 5 | #target extended-remote raspberrypi:3333 6 | target extended-remote | ssh pi@raspberrypi -C 'sudo openocd -c "gdb_port pipe; log_output openocd.log" -s /usr/share/openocd/ -f board/raspberrypi-due.tcl' 7 | -------------------------------------------------------------------------------- /Historical/jlink.config: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="UNSPECIFIED" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /Resources/Documentation/SystemStates.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synthetos/g2/1fb59404dcbf6e827f54b2c3146d8d1cab561c90/Resources/Documentation/SystemStates.graffle -------------------------------------------------------------------------------- /Resources/Documentation/images/l_t_0_greater_than_zero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synthetos/g2/1fb59404dcbf6e827f54b2c3146d8d1cab561c90/Resources/Documentation/images/l_t_0_greater_than_zero.png -------------------------------------------------------------------------------- /Resources/Documentation/images/l_t_0_less_than_zero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/synthetos/g2/1fb59404dcbf6e827f54b2c3146d8d1cab561c90/Resources/Documentation/images/l_t_0_less_than_zero.png -------------------------------------------------------------------------------- /Resources/Slic3r-plugin/TinyG2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import re 3 | import sys 4 | import argparse 5 | 6 | def parse_args(): 7 | parser = argparse.ArgumentParser() 8 | parser.add_argument('--eto', nargs=1, default='A') 9 | parser.add_argument('filenames', nargs='+') 10 | args = parser.parse_args() 11 | return args 12 | 13 | def process(filename, eto): 14 | with open(filename, "r") as f: 15 | lines = f.readlines() 16 | 17 | with open(filename, "w") as f: 18 | for line in lines: 19 | line_split = list(line.partition(";")) 20 | 21 | # Fix E to A or B 22 | line_split[0] = re.sub(r"^([^;\(\)]+)[Ee]([-.0-9]+)", "\\1"+eto+"\\2", line_split[0]) 23 | 24 | # Fix assinine G0 F... 25 | line_split[0] = re.sub(r"^[Gg]0 *(.*?)([Ff][-.0-9]+ *)(.*)$", "G0 \\1\\3", line_split[0]) 26 | 27 | # Retraction should be using G0, not G1 with a feedrate 28 | match = re.search(r"^[Gg]1 *((?:[FfAaBb][-.0-9]+ *?)+)( *;.*)?$", line_split[0]) 29 | if (match != None): 30 | tail = match.group(2) 31 | if (tail == None): 32 | tail = "" 33 | new_line = ["G0"] 34 | for option in re.findall(r"([FfAaBb])([-.0-9]+) *", match.group(1)): 35 | if option[0] in ['a', 'A', 'b', 'B']: 36 | new_line.append("".join(option)) 37 | line_split[0] = " ".join(new_line) + tail + "\n" 38 | 39 | # G92 -> G28.3 40 | line_split[0] = re.sub(r"^[Gg]92([^0-9.].*)$", "G28.3\\1", line_split[0]) 41 | 42 | # Disable fan controls 43 | line_split[0] = re.sub(r"([Mm]107)\b", ";\\1", line_split[0]) 44 | 45 | # Disable temperature controls 46 | line_split[0] = re.sub(r"([Mm]10[469])\b", ";\\1", line_split[0]) 47 | 48 | # Remove errant T[01]s 49 | line_split[0] = re.sub(r"^([Tt][01])\b", ";\\1", line_split[0]) 50 | 51 | line = "".join(line_split) 52 | f.write(line) 53 | 54 | 55 | def main(argv): 56 | args = parse_args() 57 | 58 | for filename in args.filenames: 59 | process(filename, args.eto) 60 | 61 | if __name__ == '__main__': 62 | sys.exit(main(sys.argv)) -------------------------------------------------------------------------------- /Resources/TinyG2-OSX-Programmer/DueFromOSX.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | arduinoAppDir=/Applications 3 | PATH=$PATH:$arduinoAppDir/Arduino.app/Contents/Resources/Java/hardware/tools/g++_arm_none_eabi/bin/:$arduinoAppDir/Arduino.app/Contents/Resources/Java/hardware/tools/ 4 | 5 | function show_usage() { 6 | cat < 8 | 9 | Replacing with the device name of the Arduino Due native port 10 | or TinyG v9 port, respectively. 11 | 12 | One of the following may be a valid choice: 13 | 14 | END 15 | 16 | ls -1 /dev/tty.usbmodem* | xargs echo " " 17 | 18 | cat </dev/null` 62 | if [[ ${bossac_binary}x == "x" ]]; then 63 | # Wasn't found, so lets check in the Arduino IDE <1.6 location 64 | bossac_binary=`find /Applications/Arduino.app/Contents/Resources/Java/hardware/tools -type f -name bossac 2>/dev/null` 65 | if [[ ${bossac_binary}x == "x" ]]; then 66 | echo "Error: bossac could not be found. Is the Arduino IDE installed, along with the Arduino SAM Boards extension?" 67 | exit 1; 68 | fi 69 | fi 70 | 71 | # Check for objcopy in the Arduino IDE 1.6+ locations 72 | objcopy_binary=`find $HOME/Library/Arduino15/packages -type f -name arm-none-eabi-objcopy 2>/dev/null` 73 | if [[ ${objcopy_binary}x == "x" ]]; then 74 | # Wasn't found, so lets check in the Arduino IDE <1.6 location 75 | objcopy_binary=`find /Applications/Arduino.app/Contents/Resources/Java/hardware/tools -type f -name arm-none-eabi-objcopy 2>/dev/null` 76 | if [[ ${objcopy_binary}x == "x" ]]; then 77 | echo "Error: arm-none-eabi-objcopy could not be found. Is the Arduino IDE installed, along with the Arduino SAM Boards extension??" 78 | exit 1; 79 | fi 80 | fi 81 | 82 | $objcopy_binary -O binary "${file}" "${file/.elf/.converted}" 83 | 84 | echo "Forcing reset using 1200bps open/close on port ${port}" 85 | # perl -e 'open(my $fh, ">", "${port}"); close($fh);' 86 | stty -f "${port}" 1200 87 | echo "wait..." 88 | # echo "" > "${port}" 89 | # perl -e 'open(my $fh, ">", "${port}"); close($fh);' 90 | 91 | sleep 0.5 92 | 93 | # stty -f "${port}" 115200 94 | 95 | echo "Starting programming of file ${file} -> ${file/.elf/.converted} on port ${port/\/dev\//}" 96 | $bossac_binary -e -w -v -b "${file/.elf/.converted}" 97 | 98 | echo 99 | echo "WARNING: You may need to hit the RESET button on the device at this point." 100 | 101 | ##----------- PROGRAMMING port 102 | #Forcing reset using 1200bps open/close on port /dev/tty.usbmodem26231 103 | #bossac --port=tty.usbmodem26231 -U false -e -w -v -b $tmp/BareMinimum.cpp.bin -R 104 | -------------------------------------------------------------------------------- /Resources/TinyG2-OSX-Programmer/ReadMe.txt: -------------------------------------------------------------------------------- 1 | PROGRAMMING THE DUE FROM OS X 2 | ============================= 3 | 4 | These notes are also available here and may be more up-to-date: 5 | https://github.com/synthetos/g2/wiki/Flashing-g2core-with-OSX 6 | 7 | Download the Arduino 1.5.2 BETA (not the 1.0.5 release at the top of the page) from http://arduino.cc/en/Main/Software for OS X. 8 | 9 | Expand the downloaded zip file and move Arduino.app to /Applications on your hard drive. (Often, this is found on the sidebar of Finder windows.) 10 | 11 | * Open Terminal.app. 12 | * Type "cd " (That's lowercase "c", then "d", then space), DON'T hit return. 13 | * Now drag the *folder* that you found this ReadMe.txt file in to the Terminal.app window that has the "cd " you just typed. It should type in a path for you. 14 | * Now hit return. 15 | 16 | Either place the .elf file you want to program into that directory or remove the trailing version number from the elf file that is present; e.g. 17 | mv TinyG2.elf.13.01 TinyG2.elf 18 | 19 | Plug a USB cable from the computer to the Programming port of the Due (the one closest to the power jack). Make sure there are no shields, programmers or other devices plugged into the Due. The Due does not need external power for programming - it will be powered by the USB programming cable. 20 | 21 | Copy and paste the following line into the Terminal window: 22 | ./DueFromOSX.sh -f TinyG2.elf -p /dev/cu.usbmodem* 23 | 24 | The output should look something like this (the numbers after cu.usbmodem will be different): 25 | 26 | Forcing reset using 1200bps open/close on port /dev/cu.usbmodem241311 27 | wait... 28 | Starting programming of file TinyG2.elf -> TinyG2.bin on port cu.usbmodem241311 29 | Erase flash 30 | Write 119380 bytes to flash 31 | [==============================] 100% (467/467 pages) 32 | Verify 119380 bytes of flash 33 | [==============================] 100% (467/467 pages) 34 | Verify successful 35 | Set boot flash true 36 | CPU reset. 37 | 38 | Now disconnect the Due and plug the USB cable into the other port. You now have a Due/TinyG2. 39 | 40 | -Synthetos Team 41 | -------------------------------------------------------------------------------- /Resources/TinyGv2.inf: -------------------------------------------------------------------------------- 1 | [Strings] 2 | DriverPackageDisplayName="TinyG USB Driver" 3 | ManufacturerName="Synthetos (www.synthetos.com)" 4 | ServiceName="USB RS-232 Emulation Driver" 5 | due.bossa.name="Bossa Program Port" 6 | due.programming_port.name="Arduino Due Programming Port" 7 | due.sketch01.name="TinyG v2 (Control Channel)" 8 | due.sketch02.name="TinyG v2 (Data Channel)" 9 | due.original.name="Arduino (broken TinyGv2)" 10 | 11 | [DefaultInstall] 12 | CopyINF=arduino.inf 13 | 14 | [Version] 15 | Class=Ports 16 | ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} 17 | Signature="$Windows NT$" 18 | Provider=%ManufacturerName% 19 | DriverPackageDisplayName=%DriverPackageDisplayName% 20 | CatalogFile=arduino.cat 21 | DriverVer=08/27/2014,1.0.1.0 22 | 23 | [Manufacturer] 24 | %ManufacturerName%=DeviceList, NTamd64, NTia64 25 | 26 | [DestinationDirs] 27 | FakeModemCopyFileSection=12 28 | DefaultDestDir=12 29 | 30 | [DeviceList] 31 | %due.bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 32 | %due.programming_port.name%=DriverInstall, USB\VID_2341&PID_003D 33 | %due.sketch01.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_00 34 | %due.sketch02.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_02 35 | %due.original.name%=DriverInstall, USB\VID_2341&PID_003E&MI_00 36 | 37 | [DeviceList.NTamd64] 38 | %due.bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 39 | %due.programming_port.name%=DriverInstall, USB\VID_2341&PID_003D 40 | %due.sketch01.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_00 41 | %due.sketch02.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_02 42 | %due.original.name%=DriverInstall, USB\VID_2341&PID_003E&MI_00 43 | 44 | [DeviceList.NTia64] 45 | %due.bossa.name%=DriverInstall, USB\VID_03EB&PID_6124 46 | %due.programming_port.name%=DriverInstall, USB\VID_2341&PID_003D 47 | %due.sketch01.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_00 48 | %due.sketch02.name%=DriverInstall, USB\VID_1D50&PID_606D&MI_02 49 | %due.original.name%=DriverInstall, USB\VID_2341&PID_003E&MI_00 50 | 51 | [DriverInstall] 52 | include=mdmcpq.inf,usb.inf 53 | CopyFiles = FakeModemCopyFileSection 54 | AddReg=DriverAddReg 55 | 56 | [DriverAddReg] 57 | HKR,,DevLoader,,*ntkern 58 | HKR,,NTMPDriver,,usbser.sys 59 | HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 60 | 61 | [DriverInstall.Services] 62 | include=mdmcpq.inf 63 | AddService=usbser, 0x00000002, DriverService 64 | 65 | [DriverService] 66 | DisplayName=%ServiceName% 67 | ServiceType=1 68 | StartType=3 69 | ErrorControl=1 70 | ServiceBinary=%12%\usbser.sys 71 | LoadOrderGroup=Base 72 | -------------------------------------------------------------------------------- /Resources/error.py: -------------------------------------------------------------------------------- 1 | import re 2 | import json 3 | 4 | codes = {} 5 | with open('../TinyG2/error.h') as fp: 6 | for line in fp.readlines(): 7 | match = re.match(r'\s*#define\s*(\w+)\s*([0-9]+)\s*(?://([\w\s\'0-9]*))?', line) 8 | if match: 9 | name, value, description = match.groups() 10 | description = description.strip() if description else '' 11 | codes[value] = (name, description) 12 | else: 13 | match = re.match(r'\s*static const char stat_\([0-9]+\)\[\] PROGMEM = \"(\\"|[^"])+\"', line) 14 | if match: 15 | value, description = match.groups() 16 | description = description.strip() if description else '' 17 | codes[value][1] = description 18 | 19 | with open('g2_errors.json', 'w') as fp: 20 | json.dump(codes, fp, indent=3) 21 | 22 | print 'Error codes written to g2_errors.json.' 23 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_bigcircle_smallcircle.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | /N1 G21 G90 G64 G40\n\ 5 | /N2 G0 Z3.0\n\ 6 | /N3 T0 M6\n\ 7 | N4 G17\n\ 8 | /N5 M3 S1000\n\ 9 | /N6 G0 X19.0 Y12.0\n\ 10 | N6 G92 X19.0 Y12.0\n\ 11 | /N7 G1 F300.0 Z-0.4\n\ 12 | N8 G3 F800.0 X16.0 Y13.7321 I-2.0 J0.0\n\ 13 | /N8 G3 F800.0 X16.0 Y13.7321 I-2.0 J0.0\n\ 14 | N9 G3 Y10.2679 I1.0 J-1.7321\n\ 15 | N10 G3 X19.0 Y12.0 I1.0 J1.7321\n\ 16 | N11 G0 Z3.0\n\ 17 | N12 G0 X15.0\n\ 18 | N13 G1 F300.0 Z-0.4\n\ 19 | N14 G3 F800.0 X7.5 Y16.3301 I-5.0 J0.0\n\ 20 | N15 G3 Y7.6699 I2.5 J-4.3301\n\ 21 | N16 G3 X15.0 Y12.0 I2.5 J4.3301\n\ 22 | N17 G0 Z3.0\n\ 23 | N18 M30"; 24 | 25 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_boxes_400mm.h: -------------------------------------------------------------------------------- 1 | /* gcode_boxes_400mm.h - data file containing gcode 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | T1M6\n\ 5 | G17\n\ 6 | G21 (mm)\n\ 7 | G92X0Y0Z-1.000\n\ 8 | G0Z4.000\n\ 9 | F400.0\n\ 10 | G1Z-1.000\n\ 11 | G1Y0.876\n\ 12 | X0.011\n\ 13 | Y12.327\n\ 14 | X-5.560\n\ 15 | G0Z4.000\n\ 16 | G0Y0.876\n\ 17 | G1Z-1.000\n\ 18 | G1Y-10.575\n\ 19 | X0.011\n\ 20 | Y0.876\n\ 21 | X-4.560\n\ 22 | G0Z4.000\n\ 23 | G0X0.011Y12.327\n\ 24 | G1Z-1.000\n\ 25 | G1X3.084Y15.011\n\ 26 | G0Z4.000\n\ 27 | G0X0.011Y0.876\n\ 28 | G1Z-1.000\n\ 29 | G1X3.084Y6.213\n\ 30 | Y15.011\n\ 31 | X1.286\n\ 32 | X-5.560Y12.327\n\ 33 | G0Z4.000\n\ 34 | G0X0.011Y-10.575\n\ 35 | G1Z-1.000\n\ 36 | G1X3.084Y-2.585\n\ 37 | Y6.213\n\ 38 | X0.011Y0.876\n\ 39 | G0Z4.000\n\ 40 | G0X0.000Y0.000\n\ 41 | M30"; 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_circles2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_circles2.h - data file containing gcode 3 | */ 4 | 5 | // circles test #2 6 | const char PROGMEM gcode_file[] = "\ 7 | G20 (inches mode)\n\ 8 | G40 G17\n\ 9 | T1 M06\n\ 10 | M3\n\ 11 | S1000\n\ 12 | G90 G0 X0 Y0 Z0\n\ 13 | G92 G0 X0 Y0 Z0\n\ 14 | F25 (F40)\n\ 15 | G00 X0.000 Y0.000 Z0.800\n\ 16 | G00 X0.000 Y0.000 Z0.100\n\ 17 | G01 X0.000 Y0.000 Z-0.15\n\ 18 | X3.000 Y0.000\n\ 19 | X3.000 Y3.000\n\ 20 | X0.000 Y3.000\n\ 21 | X0.000 Y0.000\n\ 22 | X0.000 Y0.000 Z0.400\n\ 23 | X2.875 Y1.500\n\ 24 | X2.875 Y1.500 Z0.100\n\ 25 | G01 X2.875 Y1.500 Z-0.15\n\ 26 | G03 X2.875 Y1.500 I-1.375 J0.000\n\ 27 | G00 X2.875 Y1.500 Z0.400\n\ 28 | G00 X2.000 Y1.500\n\ 29 | G00 X2.000 Y1.500 Z0.100\n\ 30 | G01 X2.000 Y1.500 Z-0.15\n\ 31 | G03 X2.000 Y1.500 I-0.500 J0.000\n\ 32 | G00 X2.000 Y1.500 Z1.600\n\ 33 | m5\n\ 34 | M30"; 35 | 36 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_contraptor_circle.h: -------------------------------------------------------------------------------- 1 | /* 2 | gcode_contraptor_circles.h - data file containing gcode 3 | */ 4 | 5 | // contraptor circle test 6 | const char PROGMEM contraptor_circle[] = "\ 7 | G21\n\ 8 | G90 \n\ 9 | F400\n\ 10 | G92 X0 Y0 Z0 (set zero)\n\ 11 | G0 Z1.5\n\ 12 | T0 M6\n\ 13 | G17\n\ 14 | M3 S0\n\ 15 | G1 X17.6075 Y35.6797 \n\ 16 | G1 F100.0 Z-0.5 \n\ 17 | G1 F200.0 X21.4068 Y35.2654 \n\ 18 | G2 X20.1819 Y32.7363 I-9.0526 J2.8233 \n\ 19 | G2 X18.0773 Y30.7072 I-6.54 J4.6773 \n\ 20 | G2 X15.1243 Y29.4444 I-4.7414 J7.0037 \n\ 21 | G2 X11.8677 Y29.0857 I-2.9605 J11.9147 \n\ 22 | G2 X7.7803 Y29.6697 I-0.3853 J11.899 \n\ 23 | G2 X4.31 Y31.6621 I2.4791 J8.3368 \n\ 24 | G2 X2.1243 Y35.0552 I6.0574 J6.3024 \n\ 25 | G2 X1.532 Y38.9227 I12.7433 J3.9306 \n\ 26 | G2 X2.1286 Y42.9079 I14.0281 J-0.063 \n\ 27 | G2 X4.3508 Y46.4175 I8.5166 J-2.9342 \n\ 28 | G2 X7.6794 Y48.45 I6.1647 J-6.3539 \n\ 29 | G2 X11.6635 Y49.084 I3.6279 J-9.9636 \n\ 30 | G2 X15.5393 Y48.4587 I0.3433 J-10.1968 \n\ 31 | G2 X18.7718 Y46.4716 I-2.8213 J-8.2124 \n\ 32 | G2 X20.9465 Y43.0285 I-6.1748 J-6.3083 \n\ 33 | G2 X21.5294 Y39.1209 I-13.2192 J-3.9692 \n\ 34 | G2 X21.509 Y38.2561 I-32.37 J0.3319 \n\ 35 | G1 X5.3313 \n\ 36 | G3 X5.8549 Y35.6831 I9.9322 J0.6816 \n\ 37 | G3 X7.3535 Y33.4277 I5.7532 J2.1971 \n\ 38 | G3 X11.8881 Y31.7522 I4.14 J4.2305 \n\ 39 | G3 X15.3402 Y32.689 I0.3404 J5.5742 \n\ 40 | G3 X16.7206 Y34.0389 I-2.9329 J4.3799 \n\ 41 | G3 X17.6075 Y35.6797 I-7.0816 J4.888 \n\ 42 | G1 Z1.5"; 43 | 44 | /* Original source: 45 | ( Made using CamBam - http://www.cambam.co.uk ) 46 | ( e-circles 4/10/2010 1:23:46 AM ) 47 | ( T0 : 0.0 ) 48 | G21 49 | G90 50 | G64 51 | G40 52 | G92 X0 Y0 Z0 (set zero) 53 | G0 Z1.5 54 | ( T0 : 0.0 ) 55 | T0 M6 56 | ( Engrave1 ) 57 | G17 58 | M3 S0 59 | G0 X17.6075 Y35.6797 60 | G1 F100.0 Z-0.5 61 | G1 F320.0 X21.4068 Y35.2654 62 | G2 X20.1819 Y32.7363 I-9.0526 J2.8233 63 | G2 X18.0773 Y30.7072 I-6.54 J4.6773 64 | G2 X15.1243 Y29.4444 I-4.7414 J7.0037 65 | G2 X11.8677 Y29.0857 I-2.9605 J11.9147 66 | G2 X7.7803 Y29.6697 I-0.3853 J11.899 67 | G2 X4.31 Y31.6621 I2.4791 J8.3368 68 | G2 X2.1243 Y35.0552 I6.0574 J6.3024 69 | G2 X1.532 Y38.9227 I12.7433 J3.9306 70 | G2 X2.1286 Y42.9079 I14.0281 J-0.063 71 | G2 X4.3508 Y46.4175 I8.5166 J-2.9342 72 | G2 X7.6794 Y48.45 I6.1647 J-6.3539 73 | G2 X11.6635 Y49.084 I3.6279 J-9.9636 74 | G2 X15.5393 Y48.4587 I0.3433 J-10.1968 75 | G2 X18.7718 Y46.4716 I-2.8213 J-8.2124 76 | G2 X20.9465 Y43.0285 I-6.1748 J-6.3083 77 | G2 X21.5294 Y39.1209 I-13.2192 J-3.9692 78 | G2 X21.509 Y38.2561 I-32.37 J0.3319 79 | G1 X5.3313 80 | G3 X5.8549 Y35.6831 I9.9322 J0.6816 81 | G3 X7.3535 Y33.4277 I5.7532 J2.1971 82 | G3 X11.8881 Y31.7522 I4.14 J4.2305 83 | G3 X15.3402 Y32.689 I0.3404 J5.5742 84 | G3 X16.7206 Y34.0389 I-2.9329 J4.3799 85 | G3 X17.6075 Y35.6797 I-7.0816 J4.888 86 | G0 Z1.5 87 | */ 88 | 89 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_debug_tests.h: -------------------------------------------------------------------------------- 1 | /* gcode_debug.h - data file containing gcode */ 2 | 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 T1M6\n\ 5 | N2 G17G21\n\ 6 | N3 G92X-11.000Y-3.000Z0.000\n\ 7 | N4 F600.0\n\ 8 | N500 G1X-11.000Y-3.000\n\ 9 | N545 X-11.440Y-3.415\n\ 10 | N546 X-11.491Y-3.472 (***HT!***)\n\ 11 | N547 X-11.556Y-3.532 (***HT!***)\n\ 12 | N548 X-11.636Y-3.594 (***HT!***)\n\ 13 | N549 X-11.729Y-3.658\n\ 14 | N550 X-11.837Y-3.724 (***HT!***)\n\ 15 | N551 X-11.959Y-3.793\n\ 16 | N552 X-12.094Y-3.863 (***HT!***)\n\ 17 | N553 X-12.242Y-3.936\n\ 18 | N554 X-12.404Y-4.010\n\ 19 | N555 X-12.767Y-4.165\n\ 20 | N556 X-12.967Y-4.245\n\ 21 | N557 X-13.179Y-4.327\n\ 22 | N558 X-13.639Y-4.495\n\ 23 | N559 X-14.691Y-4.850\n\ 24 | N560 X-14.979Y-4.942\n\ 25 | N561 X-15.277Y-5.036\n\ 26 | N562 X-15.897Y-5.225\n\ 27 | N563 X-17.230Y-5.617\n\ 28 | N564 X-20.146Y-6.431\n\ 29 | N565 X-20.516Y-6.532\n\ 30 | N566 X-20.887Y-6.634\n\ 31 | N567 X-21.630Y-6.837\n\ 32 | N568 X-23.106Y-7.241 (***Steppers!***)\n\ 33 | N569 X-25.895Y-8.028\n\ 34 | N570 X-26.218Y-8.123\n\ 35 | N571 X-26.535Y-8.218"; 36 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_drift_pattern.h: -------------------------------------------------------------------------------- 1 | /* Pattern for diagnosing axis drift issue 2 | * 3 | * Set $1pw0 to diagnose X axis drift (assumes motor 1 is mapped to X asis) 4 | */ 5 | const char PROGMEM gcode_file[] = "\ 6 | $1pw0\n\ 7 | N1 G21 G90 G40\n\ 8 | N2 G1 F400 X10\n\ 9 | N3 G1 Y10\n\ 10 | N4 G1 X0\n\ 11 | N5 G1 Y0\n\ 12 | N6 M5\n\ 13 | N7 M30"; 14 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_hokanson.h: -------------------------------------------------------------------------------- 1 | /* 2 | * data_gcode_hokanson.h 3 | */ 4 | 5 | /* 6 | const char PROGMEM hokanson_02[] = "\ 7 | G1 F500 X10 Y10\n\ 8 | G1 F500 X-10 Y-11\n\ 9 | G1 F500 X11 Y13\n\ 10 | G1 F500 X-12 Y-15\n"; 11 | */ 12 | /* 13 | G1 F500 X345 Y-150\n\ 14 | G1 F500 X276 Y-120\n"; 15 | */ 16 | 17 | 18 | const char PROGMEM hokanson_02[] = "\ 19 | G1 F500 X345 Y-150\n\ 20 | G4 P5\n\ 21 | G1 F500 X276 Y-120\n\ 22 | G4 P5\n\ 23 | G1 F500 X207 Y-90\n\ 24 | G4 P5\n\ 25 | G1 F500 X138 Y-60\n\ 26 | G4 P5\n\ 27 | G1 F500 X69 Y-30\n\ 28 | G4 P5\n\ 29 | G1 F500 X0 Y0\n\ 30 | G4 P5\n\ 31 | G1 F500 X-69 Y30\n\ 32 | G4 P5\n\ 33 | G1 F500 X-138 Y60\n\ 34 | G4 P5\n\ 35 | G1 F500 X-207 Y90\n\ 36 | G4 P5\n\ 37 | G1 F500 X-276 Y120\n\ 38 | G4 P5\n\ 39 | G1 F500 X-345 Y150\n\ 40 | G4 P5\n\ 41 | G1 F500 X-276 Y120\n\ 42 | G4 P5\n\ 43 | G1 F500 X-207 Y90\n\ 44 | G4 P5\n\ 45 | G1 F500 X-138 Y60\n\ 46 | G4 P5\n\ 47 | G1 F500 X-69 Y30\n\ 48 | G4 P5\n\ 49 | G1 F500 X0 Y0\n\ 50 | G4 P5\n\ 51 | G1 F500 X69 Y30\n\ 52 | G4 P5\n\ 53 | G1 F500 X138 Y60\n\ 54 | G4 P5\n\ 55 | G1 F500 X207 Y90\n\ 56 | G4 P5\n\ 57 | G1 F500 X276 Y120\n\ 58 | G4 P5\n\ 59 | G1 F500 X345 Y150\n\ 60 | G4 P5\n"; 61 | 62 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_infinity_002.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G20 G90 G64 G40 G17\n\ 5 | N2 G0 X0.14 Y0.32\n\ 6 | /N2 G92 X0.14 Y0.32\n\ 7 | N3 F30\n\ 8 | N4 G3 X0.1463 Y0.3214 Z-0.0021 I-0.0625 J-0.0539\n\ 9 | N5 G1 X0.1463 Y0.3214\n\ 10 | N6 G3 Y0.1786 Z-0.0054 I0.0413 J-0.0714\n\ 11 | N7 M5\n\ 12 | N8 M30"; 13 | 14 | /* 15 | N1 G20 G90 G64 G40\n\ 16 | N2 G0 Z0.125\n\ 17 | N3 T1 M6\n\ 18 | N4 G17\n\ 19 | N5 M3 S1000\n\ 20 | N6 G0 X0.25 Y0.3039\n\ 21 | N7 G1 F10.0 Z0.0\n\ 22 | N8 G3 F30.0 X0.1463 Y0.3214 Z-0.0021 I-0.0625 J-0.0539\n\ 23 | N9 G3 Y0.1786 Z-0.0054 I0.0413 J-0.0714\n\ 24 | N10 G3 X0.25 Y0.1961 Z-0.0075 I0.0413 J0.0714\n\ 25 | N11 G3 X0.2713 Y0.1786 Z-0.008 I0.0625 J0.0539\n\ 26 | N12 G3 X0.395 Y0.25 Z-0.0113 I0.0413 J0.0714\n\ 27 | N13 G3 X0.2713 Y0.3214 Z-0.0145 I-0.0825 J0.0\n\ 28 | N14 M5\n\ 29 | N15 M30"; 30 | */ 31 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_line_X_800mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_line_X_800mm.h - data file containing gcode 3 | */ 4 | 5 | const char PROGMEM gcode_file[] = "\ 6 | N1 T1M6\n\ 7 | N2 G17\n\ 8 | N3 G21 (mm)\n\ 9 | N4 G92X0 Y0 Z0\n\ 10 | N5 F1200.0\n\ 11 | /N6 G1 x0\n\ 12 | N7 G1 x0.3\n\ 13 | N8 G1 x0.6\n\ 14 | N9 G1 x0.9\n\ 15 | N10 G1 x1.2\n\ 16 | N11 G1 x1.5\n\ 17 | N12 G1 x1.8\n\ 18 | N13 G1 x2.1\n\ 19 | N14 G1 x2.4\n\ 20 | N15 G1 x2.7\n\ 21 | N16 G1 x3.0\n\ 22 | N17 G1 x3.3\n\ 23 | N18 G1 x3.6\n\ 24 | N19 G1 x3.9\n\ 25 | N20 G1 x4.2\n\ 26 | /N21 G1 x4.5\n\ 27 | /N22 G1 x4.8\n\ 28 | /N23 G1 x5.1\n\ 29 | /N24 G1 x5.4\n\ 30 | /N25 G1 x5.7\n\ 31 | /N26 G1 x6.0\n\ 32 | /N27 G1 x6.3\n\ 33 | /N28 G1 x6.6\n\ 34 | /N29 G1 x6.9\n\ 35 | /N30 G1 x7.2\n\ 36 | /N31 G1 x7.5\n\ 37 | /N32 G1 x7.8\n\ 38 | /N33 G1 x8.1\n\ 39 | /N34 G1 x8.4\n\ 40 | /N35 G1 x8.7\n\ 41 | /N36 G1 x9.0\n\ 42 | /N37 G1 x9.3\n\ 43 | /N38 G1 x9.6\n\ 44 | /N39 G1 x9.9\n\ 45 | /N40 G1 x10.2\n\ 46 | /N41 G1 x10.5\n\ 47 | /N42 G1 x10.8\n\ 48 | /N43 G1 x11.1\n\ 49 | /N44 G1 x11.4\n\ 50 | /N45 G1 x11.7\n\ 51 | /N46 G1 x12.0\n\ 52 | /N47 G1 x12.3\n\ 53 | /N48 G1 x12.6\n\ 54 | /N49 G1 x12.9\n\ 55 | /N50 G1 x13.2\n\ 56 | /N51 G1 x13.5\n\ 57 | /N52 G1 x13.8\n\ 58 | /N53 G1 x14.1\n\ 59 | /N54 G1 x14.4\n\ 60 | /N55 G1 x14.7\n\ 61 | /N56 G1 x15.0\n\ 62 | /N57 G1 x15.3\n\ 63 | /N58 G1 x15.6\n\ 64 | /N59 G1 x15.9\n\ 65 | /N60 G1 x16.2\n\ 66 | /N61 G1 x16.5\n\ 67 | /N62 G1 x16.8\n\ 68 | /N63 G1 x17.1\n\ 69 | /N64 G1 x17.4\n\ 70 | /N65 G1 x17.7\n\ 71 | /N66 G1 x18.0\n\ 72 | /N67 G1 x18.3\n\ 73 | /N68 G1 x18.6\n\ 74 | /N69 G1 x18.9\n\ 75 | /N70 G1 x19.2\n\ 76 | /N71 G1 x19.5\n\ 77 | /N72 G1 x19.8\n\ 78 | /N73 G1 x20.1\n\ 79 | /N74 G1 x20.4\n\ 80 | /N75 G1 x20.7\n\ 81 | /N76 G1 x21.0\n\ 82 | /N77 G1 x21.3\n\ 83 | /N78 G1 x21.6\n\ 84 | /N79 G1 x21.9\n\ 85 | /N80 G1 x22.2\n\ 86 | /N81 G1 x22.5\n\ 87 | /N82 G1 x22.8\n\ 88 | /N83 G1 x23.1\n\ 89 | /N84 G1 x23.4\n\ 90 | /N85 G1 x23.7\n\ 91 | /N86 G1 x24.0\n\ 92 | /N87 G1 x24.3\n\ 93 | /N88 G1 x24.6\n\ 94 | /N89 G1 x24.9\n\ 95 | /N90 G1 x25.2\n\ 96 | /N91 G1 x25.5\n\ 97 | /N92 G1 x25.8\n\ 98 | /N93 G1 x26.1\n\ 99 | /N94 G1 x26.4\n\ 100 | /N95 G1 x26.7\n\ 101 | /N96 G1 x27.0\n\ 102 | /N97 G1 x27.3\n\ 103 | /N98 G1 x27.6\n\ 104 | /N99 G1 x27.9\n\ 105 | /N100 G1 x28.2\n\ 106 | /N101 G1 x28.5\n\ 107 | /N102 G1 x28.8\n\ 108 | /N103 G1 x29.1\n\ 109 | /N104 G1 x29.4\n\ 110 | /N105 G1 x29.7\n\ 111 | /N106 G1 x0 y0"; 112 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_line_Xa_800mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_line_X_800mm.h - data file containing gcode 3 | */ 4 | 5 | const char PROGMEM line_X_800[] = "\ 6 | N1 T1M6\n\ 7 | N2 G17\n\ 8 | N3 G21 (mm)\n\ 9 | N4 G92X0 Y0 Z0\n\ 10 | N5 F800.0\n\ 11 | N6 G1 x0\n\ 12 | N7 G1 x0.1\n\ 13 | N8 G1 x0.2\n\ 14 | N9 G1 x0.3\n\ 15 | N10 G1 x0.4\n\ 16 | N11 G1 x0.5\n\ 17 | N12 G1 x0.6\n\ 18 | N13 G1 x0.7\n\ 19 | N14 G1 x0.8\n\ 20 | N15 G1 x0.9\n\ 21 | N16 G1 x1.0\n\ 22 | N17 G1 x1.1\n\ 23 | N18 G1 x1.2\n\ 24 | N19 G1 x1.3\n\ 25 | N20 G1 x1.4\n\ 26 | N21 G1 x1.5\n\ 27 | N22 G1 x1.6\n\ 28 | N23 G1 x1.7\n\ 29 | /N24 G1 x1.8\n\ 30 | /N25 G1 x1.9\n\ 31 | /N26 G1 x2.0\n\ 32 | /N27 G1 x2.1\n\ 33 | /N28 G1 x2.2\n\ 34 | /N29 G1 x2.3\n\ 35 | /N30 G1 x2.4\n\ 36 | /N31 G1 x2.5\n\ 37 | /N32 G1 x2.6\n\ 38 | /N33 G1 x2.7\n\ 39 | /N34 G1 x2.8\n\ 40 | /N35 G1 x2.9\n\ 41 | /N36 G1 x3.0\n\ 42 | /N37 G1 x3.1\n\ 43 | /N38 G1 x3.2\n\ 44 | /N39 G1 x3.3\n\ 45 | /N40 G1 x3.4\n\ 46 | /N41 G1 x3.5\n\ 47 | /N42 G1 x3.6\n\ 48 | /N43 G1 x3.7\n\ 49 | /N44 G1 x3.8\n\ 50 | /N45 G1 x3.9\n\ 51 | /N46 G1 x4.0\n\ 52 | /N47 G1 x4.1\n\ 53 | /N48 G1 x4.2\n\ 54 | /N49 G1 x4.3\n\ 55 | /N50 G1 x4.4\n\ 56 | /N51 G1 x4.5\n\ 57 | /N52 G1 x4.6\n\ 58 | /N53 G1 x4.7\n\ 59 | /N54 G1 x4.8\n\ 60 | /N55 G1 x4.9\n\ 61 | /N56 G1 x5.0\n\ 62 | /N57 G1 x5.1\n\ 63 | /N58 G1 x5.2\n\ 64 | /N59 G1 x5.3\n\ 65 | /N60 G1 x5.4\n\ 66 | /N61 G1 x5.5\n\ 67 | /N62 G1 x5.6\n\ 68 | /N63 G1 x5.7\n\ 69 | /N64 G1 x5.8\n\ 70 | /N65 G1 x5.9\n\ 71 | /N66 G1 x6.0\n\ 72 | /N67 G1 x6.1\n\ 73 | /N68 G1 x6.2\n\ 74 | /N69 G1 x6.3\n\ 75 | /N70 G1 x6.4\n\ 76 | /N71 G1 x6.5\n\ 77 | /N72 G1 x6.6\n\ 78 | /N73 G1 x6.7\n\ 79 | /N74 G1 x6.8\n\ 80 | /N75 G1 x6.9\n\ 81 | /N76 G1 x7.0\n\ 82 | /N77 G1 x7.1\n\ 83 | /N78 G1 x7.2\n\ 84 | /N79 G1 x7.3\n\ 85 | /N80 G1 x7.4\n\ 86 | /N81 G1 x7.5\n\ 87 | /N82 G1 x7.6\n\ 88 | /N83 G1 x7.7\n\ 89 | /N84 G1 x7.8\n\ 90 | /N85 G1 x7.9\n\ 91 | /N86 G1 x8.0\n\ 92 | /N87 G1 x8.1\n\ 93 | /N88 G1 x8.2\n\ 94 | /N89 G1 x8.3\n\ 95 | /N90 G1 x8.4\n\ 96 | /N91 G1 x8.5\n\ 97 | /N92 G1 x8.6\n\ 98 | /N93 G1 x8.7\n\ 99 | /N94 G1 x8.8\n\ 100 | /N95 G1 x8.9\n\ 101 | /N96 G1 x9.0\n\ 102 | /N97 G1 x9.1\n\ 103 | /N98 G1 x9.2\n\ 104 | /N99 G1 x9.3\n\ 105 | /N100 G1 x9.4\n\ 106 | /N101 G1 x9.5\n\ 107 | /N102 G1 x9.6\n\ 108 | /N103 G1 x9.7\n\ 109 | /N104 G1 x9.8\n\ 110 | /N105 G1 x9.9\n\ 111 | /N106 G1 x0 y0"; 112 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_mickey_test.h: -------------------------------------------------------------------------------- 1 | /* Mickey mouse drawing 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G20 G90 G64 G40\n\ 5 | N2 G0 Z0.125\n\ 6 | N3 T1 M6\n\ 7 | N4 G17\n\ 8 | N5 M3 S1000\n\ 9 | N6 G0 X0.7491 Y1.2562\n\ 10 | N7 G1 F10.0 Z-0.015\n\ 11 | N8 G3 F30.0 X0.7585 Y1.3265 I-0.2581 J0.0703\n\ 12 | N9 G3 X0.3572 Y1.5582 I-0.2675 J0.0\n\ 13 | N10 G3 Y1.0949 I0.1338 J-0.2317\n\ 14 | N11 G3 X0.603 Y1.0836 I0.1338 J0.2317\n\ 15 | N12 G3 X0.778 Y0.5282 I0.3904 J-0.1823\n\ 16 | N13 G3 X1.4244 Y0.9013 I0.2154 J0.3732\n\ 17 | N14 G3 X1.3839 Y1.0836 I-0.4309 J0.0\n\ 18 | N15 G3 X1.7635 Y1.3265 I0.1121 J0.2429\n\ 19 | N16 G3 X1.3622 Y1.5582 I-0.2675 J0.0\n\ 20 | N17 G3 X1.2379 Y1.2562 I0.1338 J-0.2317\n\ 21 | N18 G3 X0.778 Y1.2745 I-0.2444 J-0.3549\n\ 22 | N19 G3 X0.7491 Y1.2562 I0.2154 J-0.3732\n\ 23 | N20 M5\n\ 24 | N21 M30"; 25 | 26 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_nfinity_001.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G20 G90 G64 G40\n\ 5 | N2 G0 Z0.125\n\ 6 | N3 T1 M6\n\ 7 | N4 G17\n\ 8 | N5 M3 S1000\n\ 9 | N6 G0 X0.25 Y0.3039\n\ 10 | N7 G1 F10.0 Z0.0\n\ 11 | N8 G3 F30.0 X0.1463 Y0.3214 Z-0.0021 I-0.0625 J-0.0539\n\ 12 | N9 G3 Y0.1786 Z-0.0054 I0.0413 J-0.0714\n\ 13 | N10 G3 X0.25 Y0.1961 Z-0.0075 I0.0413 J0.0714\n\ 14 | N11 G3 X0.2713 Y0.1786 Z-0.008 I0.0625 J0.0539\n\ 15 | N12 G3 X0.395 Y0.25 Z-0.0113 I0.0413 J0.0714\n\ 16 | N13 G3 X0.2713 Y0.3214 Z-0.0145 I-0.0825 J0.0\n\ 17 | N14 M5\n\ 18 | N15 M30"; 19 | 20 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_reilly_111115.h: -------------------------------------------------------------------------------- 1 | /* Chris Rielly's raster file from 11/15/11 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G20 G90 G40\n\ 5 | /N2 G0 Z0.6\n\ 6 | N3 G0 X0 Y0\n\ 7 | N4 T0 M6\n\ 8 | N5 G17\n\ 9 | N6 M3\n\ 10 | N7 G1 F40.0\n\ 11 | N8 X0.10\n\ 12 | N9 Z0.00\n\ 13 | N10 X0.19\n\ 14 | N11 Z0.00\n\ 15 | N12 X0.29\n\ 16 | N13 Z0.00\n\ 17 | N14 X0.38\n\ 18 | N15 Z0.00\n\ 19 | N16 X0.48\n\ 20 | N17 Z0.00\n\ 21 | N18 X0.58\n\ 22 | N19 Z0.00\n\ 23 | N20 X0.67\n\ 24 | N21 Z0.00\n\ 25 | N22 X0.77\n\ 26 | N23 Z0.00\n\ 27 | N24 X0.86\n\ 28 | N25 Z0.00\n\ 29 | N26 X0.96\n\ 30 | N27 Z0.00\n\ 31 | N28 X1.06\n\ 32 | N29 Z0.00\n\ 33 | N30 X1.15\n\ 34 | N31 Z0.00\n\ 35 | N32 X1.25\n\ 36 | N33 Z0.00\n\ 37 | N34 X1.34\n\ 38 | N35 Z0.00\n\ 39 | N36 X1.44\n\ 40 | N37 Z0.00\n\ 41 | N38 X1.54\n\ 42 | N39 Z0.00\n\ 43 | N40 X1.63\n\ 44 | N41 Z0.00\n\ 45 | N42 X1.73\n\ 46 | N43 Z0.00\n\ 47 | N44 X1.82\n\ 48 | N45 Z0.00\n\ 49 | N46 X1.92\n\ 50 | N47 Z0.00\n\ 51 | N48 X2.02\n\ 52 | N49 Z0.00\n\ 53 | N50 X2.11\n\ 54 | N51 Z0.00\n\ 55 | N52 X2.21\n\ 56 | N53 Z0.00\n\ 57 | N54 X2.30\n\ 58 | N55 Z0.00\n\ 59 | N56 X2.40\n\ 60 | N57 Z0.00\n\ 61 | N58 X2.50\n\ 62 | N59 Z0.00\n\ 63 | N60 X2.59\n\ 64 | N61 Z0.00\n\ 65 | N62 X2.69\n\ 66 | N63 Z0.00\n\ 67 | N64 X2.78\n\ 68 | N65 Z0.00\n\ 69 | N66 X2.88\n\ 70 | N67 Z0.00\n\ 71 | N68 X2.98\n\ 72 | N69 Z0.00\n\ 73 | N70 X3.07\n\ 74 | N71 Z0.00\n\ 75 | N72 X3.17\n\ 76 | N73 Z0.00\n\ 77 | N74 X3.26\n\ 78 | N75 Z0.00\n\ 79 | N76 X3.36\n\ 80 | N77 Z0.00\n\ 81 | N78 X3.46\n\ 82 | N79 Z0.00\n\ 83 | N80 X3.55\n\ 84 | N81 Z0.00\n\ 85 | N82 X3.65\n\ 86 | N83 Z0.00\n\ 87 | N84 X3.74\n\ 88 | N85 Z0.00\n\ 89 | N86 Z0.6\n\ 90 | N87 G0 X0 Y0.10\n\ 91 | N88 G1 F40.0\n\ 92 | N89 X0.10\n\ 93 | N90 M30"; 94 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_square_pocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G20 G90 G40\n\ 5 | N2 (pocket 1)\n\ 6 | N3 G0 Z0.25\n\ 7 | N4 G17\n\ 8 | N5 G1 X1 F55\n\ 9 | N6 G1 Z0 F15\n\ 10 | N7 G1 Z-0.0625 F15\n\ 11 | N8 G1 Y1\n\ 12 | N9 G1 X0.9375\n\ 13 | N10 G1 Y0\n\ 14 | N11 G1 X0.875\n\ 15 | N12 G1 Y1\n\ 16 | N13 G1 X0.8125\n\ 17 | N14 G1 Y0\n\ 18 | N15 G1 X0.8125\n\ 19 | N16 G1 Y1\n\ 20 | N17 G1 X0.6875\n\ 21 | N18 G1 Y0\n\ 22 | N19 G1 X0.625\n\ 23 | N20 G1 Y1\n\ 24 | N21 G1 X0.5625\n\ 25 | N22 G1 Y0\n\ 26 | N23 G1 X0.5\n\ 27 | N24 G1 Y1\n\ 28 | N25 G1 X0.4375\n\ 29 | N26 G1 Y0\n\ 30 | N27 G1 X0.375\n\ 31 | N28 G1 Y1\n\ 32 | N29 G1 X0.3125\n\ 33 | N30 G1 Y0\n\ 34 | N31 G1 X0.25\n\ 35 | N32 G1 Y1\n\ 36 | N33 G1 X0.1875\n\ 37 | N34 G1 Y0\n\ 38 | N35 G1 X0.125\n\ 39 | N36 G1 Y1\n\ 40 | N37 G1 X0.0625\n\ 41 | N38 G1 Y0\n\ 42 | N39 G1 X0\n\ 43 | N40 G1 Y1\n\ 44 | N41 G0 Z0.25\n\ 45 | N42 G0 X0 Y0\n\ 46 | N43 M5\n\ 47 | N15 M30"; 48 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_startup_tests.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_startup_tests.h - data file containing assorted tests 3 | */ 4 | 5 | const char PROGMEM startup_tests[] = "\ 6 | G00 G17 G21 G40 G49 G80 G90 (initialize model)\n\ 7 | G92 X0 Y0 Z0 (zero system)\n\ 8 | G00 x20\n\ 9 | y20\n\ 10 | z20\n\ 11 | a20\n\ 12 | G00 x0 y0 z0 a0\n\ 13 | G01 f100 x7\n\ 14 | y7\n\ 15 | z7\n\ 16 | a7\n\ 17 | G00 x0 y0 z0 a0\n\ 18 | G92 x0 y0"; 19 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_straight_600mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_straight_600mm.h - data file containing gcode 3 | */ 4 | 5 | /* 6 | const char PROGMEM gcode_file[] = "\ 7 | N1 T1M6\n\ 8 | N2 G17\n\ 9 | N3 G21 (mm)\n\ 10 | N4 G92X0 Y0 Z0\n\ 11 | N5 F800.0\n\ 12 | N6 G1 x0 y0\n\ 13 | N7 G1 x0.3 y0.3\n\ 14 | N8 G1 x0.6 y0.6\n\ 15 | N9 G1 x0.9 y0.9\n\ 16 | N10 G1 x1.2 y1.2\n\ 17 | /N11 G1 x1.5 y1.5\n\ 18 | /N12 G1 x1.8 y1.8\n\ 19 | /N13 G1 x2.1 y2.1\n\ 20 | /N14 G1 x2.4 y2.4\n\ 21 | /N15 G1 x2.7 y2.7\n\ 22 | /N16 G1 x3.0 y3.0\n\ 23 | /N17 G1 x3.3 y3.3\n\ 24 | /N18 G1 x3.6 y3.6\n\ 25 | /N19 G1 x3.9 y3.9\n\ 26 | /N20 G1 x4.2 y4.2\n\ 27 | /N21 G1 x4.5 y4.5\n\ 28 | /N22 G1 x4.8 y4.8\n\ 29 | /N23 G1 x5.1 y5.1\n\ 30 | /N24 G1 x5.4 y5.4\n\ 31 | /N25 G1 x5.7 y5.7\n\ 32 | /N26 G1 x6.0 y6.0"; 33 | */ 34 | 35 | 36 | const char PROGMEM gcode_file[] = "\ 37 | N1 T1M6\n\ 38 | N2 G17\n\ 39 | N3 G21 (mm)\n\ 40 | N4 G92X0 Y0 Z0\n\ 41 | N5 F800.0\n\ 42 | N6 G1 x0 y0\n\ 43 | N7 G1 x0.3 y0.3\n\ 44 | N8 G1 x0.6 y0.6\n\ 45 | N9 G1 x0.9 y0.9\n\ 46 | N10 G1 x1.2 y1.2\n\ 47 | N11 G1 x1.5 y1.5\n\ 48 | N12 G1 x1.8 y1.8\n\ 49 | N13 G1 x2.1 y2.1\n\ 50 | N14 G1 x2.4 y2.4\n\ 51 | N15 G1 x2.7 y2.7\n\ 52 | N16 G1 x3.0 y3.0\n\ 53 | N17 G1 x3.3 y3.3\n\ 54 | N18 G1 x3.6 y3.6\n\ 55 | N19 G1 x3.9 y3.9\n\ 56 | N20 G1 x4.2 y4.2\n\ 57 | N21 G1 x4.5 y4.5\n\ 58 | N22 G1 x4.8 y4.8\n\ 59 | N23 G1 x5.1 y5.1\n\ 60 | N24 G1 x5.4 y5.4\n\ 61 | N25 G1 x5.7 y5.7\n\ 62 | N26 G1 x6.0 y6.0\n\ 63 | N27 G1 x6.3 y6.3\n\ 64 | N28 G1 x6.6 y6.6\n\ 65 | N29 G1 x6.9 y6.9\n\ 66 | N30 G1 x7.2 y7.2\n\ 67 | N31 G1 x7.5 y7.5\n\ 68 | N32 G1 x7.8 y7.8\n\ 69 | N33 G1 x8.1 y8.1\n\ 70 | N34 G1 x8.4 y8.4\n\ 71 | N35 G1 x8.7 y8.7\n\ 72 | N36 G1 x9.0 y9.0\n\ 73 | N37 G1 x9.3 y9.3\n\ 74 | N38 G1 x9.6 y9.6\n\ 75 | N39 G1 x9.9 y9.9\n\ 76 | N40 G1 x10.2 y10.2\n\ 77 | N41 G1 x10.5 y10.5\n\ 78 | N42 G1 x10.8 y10.8\n\ 79 | N43 G1 x11.1 y11.1\n\ 80 | N44 G1 x11.4 y11.4\n\ 81 | N45 G1 x11.7 y11.7\n\ 82 | N46 G1 x12.0 y12.0\n\ 83 | N47 G1 x12.3 y12.3\n\ 84 | N48 G1 x12.6 y12.6\n\ 85 | N49 G1 x12.9 y12.9\n\ 86 | N50 G1 x13.2 y13.2\n\ 87 | N51 G1 x13.5 y13.5\n\ 88 | N52 G1 x13.8 y13.8\n\ 89 | N53 G1 x14.1 y14.1\n\ 90 | N54 G1 x14.4 y14.4\n\ 91 | N55 G1 x14.7 y14.7\n\ 92 | N56 G1 x15.0 y15.0\n\ 93 | N57 G1 x15.3 y15.3\n\ 94 | N58 G1 x15.6 y15.6\n\ 95 | N59 G1 x15.9 y15.9\n\ 96 | N60 G1 x16.2 y16.2\n\ 97 | N61 G1 x16.5 y16.5\n\ 98 | N62 G1 x16.8 y16.8\n\ 99 | N63 G1 x17.1 y17.1\n\ 100 | N64 G1 x17.4 y17.4\n\ 101 | N65 G1 x17.7 y17.7\n\ 102 | N66 G1 x18.0 y18.0\n\ 103 | N67 G1 x18.3 y18.3\n\ 104 | N68 G1 x18.6 y18.6\n\ 105 | N69 G1 x18.9 y18.9\n\ 106 | N70 G1 x19.2 y19.2\n\ 107 | N71 G1 x19.5 y19.5\n\ 108 | N72 G1 x19.8 y19.8\n\ 109 | N73 G1 x20.1 y20.1\n\ 110 | N74 G1 x20.4 y20.4\n\ 111 | N75 G1 x20.7 y20.7\n\ 112 | N76 G1 x21.0 y21.0\n\ 113 | N77 G1 x21.3 y21.3\n\ 114 | N78 G1 x21.6 y21.6\n\ 115 | N79 G1 x21.9 y21.9\n\ 116 | N80 G1 x22.2 y22.2\n\ 117 | N81 G1 x22.5 y22.5\n\ 118 | N82 G1 x22.8 y22.8\n\ 119 | N83 G1 x23.1 y23.1\n\ 120 | N84 G1 x23.4 y23.4\n\ 121 | N85 G1 x23.7 y23.7\n\ 122 | N86 G1 x24.0 y24.0\n\ 123 | N87 G1 x24.3 y24.3\n\ 124 | N88 G1 x24.6 y24.6\n\ 125 | N89 G1 x24.9 y24.9\n\ 126 | N90 G1 x25.2 y25.2\n\ 127 | N91 G1 x25.5 y25.5\n\ 128 | N92 G1 x25.8 y25.8\n\ 129 | N93 G1 x26.1 y26.1\n\ 130 | N94 G1 x26.4 y26.4\n\ 131 | N95 G1 x26.7 y26.7\n\ 132 | N96 G1 x27.0 y27.0\n\ 133 | N97 G1 x27.3 y27.3\n\ 134 | N98 G1 x27.6 y27.6\n\ 135 | N99 G1 x27.9 y27.9\n\ 136 | N100 G1 x28.2 y28.2\n\ 137 | N101 G1 x28.5 y28.5\n\ 138 | N102 G1 x28.8 y28.8\n\ 139 | N103 G1 x29.1 y29.1\n\ 140 | N104 G1 x29.4 y29.4\n\ 141 | N105 G1 x29.7 y29.7\n\ 142 | N106 G1 x0 y0"; 143 | 144 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_test001.h: -------------------------------------------------------------------------------- 1 | const char PROGMEM gcode_file[] = "\ 2 | N1 T1M6\n\ 3 | N2 G17\n\ 4 | N3 G21 (mm)\n\ 5 | N4 (S8000)\n\ 6 | N5 (M3)\n\ 7 | N6 G92X0.327Y-33.521Z-1.000\n\ 8 | N7 G0Z4.000\n\ 9 | N8 F1200\n\ 10 | N9 G1X0.327Y-33.521\n\ 11 | N10 G1Z-1.000\n\ 12 | N11 X0.654Y-33.526\n\ 13 | N12 X0.980Y-33.534\n\ 14 | N13 X1.304Y-33.546\n\ 15 | N14 X1.626Y-33.562\n\ 16 | N15 X1.946Y-33.580\n\ 17 | N16 X2.262Y-33.602\n\ 18 | N17 X2.574Y-33.628\n\ 19 | N18 X2.882Y-33.656\n\ 20 | N19 X3.185Y-33.688\n\ 21 | N20 X3.483Y-33.724\n\ 22 | N21 X3.775Y-33.762\n\ 23 | N22 X4.060Y-33.805\n\ 24 | N23 X4.339Y-33.850\n\ 25 | N24 X4.610Y-33.898\n\ 26 | N25 X4.874Y-33.950\n\ 27 | N26 X5.130Y-34.005\n\ 28 | N27 X5.376Y-34.064\n\ 29 | N28 X5.614Y-34.125\n\ 30 | N29 X5.842Y-34.190\n\ 31 | N30 X6.060Y-34.257\n\ 32 | N31 X6.268Y-34.328\n\ 33 | N32 X6.466Y-34.402\n\ 34 | N33 X6.652Y-34.479\n\ 35 | N34 X6.827Y-34.559\n\ 36 | N35 X6.990Y-34.642\n\ 37 | N2486 G0Z4.000\n\ 38 | N2487 G0X37.560Y12.327Z6.000\n\ 39 | N2488 G1Z-1.000\n\ 40 | N2489 G1Y0.876\n\ 41 | N2490 X49.011\n\ 42 | N2491 Y12.327\n\ 43 | N2492 X37.560\n\ 44 | N2493 G0Z4.000\n\ 45 | N2494 G0Y0.876\n\ 46 | N2495 G1Z-1.000\n\ 47 | N2496 G1Y-10.575\n\ 48 | N2497 X49.011\n\ 49 | N2498 Y0.876\n\ 50 | N2499 X37.560\n\ 51 | N2500 G0Z4.000\n\ 52 | N2501 G0X49.011Y12.327\n\ 53 | N2502 G1Z-1.000\n\ 54 | N2503 G1X52.084Y15.011\n\ 55 | N2504 G0Z4.000\n\ 56 | N2505 G0X49.011Y0.876\n\ 57 | N2506 G1Z-1.000\n\ 58 | N2507 G1X52.084Y6.213\n\ 59 | N2508 Y15.011\n\ 60 | N2509 X43.286\n\ 61 | N2510 X37.560Y12.327\n\ 62 | N2511 G0Z4.000\n\ 63 | N2512 G0X49.011Y-10.575\n\ 64 | N2513 G1Z-1.000\n\ 65 | N2514 G1X52.084Y-2.585\n\ 66 | N2515 Y6.213\n\ 67 | N2516 X49.011Y0.876\n\ 68 | N2517 G0Z4.000\n\ 69 | N2518 G0X0.327Y-33.521Z-1.000\n\ 70 | N2519 M30"; 71 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_test_002.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | const char PROGMEM gcode_file[] = "\ 4 | N1 G21 G90 G64 G40\n\ 5 | N2 G17\n\ 6 | N3 T1 M6\n\ 7 | N4 M3 S1000\n\ 8 | N5 G92 X0 Y0 Z0\n\ 9 | N6 G1 F500 X20\n\ 10 | N7 G1 Y2\n\ 11 | N8 G1 X0\n\ 12 | N9 G1 Y4\n\ 13 | N10 G1 X20\n\ 14 | N11 G1 Y6\n\ 15 | N12 G1 X0\n\ 16 | N13 G1 Y8\n\ 17 | N14 G1 X20\n\ 18 | N15 G1 Y10\n\ 19 | N16 G1 X0\n\ 20 | N17 G1 Y12\n\ 21 | N18 G1 X20\n\ 22 | N19 G1 Y14\n\ 23 | N20 G1 X0\n\ 24 | N21 G1 Y16\n\ 25 | N22 G1 X20\n\ 26 | N23 G1 Y18\n\ 27 | N24 G1 X0\n\ 28 | N25 G1 Y20\n\ 29 | N26 G1 X0 Y0\n\ 30 | N15 M30"; 31 | 32 | -------------------------------------------------------------------------------- /Resources/gcode/gcode_zoetrope.h: -------------------------------------------------------------------------------- 1 | /* 2 | * data_gcode_zoetrope.h - data file containing gcode 3 | */ 4 | 5 | const char PROGMEM zoetrope[] = "\ 6 | G21\n\ 7 | G90\n\ 8 | F320\n\ 9 | G1 X-27.7814 Y11.3222 \n\ 10 | G1 X-13.7952 Y1.99803 \n\ 11 | G1 X-27.7814 Y11.3222 \n\ 12 | G1 X-27.7814 Y1.99803 \n\ 13 | G1 X-27.7814 Y11.3222 \n\ 14 | G1 X-27.7814 Y1.99803 \n\ 15 | G1 X-13.7952 Y1.99803 \n\ 16 | G1 X-13.7952 Y11.3222 \n\ 17 | G1 X-13.7952 Y1.99803 \n\ 18 | G1 X-10.8055 Y21.1219 \n\ 19 | G1 X-11.3961 Y19.7548 \n\ 20 | G1 X-11.558 Y17.878 \n\ 21 | G1 X-10.7814 Y15.9202 \n\ 22 | G1 X-9.92396 Y14.9009 \n\ 23 | G1 X-8.12809 Y13.8007 \n\ 24 | G1 X-6.25129 Y13.6388 \n\ 25 | G1 X-4.80324 Y13.9866 \n\ 26 | G1 X-3.27425 Y15.2728 \n\ 27 | G1 X-2.68367 Y16.64 \n\ 28 | G1 X-2.52182 Y18.5168 \n\ 29 | G1 X-3.29837 Y20.4745 \n\ 30 | G1 X-4.15584 Y21.4938 \n\ 31 | G1 X-5.95171 Y22.5941 \n\ 32 | G1 X-7.8285 Y22.7559 \n\ 33 | G1 X-9.27656 Y22.4081 \n\ 34 | G1 X-10.8055 Y21.1219 \n\ 35 | G1 X4.27576 Y18.746 \n\ 36 | G1 X12.2103 Y17.788 \n\ 37 | G1 X12.3699 Y19.1104 \n\ 38 | G1 X11.8684 Y20.5127 \n\ 39 | G1 X11.287 Y21.2537 \n\ 40 | G1 X10.0444 Y22.0746 \n\ 41 | G1 X8.06077 Y22.3141 \n\ 42 | G1 X6.65853 Y21.8125 \n\ 43 | G1 X5.17645 Y20.6498 \n\ 44 | G1 X4.27576 Y18.746 \n\ 45 | G1 X4.1161 Y17.4235 \n\ 46 | G1 X4.53783 Y15.3601 \n\ 47 | G1 X5.70059 Y13.878 \n\ 48 | G1 X6.94317 Y13.0572 \n\ 49 | G1 X8.9268 Y12.8177 \n\ 50 | G1 X10.329 Y13.3192 \n\ 51 | G1 X11.8111 Y14.482 \n\ 52 | G1 X23.6509 Y14.951 \n\ 53 | G1 X14.8687 Y7.80509 \n\ 54 | G1 X13.7392 Y6.02745 \n\ 55 | G1 X14.0633 Y4.5739 \n\ 56 | G1 X14.904 Y3.5407 \n\ 57 | G1 X18.7737 Y13.5584 \n\ 58 | G1 X21.7161 Y9.94214 \n\ 59 | G1 X18.7737 Y13.5584 \n\ 60 | G1 X23.2352 Y1.31533 \n\ 61 | G1 X14.0474 Y-0.273848 \n\ 62 | G1 X23.2352 Y1.31533 \n\ 63 | G1 X19.2976 Y0.634252 \n\ 64 | G1 X21.3799 Y0.318524 \n\ 65 | G1 X22.9194 Y-0.766981 \n\ 66 | G1 X23.8027 Y-1.966 \n\ 67 | G1 X24.1433 Y-3.9348 \n\ 68 | G1 X18.6913 Y-14.6127 \n\ 69 | G1 X18.6517 Y-13.1239 \n\ 70 | G1 X18.0086 Y-11.3533 \n\ 71 | G1 X16.4803 Y-9.90425 \n\ 72 | G1 X15.2734 Y-9.34046 \n\ 73 | G1 X13.1813 Y-9.0982 \n\ 74 | G1 X11.4107 Y-9.74125 \n\ 75 | G1 X10.2435 Y-10.6662 \n\ 76 | G1 X9.39784 Y-12.4764 \n\ 77 | G1 X9.43747 Y-13.9651 \n\ 78 | G1 X10.0805 Y-15.7357 \n\ 79 | G1 X11.6089 Y-17.1848 \n\ 80 | G1 X12.8157 Y-17.7486 \n\ 81 | G1 X14.9078 Y-17.9909 \n\ 82 | G1 X16.6784 Y-17.3478 \n\ 83 | G1 X17.8456 Y-16.4229 \n\ 84 | G1 X18.6913 Y-14.6127 \n\ 85 | G1 X4.61246 Y-22.8107 \n\ 86 | G1 X0.289415 Y-9.50937 \n\ 87 | G1 X4.61246 Y-22.8107 \n\ 88 | G1 X3.99488 Y-20.9105 \n\ 89 | G1 X3.13981 Y-22.589 \n\ 90 | G1 X2.07887 Y-23.6341 \n\ 91 | G1 X0.178684 Y-24.2517 \n\ 92 | G1 X-1.29397 Y-24.03 \n\ 93 | G1 X-2.97248 Y-23.175 \n\ 94 | G1 X-4.22345 Y-21.4806 \n\ 95 | G1 X-4.63517 Y-20.2138 \n\ 96 | G1 X-4.61935 Y-18.1078 \n\ 97 | G1 X-3.76428 Y-16.4293 \n\ 98 | G1 X-2.70335 Y-15.3842 \n\ 99 | G1 X-0.803156 Y-14.7666 \n\ 100 | G1 X0.669496 Y-14.9883 \n\ 101 | G1 X2.34801 Y-15.8433 \n\ 102 | G1 X-10.9479 Y-15.8062 \n\ 103 | G1 X-17.9553 Y-11.9629 \n\ 104 | G1 X-18.5959 Y-13.1308 \n\ 105 | G1 X-18.6525 Y-14.619 \n\ 106 | G1 X-18.3888 Y-15.5232 \n\ 107 | G1 X-17.5412 Y-16.7477 \n\ 108 | G1 X-15.7893 Y-17.7085 \n\ 109 | G1 X-14.3011 Y-17.7651 \n\ 110 | G1 X-12.4927 Y-17.2378 \n\ 111 | G1 X-10.9479 Y-15.8062 \n\ 112 | G1 X-10.3074 Y-14.6383 \n\ 113 | G1 X-9.93052 Y-12.5662 \n\ 114 | G1 X-10.4579 Y-10.7577 \n\ 115 | G1 X-11.3055 Y-9.53325 \n\ 116 | G1 X-13.0573 Y-8.57243 \n\ 117 | G1 X-14.5455 Y-8.51583"; 118 | -------------------------------------------------------------------------------- /Resources/generate_dins_cfgArray.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Run this with no arguments, and get the motor code suitable for use in config_app.cpp 4 | 5 | console.log(` 6 | // Digital input configs 7 | // generated with \${PROJECT_ROOT}/Resources/generate_dins_cfgArray.js 8 | `) 9 | 10 | for (n=1; n<=12; n++) { 11 | console.log(` 12 | #if (D_IN_CHANNELS >= ${n}) 13 | { "di${n}","di${n}en",_bip, 0, din_print_en, din_get_en, din_set_en, &din${n}, DI${n}_ENABLED }, 14 | { "di${n}","di${n}po",_iip, 0, din_print_po, din_get_po, din_set_po, &din${n}, DI${n}_POLARITY }, 15 | { "di${n}","di${n}ac",_iip, 0, din_print_ac, din_get_ac, din_set_ac, &din${n}, DI${n}_ACTION }, 16 | { "di${n}","di${n}in",_iip, 0, din_print_in, din_get_in, din_set_in, &din${n}, DI${n}_EXTERNAL_NUMBER }, 17 | #endif`); 18 | } 19 | 20 | console.log(` 21 | // END generated with \${PROJECT_ROOT}/Resources/generate_dins_cfgArray.js 22 | `) 23 | -------------------------------------------------------------------------------- /Resources/generate_motors_cfgArray.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Run this with no arguments, and get the motor code suitable for use in config_app.cpp 4 | 5 | console.log(` 6 | // Motor parameters 7 | // generated with \${PROJECT_ROOT}/Resources/generate_motors_cfgArray.js 8 | `) 9 | 10 | for (n=1; n<=6; n++) { 11 | console.log(` 12 | #if (MOTORS >= ${n}) 13 | { "${n}","${n}ma", _iip, 0, st_print_ma, st_get_ma, st_set_ma, nullptr, M${n}_MOTOR_MAP }, 14 | { "${n}","${n}sa", _fip, 3, st_print_sa, st_get_sa, st_set_sa, nullptr, M${n}_STEP_ANGLE }, 15 | { "${n}","${n}tr", _fipc, 4, st_print_tr, st_get_tr, st_set_tr, nullptr, M${n}_TRAVEL_PER_REV }, 16 | { "${n}","${n}su", _f0, 5, st_print_su, st_get_su, st_set_su, nullptr, M${n}_STEPS_PER_UNIT }, 17 | { "${n}","${n}mi", _iip, 0, st_print_mi, st_get_mi, st_set_mi, nullptr, M${n}_MICROSTEPS }, 18 | { "${n}","${n}po", _iip, 0, st_print_po, st_get_po, st_set_po, nullptr, M${n}_POLARITY }, 19 | { "${n}","${n}pm", _iip, 0, st_print_pm, st_get_pm, st_set_pm, nullptr, M${n}_POWER_MODE }, 20 | { "${n}","${n}pl", _fip, 3, st_print_pl, st_get_pl, st_set_pl, nullptr, M${n}_POWER_LEVEL }, 21 | { "${n}","${n}ep", _iip, 0, st_print_ep, st_get_ep, st_set_ep, nullptr, M${n}_ENABLE_POLARITY }, 22 | { "${n}","${n}sp", _iip, 0, st_print_sp, st_get_sp, st_set_sp, nullptr, M${n}_STEP_POLARITY }, 23 | { "${n}","${n}pi", _fip, 3, st_print_pi, st_get_pi, st_set_pi, nullptr, M${n}_POWER_LEVEL_IDLE }, 24 | // { "${n}","${n}mt", _fip, 2, st_print_mt, st_get_mt, st_set_mt, nullptr, M${n}_MOTOR_TIMEOUT }, 25 | #ifdef MOTOR_${n}_IS_TRINAMIC 26 | { "${n}","${n}ts", _i0, 0, tx_print_nul, motor_${n}.get_ts_fn, set_ro, &motor_${n}, 0 }, 27 | { "${n}","${n}pth", _iip, 0, tx_print_nul, motor_${n}.get_pth_fn, motor_${n}.set_pth_fn, &motor_${n}, M${n}_TMC2130_TPWMTHRS }, 28 | { "${n}","${n}cth", _iip, 0, tx_print_nul, motor_${n}.get_cth_fn, motor_${n}.set_cth_fn, &motor_${n}, M${n}_TMC2130_TCOOLTHRS }, 29 | { "${n}","${n}hth", _iip, 0, tx_print_nul, motor_${n}.get_hth_fn, motor_${n}.set_hth_fn, &motor_${n}, M${n}_TMC2130_THIGH }, 30 | { "${n}","${n}sgt", _iip, 0, tx_print_nul, motor_${n}.get_sgt_fn, motor_${n}.set_sgt_fn, &motor_${n}, M${n}_TMC2130_SGT }, 31 | { "${n}","${n}sgr", _i0, 0, tx_print_nul, motor_${n}.get_sgr_fn, set_ro, &motor_${n}, 0 }, 32 | { "${n}","${n}csa", _i0, 0, tx_print_nul, motor_${n}.get_csa_fn, set_ro, &motor_${n}, 0 }, 33 | { "${n}","${n}sgs", _i0, 0, tx_print_nul, motor_${n}.get_sgs_fn, set_ro, &motor_${n}, 0 }, 34 | { "${n}","${n}tbl", _iip, 0, tx_print_nul, motor_${n}.get_tbl_fn, motor_${n}.set_tbl_fn, &motor_${n}, M${n}_TMC2130_TBL }, 35 | { "${n}","${n}pgrd",_iip, 0, tx_print_nul, motor_${n}.get_pgrd_fn,motor_${n}.set_pgrd_fn, &motor_${n}, M${n}_TMC2130_PWM_GRAD }, 36 | { "${n}","${n}pamp",_iip, 0, tx_print_nul, motor_${n}.get_pamp_fn,motor_${n}.set_pamp_fn, &motor_${n}, M${n}_TMC2130_PWM_AMPL }, 37 | { "${n}","${n}hend",_iip, 0, tx_print_nul, motor_${n}.get_hend_fn,motor_${n}.set_hend_fn, &motor_${n}, M${n}_TMC2130_HEND }, 38 | { "${n}","${n}hsrt",_iip, 0, tx_print_nul, motor_${n}.get_hsrt_fn,motor_${n}.set_hsrt_fn, &motor_${n}, M${n}_TMC2130_HSTRT }, 39 | { "${n}","${n}smin",_iip, 0, tx_print_nul, motor_${n}.get_smin_fn,motor_${n}.set_smin_fn, &motor_${n}, M${n}_TMC2130_SMIN }, 40 | { "${n}","${n}smax",_iip, 0, tx_print_nul, motor_${n}.get_smax_fn,motor_${n}.set_smax_fn, &motor_${n}, M${n}_TMC2130_SMAX }, 41 | { "${n}","${n}sup", _iip, 0, tx_print_nul, motor_${n}.get_sup_fn, motor_${n}.set_sup_fn, &motor_${n}, M${n}_TMC2130_SUP }, 42 | { "${n}","${n}sdn", _iip, 0, tx_print_nul, motor_${n}.get_sdn_fn, motor_${n}.set_sdn_fn, &motor_${n}, M${n}_TMC2130_SDN }, 43 | #endif 44 | #endif`); 45 | } 46 | 47 | console.log(` 48 | // END generated with \${PROJECT_ROOT}/Resources/generate_motors_cfgArray.js 49 | `) 50 | -------------------------------------------------------------------------------- /Resources/generate_motors_default_config.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Run this with no arguments, and get the motor code suitable for use in config_app.cpp 4 | 5 | console.log('// START Generated with ${PROJECT_ROOT}/Resources/generate_motors_default_config.js'); 6 | for (n=1; n<=6; n++) { 7 | console.log( 8 | `#ifndef M${n}_TMC2130_TPWMTHRS 9 | #define M${n}_TMC2130_TPWMTHRS 1200 // ${n}pth 10 | #endif 11 | #ifndef M${n}_TMC2130_TCOOLTHRS 12 | #define M${n}_TMC2130_TCOOLTHRS 1000 // ${n}cth 13 | #endif 14 | #ifndef M${n}_TMC2130_THIGH 15 | #define M${n}_TMC2130_THIGH 10 // ${n}hth 16 | #endif 17 | #ifndef M${n}_TMC2130_SGT 18 | #define M${n}_TMC2130_SGT 4 // ${n}sgt 19 | #endif 20 | #ifndef M${n}_TMC2130_TBL 21 | #define M${n}_TMC2130_TBL 2 // ${n}tbl 22 | #endif 23 | #ifndef M${n}_TMC2130_PWM_GRAD 24 | #define M${n}_TMC2130_PWM_GRAD 1 // ${n}pgrd 25 | #endif 26 | #ifndef M${n}_TMC2130_PWM_AMPL 27 | #define M${n}_TMC2130_PWM_AMPL 200 // ${n}pamp 28 | #endif 29 | #ifndef M${n}_TMC2130_HEND 30 | #define M${n}_TMC2130_HEND 0 // ${n}hend 31 | #endif 32 | #ifndef M${n}_TMC2130_HSTRT 33 | #define M${n}_TMC2130_HSTRT 0 // ${n}hsrt 34 | #endif 35 | #ifndef M${n}_TMC2130_SMIN 36 | #define M${n}_TMC2130_SMIN 5 // ${n}smin 37 | #endif 38 | #ifndef M${n}_TMC2130_SMAX 39 | #define M${n}_TMC2130_SMAX 5 // ${n}smax 40 | #endif 41 | #ifndef M${n}_TMC2130_SUP 42 | #define M${n}_TMC2130_SUP 2 // ${n}sup 43 | #endif 44 | #ifndef M${n}_TMC2130_SDN 45 | #define M${n}_TMC2130_SDN 1 // ${n}sdn 46 | #endif 47 | ` 48 | ); 49 | } 50 | console.log('// END Generated'); 51 | -------------------------------------------------------------------------------- /g2core/.gitattributes: -------------------------------------------------------------------------------- 1 | *.cpp text 2 | *.hpp text 3 | *.c text 4 | *.h text 5 | -------------------------------------------------------------------------------- /g2core/.gitignore: -------------------------------------------------------------------------------- 1 | old 2 | -------------------------------------------------------------------------------- /g2core/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile 3 | # 4 | # Copyright (c) 2012 - 2018 Robert Giseburt 5 | # Copyright (c) 2013 - 2018 Alden S. Hart Jr. 6 | # 7 | # This file is part of the g2core project. 8 | # 9 | # This file ("the software") is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License, version 2 as published by the 11 | # Free Software Foundation. You should have received a copy of the GNU General Public 12 | # License, version 2 along with the software. If not, see . 13 | # 14 | # THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 15 | # WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16 | # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 17 | # SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 19 | # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | # 21 | 22 | ############################################################################################## 23 | # Start of default section 24 | # 25 | 26 | PROJECT = g2core 27 | 28 | MOTATE_PATH ?= ../Motate/MotateProject/motate 29 | 30 | # List *project-specific* files that must be linked to first in FIRST_LINK_SOURCES. 31 | # For device-specific FIRST_LINK_SOURCES, use DEVICE_FIRST_LINK_SOURCES (in the 32 | # device-specific section, below.) 33 | # 34 | # DO include a ./ at the beginning of paths, or they won't match the glob 35 | # results and will cause linkers errors. 36 | FIRST_LINK_SOURCES = ./main.cpp 37 | 38 | # Define optimisation level here 39 | #OPTIMIZATION ?= 0 40 | OPTIMIZATION ?= s 41 | #OPTIMIZATION ?= 3 42 | 43 | DEBUG ?= 0 44 | #DEBUG ?= 1 # Use this to turn on some debugging functions 45 | #DEBUG ?= 2 # Use this for DEBUG=1 + some debug traps that need a HW debugger 46 | 47 | # SETTINGS_FILE may get overriden by the BOARD settings in the appropriate board/*.mk files 48 | SETTINGS_FILE ?= settings_default.h 49 | 50 | NEEDS_PRINTF_FLOAT=1 51 | 52 | ifeq ($(DEBUG),0) 53 | DEVICE_DEFINES += DEBUG=0 IN_DEBUGGER=0 54 | endif 55 | ifeq ($(DEBUG),1) 56 | DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=0 57 | endif 58 | ifeq ($(DEBUG),2) 59 | DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1 60 | endif 61 | ifeq ($(DEBUG),3) 62 | DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1 DEBUG_SEMIHOSTING=1 DEBUG_USE_ITM=1 63 | endif 64 | #ifeq ($(DEBUG),3) 65 | # DEVICE_DEFINES += DEBUG=1 IN_DEBUGGER=1 DEBUG_SEMIHOSTING=1 66 | #endif 67 | 68 | TOOLS_VERSION = 12.2r1 69 | 70 | # Now invoke the Motate compile system 71 | include $(MOTATE_PATH)/Motate.mk 72 | 73 | # *** EOF *** 74 | -------------------------------------------------------------------------------- /g2core/board/Archim.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=Archim 7 | 8 | 9 | 10 | ########## 11 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 12 | 13 | ifeq ("$(BOARD)","Archim") 14 | BASE_BOARD = archim 15 | DEVICE_DEFINES += MOTATE_BOARD="Archim" 16 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 17 | endif 18 | 19 | 20 | 21 | ########## 22 | # The archim BASE_BOARD. 23 | 24 | ifeq ("$(BASE_BOARD)","archim") 25 | _BOARD_FOUND = 1 26 | 27 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 28 | 29 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) 30 | 31 | CHIP = SAM3X8E 32 | export CHIP 33 | CHIP_LOWERCASE = sam3x8e 34 | 35 | BOARD_PATH = ./board/Archim 36 | SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver 37 | 38 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 39 | 40 | include $(PLATFORM_BASE).mk 41 | endif 42 | -------------------------------------------------------------------------------- /g2core/board/Archim/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/Archim 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | //******** SPI ******** 60 | #if XIO_HAS_SPI 61 | Motate::SPI spi; 62 | #endif 63 | 64 | 65 | //******** UART ******** 66 | #if XIO_HAS_UART 67 | Motate::UART Serial {115200, Motate::UARTMode::RTSCTSFlowControl}; 68 | #endif 69 | 70 | void board_hardware_init(void) // called 1st 71 | { 72 | #if XIO_HAS_USB 73 | // Init USB 74 | usb.attach(); // USB setup. Runs in "background" as the rest of this executes 75 | #endif // XIO_HAS_USB 76 | } 77 | 78 | 79 | void board_xio_init(void) // called later than board_hardware_init (there are thing in between) 80 | { 81 | // Init SPI 82 | #if XIO_HAS_SPI 83 | // handled internally for now 84 | #endif 85 | 86 | // Init UART 87 | #if XIO_HAS_UART 88 | Serial.init(); 89 | #endif 90 | } 91 | -------------------------------------------------------------------------------- /g2core/board/Archim/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/Archim 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | #if USB_SERIAL_PORTS_EXPOSED == 1 41 | typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t; 42 | #endif 43 | #if USB_SERIAL_PORTS_EXPOSED == 2 44 | typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 45 | #endif 46 | 47 | extern XIOUSBDevice_t usb; 48 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 51 | #endif 52 | #endif // XIO_HAS_USB 53 | 54 | 55 | //******** SPI ******** 56 | #if XIO_HAS_SPI 57 | #include "MotateSPI.h" 58 | extern Motate::SPI spi; 59 | #endif 60 | 61 | //******** UART ******** 62 | #if XIO_HAS_UART 63 | #include "MotateUART.h" 64 | extern Motate::UART Serial; 65 | #endif 66 | 67 | //******* Generic Functions ******* 68 | void board_hardware_init(void); // called 1st 69 | void board_xio_init(void); // called later 70 | 71 | #endif // board_xio_h 72 | -------------------------------------------------------------------------------- /g2core/board/ArduinoDue.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | source ./board/g2_default.gdb 5 | 6 | define boot_from_flash 7 | monitor at91sam3 gpnvm set 1 8 | end 9 | 10 | source -s arm.gdb 11 | -------------------------------------------------------------------------------- /g2core/board/ArduinoDue.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=gShield 7 | # Or: 8 | # make BOARD=shopbotShield 9 | 10 | # You can also choose a CONFIG from boards.mk: 11 | # make CONFIG=ShapeokoDualY BOARD=gShield 12 | 13 | 14 | 15 | # Backward compatibility with old projects that use PLATFORM instead, but with a warning: 16 | ifneq ("$(PLATFORM:-)","") 17 | $(warning Using PLATFORM value of $(PLATFORM) as BOARD.) 18 | $(warning Please swich to using BOARD on the command line.) 19 | BOARD = $(PLATFORM) 20 | endif 21 | 22 | 23 | ########## 24 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 25 | 26 | ifeq ("$(BOARD)","gShield") 27 | # This is a due with a Synthetos gShield. We'll use the Due platform, but set defines 28 | # for the code to get the pinout right. 29 | 30 | # Note: we call it "g2core-due" instead of "due" since the Motate built-in provides 31 | # a "due" BASE_BOARD. 32 | BASE_BOARD = g2core-due 33 | DEVICE_DEFINES += MOTATE_BOARD="gShield" 34 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 35 | endif 36 | 37 | ifeq ("$(BOARD)","shopbotShield") 38 | # This is a due with a shopbot shield. We'll use the Due platform, but set defines 39 | # for the code to get the pinout right. 40 | 41 | BASE_BOARD = g2core-due 42 | DEVICE_DEFINES += MOTATE_BOARD="shopbotShield" 43 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 44 | endif 45 | 46 | 47 | 48 | ########## 49 | # The general g2core-due BASE_BOARD. 50 | 51 | ifeq ("$(BASE_BOARD)","g2core-due") 52 | _BOARD_FOUND = 1 53 | 54 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 55 | 56 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) 57 | 58 | CHIP = SAM3X8E 59 | export CHIP 60 | CHIP_LOWERCASE = sam3x8e 61 | 62 | # Note: we call it "g2core-due" instead of "due" since the Motate built-in provides 63 | # a "due" BASE_BOARD. 64 | BOARD_PATH = ./board/ArduinoDue 65 | SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver device/esc_spindle device/laser_toolhead device/bme280 device/honeywell-trustability-ssc 66 | 67 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 68 | 69 | include $(PLATFORM_BASE).mk 70 | endif 71 | -------------------------------------------------------------------------------- /g2core/board/ArduinoDue/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/ArduinoDue 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | 60 | //******** SPI ******** 61 | #if XIO_HAS_SPI 62 | Motate::SPI spi; 63 | #endif 64 | 65 | 66 | //******** UART ******** 67 | #if XIO_HAS_UART 68 | Motate::UART Serial{ 69 | 115200, Motate::UARTMode::RTSCTSFlowControl}; 70 | #endif 71 | 72 | void board_hardware_init(void) // called 1st 73 | { 74 | #if XIO_HAS_USB 75 | // Init USB 76 | usb.attach(); // USB setup. Runs in "background" as the rest of this executes 77 | usb.checkAndHandleVbusChange(); 78 | #endif // XIO_HAS_USB 79 | } 80 | 81 | 82 | void board_xio_init(void) // called later than board_hardware_init (there are thing in between) 83 | { 84 | // Init SPI 85 | #if XIO_HAS_SPI 86 | // handled internally for now 87 | #endif 88 | 89 | // Init UART 90 | #if XIO_HAS_UART 91 | Serial.init(); 92 | #endif 93 | } 94 | -------------------------------------------------------------------------------- /g2core/board/ArduinoDue/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/ArduinoDue 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | #if USB_SERIAL_PORTS_EXPOSED == 1 41 | typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t; 42 | #endif 43 | #if USB_SERIAL_PORTS_EXPOSED == 2 44 | typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 45 | #endif 46 | 47 | extern XIOUSBDevice_t usb; 48 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 51 | #endif 52 | #endif // XIO_HAS_USB 53 | 54 | 55 | //******** SPI ******** 56 | #if XIO_HAS_SPI 57 | #include "MotateSPI.h" 58 | extern Motate::SPI spi; 59 | #endif 60 | 61 | //******** UART ******** 62 | #if XIO_HAS_UART 63 | #include "MotateUART.h" 64 | extern Motate::UART Serial; 65 | #endif 66 | 67 | //******* Generic Functions ******* 68 | void board_hardware_init(void); // called 1st 69 | void board_xio_init(void); // called later 70 | 71 | #endif // board_xio_h 72 | -------------------------------------------------------------------------------- /g2core/board/G2v9.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | source ./board/g2_default.gdb 5 | 6 | define boot_from_flash 7 | monitor at91sam3 gpnvm set 1 8 | end 9 | 10 | source -s arm.gdb 11 | -------------------------------------------------------------------------------- /g2core/board/G2v9.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=g2v9k 7 | 8 | # You can also choose a CONFIG from boards.mk: 9 | # make CONFIG=ShapeokoDualY BOARD=g2v9k 10 | 11 | 12 | 13 | ########## 14 | # BOARDs for use directly from the make command line (with default settings) or by the CONFIGS above. 15 | 16 | ifeq ("$(BOARD)","g2v9i") 17 | BASE_BOARD=g2v9 18 | DEVICE_DEFINES += MOTATE_BOARD="G2v9i" 19 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 20 | endif 21 | 22 | ifeq ("$(BOARD)","g2v9k") 23 | BASE_BOARD=g2v9 24 | DEVICE_DEFINES += MOTATE_BOARD="G2v9k" 25 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 26 | endif 27 | 28 | 29 | ########## 30 | # The general g2v9 BASE_BOARD. 31 | 32 | ifeq ("$(BASE_BOARD)","g2v9") 33 | _BOARD_FOUND = 1 34 | 35 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) 36 | 37 | # Set CHIP and export it for GDB to see 38 | CHIP = SAM3X8C 39 | export CHIP 40 | CHIP_LOWERCASE = sam3x8c 41 | 42 | BOARD_PATH = ./board/G2v9 43 | SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver device/esc_spindle device/sd_card 44 | 45 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 46 | 47 | include $(PLATFORM_BASE).mk 48 | 49 | ifeq ("$(BANTAM)", "1") 50 | DEVICE_DEFINES += BANTAM=1 51 | SOURCE_DIRS += device/bantam_safety_manager 52 | CUSTOM_LINKER_SCRIPT := board/G2v9/bantam-checksum-flash.ld 53 | ALL_ADDITIONS += $(OUTPUT_BIN)-summed.bin 54 | define ADDITIONAL_RECIPES 55 | # Note the use of $$$$ 56 | $(OUTPUT_BIN)-summed.bin: $(OUTPUT_BIN).bin 57 | $(QUIET)cp $(OUTPUT_BIN).bin $(OUTPUT_BIN)-summed.bin; \ 58 | printf "%08x" `cksum $(OUTPUT_BIN).bin | awk '{print $$$$1}'` | xxd -r -p | dd of=$(OUTPUT_BIN)-summed.bin bs=1 count=4 seek=256 conv=notrunc; \ 59 | printf "%08x" `wc -c "$(OUTPUT_BIN).bin" | awk '{print $$$$1}'` | xxd -r -p | dd of=$(OUTPUT_BIN)-summed.bin bs=1 count=4 seek=260 conv=notrunc 60 | endef 61 | endif 62 | 63 | endif 64 | -------------------------------------------------------------------------------- /g2core/board/G2v9/board_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * * gpio.h - SPI definitions for this board 3 | * For: /board/g2v9 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2019 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef BOARD_SPI_H_ONCE 30 | #define BOARD_SPI_H_ONCE 31 | 32 | #include "MotateSPI.h" 33 | #include "sd_card.h" 34 | 35 | /**** SPI Setup ****/ 36 | typedef Motate::SPIBus SPIBus_used_t; 37 | extern SPIBus_used_t spiBus; 38 | 39 | typedef SDCard> SDCard_used_t; 40 | extern SDCard_used_t sd_card; 41 | 42 | #endif // BOARD_SPI_H_ONCE 43 | -------------------------------------------------------------------------------- /g2core/board/G2v9/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/g2v9 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | #ifdef BANTAM 54 | MOTATE_SET_USB_VENDOR_STRING( u"Bantam Tools" ) 55 | MOTATE_SET_USB_PRODUCT_STRING( u"Bantam Control Board (g2core)" ) 56 | #else 57 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 58 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 59 | #endif 60 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 61 | #endif // XIO_HAS_USB 62 | 63 | 64 | //******** SPI ******** 65 | #if XIO_HAS_SPI 66 | Motate::SPI spi; 67 | #endif 68 | 69 | 70 | //******** UART ******** 71 | #if XIO_HAS_UART 72 | Motate::UART Serial{ 73 | 115200, Motate::UARTMode::RTSCTSFlowControl}; 74 | #endif 75 | 76 | void board_hardware_init(void) // called 1st 77 | { 78 | #if XIO_HAS_USB 79 | // Init USB 80 | usb.attach(); // USB setup. Runs in "background" as the rest of this executes 81 | usb.checkAndHandleVbusChange(); 82 | #endif // XIO_HAS_USB 83 | } 84 | 85 | 86 | void board_xio_init(void) // called later than board_hardware_init (there are thing in between) 87 | { 88 | // Init SPI 89 | #if XIO_HAS_SPI 90 | // handled internally for now 91 | #endif 92 | 93 | // Init UART 94 | #if XIO_HAS_UART 95 | Serial.init(); 96 | #endif 97 | } 98 | -------------------------------------------------------------------------------- /g2core/board/G2v9/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/g2v9 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | #if USB_SERIAL_PORTS_EXPOSED == 1 41 | typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t; 42 | #endif 43 | #if USB_SERIAL_PORTS_EXPOSED == 2 44 | typedef Motate::USBDevice< Motate::USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 45 | #endif 46 | 47 | extern XIOUSBDevice_t usb; 48 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 51 | #endif 52 | #endif // XIO_HAS_USB 53 | 54 | 55 | //******** SPI ******** 56 | #if XIO_HAS_SPI 57 | #include "MotateSPI.h" 58 | extern Motate::SPI spi; 59 | #endif 60 | 61 | //******** UART ******** 62 | #if XIO_HAS_UART 63 | #include "MotateUART.h" 64 | extern Motate::UART Serial; 65 | #endif 66 | 67 | //******* Generic Functions ******* 68 | void board_hardware_init(void); // called 1st 69 | void board_xio_init(void); // called later 70 | 71 | #endif // board_xio_h 72 | -------------------------------------------------------------------------------- /g2core/board/g2_default.gdb: -------------------------------------------------------------------------------- 1 | # Setup for non-wrapped lines and non-pages prints 2 | set width 0 3 | set height 0 4 | 5 | # Turn on history saving 6 | set history save on 7 | set history expansion on 8 | 9 | set print pretty on 10 | 11 | # monitor adapter_khz 5000 12 | 13 | #define reset 14 | # boot_from_flash 15 | # # for openocd 16 | # # monitor reset init 17 | # # for jlink 18 | # monitor reset 19 | #end 20 | 21 | define flash 22 | make 23 | load 24 | reset 25 | end 26 | 27 | define dump_mb 28 | source ../Resources/debug/mb.gdb 29 | end 30 | -------------------------------------------------------------------------------- /g2core/board/gquadratic.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | #target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | target extended-remote :2331 5 | 6 | # Setup for non-wrapped lines and non-pages prints 7 | set width 0 8 | set height 0 9 | 10 | # Turn on history saving 11 | set history save on 12 | set history expansion on 13 | 14 | set print pretty on 15 | 16 | define reset_deep 17 | monitor reset 18 | 19 | # Reset peripheral (RSTC_CR) 20 | set *0x400E1800 = 0xA5000004 21 | 22 | # # Initializing PC and stack pointer 23 | # mon reg sp = (0x20400000) 24 | # set *0x20400004 = *0x20400004 & 0xFFFFFFFE 25 | # mon reg pc=(0x20400004) 26 | info reg 27 | end 28 | 29 | define flash 30 | make 31 | load 32 | reset 33 | end 34 | 35 | define dump_mb 36 | source ../Resources/debug/mb.gdb 37 | end 38 | 39 | define boot_from_flash 40 | #monitor atsamv gpnvm set 1 41 | end 42 | 43 | source -s arm.gdb 44 | -------------------------------------------------------------------------------- /g2core/board/gquadratic.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=gquadratic-a 7 | 8 | # You can also choose a CONFIG from boards.mk: 9 | # make CONFIG=PrintrbotPlus BOARD=gquadratic-a 10 | 11 | 12 | ########## 13 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 14 | 15 | ifeq ("$(BOARD)","gquadratic-b") 16 | BASE_BOARD=gquadratic 17 | DEVICE_DEFINES += MOTATE_BOARD="gquadratic-b" 18 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 19 | endif 20 | 21 | ifeq ("$(BOARD)","gquadratic-c") 22 | BASE_BOARD=gquadratic 23 | DEVICE_DEFINES += MOTATE_BOARD="gquadratic-c" 24 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 25 | endif 26 | 27 | 28 | ########## 29 | # The general gquadratic BASE_BOARD. 30 | 31 | ifeq ("$(BASE_BOARD)","gquadratic") 32 | _BOARD_FOUND = 1 33 | 34 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 ENABLE_TCM=1 35 | 36 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sams70/*.cpp) $(wildcard ${BOARD_PATH}/*.cpp)) 37 | 38 | CHIP = SAMS70N19 39 | export CHIP 40 | CHIP_LOWERCASE = sams70n19 41 | 42 | BOARD_PATH = ./board/gquadratic 43 | SOURCE_DIRS += ${BOARD_PATH} device/trinamic device/step_dir_hobbyservo device/max31865 device/neopixel device/esc_spindle device/laser_toolhead 44 | 45 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 46 | include $(PLATFORM_BASE).mk 47 | endif 48 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_gpio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * gpio.cpp - digital IO handling functions 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2015 - 2107 Alden S. Hart, Jr. 6 | * Copyright (c) 2015 - 2017 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | /* Switch Modes 29 | * 30 | * The switches are considered to be homing switches when cycle_state is 31 | * CYCLE_HOMING. At all other times they are treated as limit switches: 32 | * - Hitting a homing switch puts the current move into feedhold 33 | * - Hitting a limit switch causes the machine to shut down and go into lockdown until reset 34 | * 35 | * The normally open switch modes (NO) trigger an interrupt on the falling edge 36 | * and lockout subsequent interrupts for the defined lockout period. This approach 37 | * beats doing debouncing as an integration as switches fire immediately. 38 | * 39 | * The normally closed switch modes (NC) trigger an interrupt on the rising edge 40 | * and lockout subsequent interrupts for the defined lockout period. Ditto on the method. 41 | */ 42 | 43 | #include "../../g2core.h" // #1 44 | #include "config.h" // #2 45 | #include "gpio.h" 46 | #include "hardware.h" 47 | #include "canonical_machine.h" 48 | 49 | #include "text_parser.h" 50 | #include "controller.h" 51 | #include "util.h" 52 | #include "report.h" 53 | #include "xio.h" 54 | 55 | #include "MotateTimers.h" 56 | 57 | /**** Setup Actual Objects ****/ 58 | 59 | gpioDigitalInputPin> din1 {DI1_ENABLED, DI1_POLARITY, 1, DI1_EXTERNAL_NUMBER}; 60 | gpioDigitalInputPin> din2 {DI2_ENABLED, DI2_POLARITY, 2, DI2_EXTERNAL_NUMBER}; 61 | gpioDigitalInputPin> din3 {DI3_ENABLED, DI3_POLARITY, 3, DI3_EXTERNAL_NUMBER}; 62 | gpioDigitalInputPin> din4 {DI4_ENABLED, DI4_POLARITY, 4, DI4_EXTERNAL_NUMBER}; 63 | 64 | gpioDigitalOutputPin> dout1 { DO1_ENABLED, DO1_POLARITY, DO1_EXTERNAL_NUMBER, (uint32_t)200000 }; 65 | gpioDigitalOutputPin> dout2 { DO2_ENABLED, DO2_POLARITY, DO2_EXTERNAL_NUMBER, (uint32_t)200000 }; 66 | 67 | /**** Setup Arrays - these are extern and MUST match the board_gpio.h ****/ 68 | 69 | gpioDigitalInput* const d_in[] = {&din1, &din2, &din3, &din4}; 70 | gpioDigitalOutput* const d_out[] = {&dout1, &dout2}; 71 | // not yet used 72 | // gpioAnalogInput* a_in[A_IN_CHANNELS]; 73 | // gpioAnalogOutput* a_out[A_OUT_CHANNELS]; 74 | 75 | /************************************************************************************ 76 | **** CODE ************************************************************************** 77 | ************************************************************************************/ 78 | /* 79 | * gpio_reset() - reset inputs and outputs (no initialization) 80 | */ 81 | 82 | 83 | void outputs_reset(void) { 84 | // nothing to do 85 | } 86 | 87 | void inputs_reset(void) { 88 | // nothing to do 89 | } 90 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gpio.h - Digital IO handling functions 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2015 - 2017 Alden S. Hart, Jr. 6 | * Copyright (c) 2015 - 2017 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | #ifndef BOARD_GPIO_H_ONCE 29 | #define BOARD_GPIO_H_ONCE 30 | 31 | // this file is included from the bottom of gpio.h, but we do this for completeness 32 | #include "../../gpio.h" 33 | 34 | /* 35 | * GPIO defines 36 | */ 37 | //--- change as required for board and switch hardware ---// 38 | 39 | #define D_IN_CHANNELS 4 // number of digital inputs supported 40 | #define D_OUT_CHANNELS 2 // number of digital outputs supported 41 | #define A_IN_CHANNELS 0 // number of analog inputs supported 42 | #define A_OUT_CHANNELS 0 // number of analog outputs supported 43 | 44 | #define INPUT_LOCKOUT_MS 10 // milliseconds to go dead after input firing 45 | 46 | /* 47 | * The GPIO objects themselves - this must match up with board_gpio.cpp! 48 | */ 49 | 50 | extern gpioDigitalInput* const d_in[D_IN_CHANNELS]; 51 | extern gpioDigitalOutput* const d_out[D_OUT_CHANNELS]; 52 | // extern gpioAnalogInput* a_in[A_IN_CHANNELS]; 53 | // extern gpioAnalogOutput* a_out[A_OUT_CHANNELS]; 54 | 55 | // prepare the objects as externs (for config_app to not bloat) 56 | using Motate::IRQPin; 57 | using Motate::PWMOutputPin; 58 | using Motate::PWMLikeOutputPin; 59 | template 60 | using OutputType = typename std::conditional, PWMLikeOutputPin>::type; 61 | 62 | extern gpioDigitalInputPin> din1; 63 | extern gpioDigitalInputPin> din2; 64 | extern gpioDigitalInputPin> din3; 65 | extern gpioDigitalInputPin> din4; 66 | 67 | extern gpioDigitalOutputPin> dout1; 68 | extern gpioDigitalOutputPin> dout2; 69 | 70 | 71 | #endif // End of include guard: BOARD_GPIO_H_ONCE 72 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_stepper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_stepper.cpp - board-specific code for stepper.cpp 3 | * For: /board/gQuadratic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 - 2019 Alden S. Hart, Jr. 7 | * Copyright (c) 2016 - 2019 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "board_stepper.h" 31 | 32 | // These are identical to board_stepper.h, except for the word "extern" 33 | #if QUADRATIC_REVISION == 'B' 34 | HOT_DATA StepDirStepper 41 | motor_1 {}; 42 | 43 | HOT_DATA StepDirStepper 50 | motor_2 {}; 51 | #endif // QUADRATIC_REVISION == 'B' 52 | 53 | #if QUADRATIC_REVISION == 'C' 54 | // Motate::SPIChipSelectPin motor_1_cs; 55 | HOT_DATA Trinamic2130 59 | motor_1 {spiBus, Motate::SPIChipSelectPin{}}; 60 | 61 | // Motate::SPIChipSelectPin motor_2_cs; 62 | HOT_DATA Trinamic2130 66 | motor_2 {spiBus, Motate::SPIChipSelectPin{}}; 67 | #endif // QUADRATIC_REVISION == 'C' 68 | 69 | 70 | HOT_DATA StepDirHobbyServo motor_3; 71 | 72 | 73 | Stepper* const Motors[MOTORS] = {&motor_1, &motor_2, &motor_3}; 74 | 75 | void board_stepper_init() { 76 | for (uint8_t motor = 0; motor < MOTORS; motor++) { Motors[motor]->init(); } 77 | } 78 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_stepper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_stepper.h - board-specific code for stepper.h 3 | * For: /board/gQuadratic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 - 2018 Alden S. Hart, Jr. 7 | * Copyright (c) 2016 - 2018 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | #ifndef BOARD_STEPPER_H_ONCE 30 | #define BOARD_STEPPER_H_ONCE 31 | 32 | #include "hardware.h" // for MOTORS 33 | 34 | #if QUADRATIC_REVISION == 'B' 35 | #include "step_dir_driver.h" 36 | extern StepDirStepper 43 | motor_1; 44 | 45 | extern StepDirStepper 52 | motor_2; 53 | #endif // QUADRATIC_REVISION == 'B' 54 | 55 | #if QUADRATIC_REVISION == 'C' 56 | #include "tmc2130.h" 57 | extern Trinamic2130 61 | motor_1; 62 | extern Trinamic2130 66 | motor_2; 67 | #endif // QUADRATIC_REVISION == 'C' 68 | 69 | #include "step_dir_hobbyservo.h" 70 | extern StepDirHobbyServo motor_3; 71 | 72 | extern Stepper* const Motors[MOTORS]; 73 | 74 | void board_stepper_init(); 75 | 76 | #endif // BOARD_STEPPER_H_ONCE 77 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/gQuadratic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | //******** SPI ******** 60 | #if XIO_HAS_SPI 61 | Motate::SPI spi; 62 | #endif 63 | 64 | 65 | //******** UART ******** 66 | #if XIO_HAS_UART 67 | Motate::UART Serial {115200, Motate::UARTMode::RTSCTSFlowControl}; 68 | #endif 69 | 70 | void board_hardware_init(void) // called 1st 71 | { 72 | #if XIO_HAS_USB 73 | // Init USB 74 | usb.attach(); 75 | usb.handleVbusChange(/*force:*/ true); 76 | #endif // XIO_HAS_USB 77 | } 78 | 79 | 80 | void board_xio_init(void) // called later than board_hardware_init (there are thing in between) 81 | { 82 | // Init SPI 83 | #if XIO_HAS_SPI 84 | // handled internally for now 85 | #endif 86 | 87 | // Init UART 88 | #if XIO_HAS_UART 89 | Serial.init(); 90 | #endif 91 | } 92 | -------------------------------------------------------------------------------- /g2core/board/gquadratic/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/gQuadratic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | typedef Motate::USBDeviceHardwareVBus> USBDeviceHardware_t; 41 | 42 | #if USB_SERIAL_PORTS_EXPOSED == 1 43 | typedef Motate::USBDevice< USBDeviceHardware_t, Motate::USBCDC > XIOUSBDevice_t; 44 | #endif 45 | #if USB_SERIAL_PORTS_EXPOSED == 2 46 | typedef Motate::USBDevice< USBDeviceHardware_t, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 47 | #endif 48 | 49 | extern XIOUSBDevice_t usb; 50 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 51 | #if USB_SERIAL_PORTS_EXPOSED == 2 52 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 53 | #endif 54 | #endif // XIO_HAS_USB 55 | 56 | 57 | //******** SPI ******** 58 | #if XIO_HAS_SPI 59 | #include "MotateSPI.h" 60 | extern Motate::SPI spi; 61 | #endif 62 | 63 | //******** UART ******** 64 | #if XIO_HAS_UART 65 | #include "MotateUART.h" 66 | extern Motate::UART Serial; 67 | #endif 68 | 69 | //******* Generic Functions ******* 70 | void board_hardware_init(void); // called 1st 71 | void board_xio_init(void); // called later 72 | 73 | #endif // board_xio_h 74 | -------------------------------------------------------------------------------- /g2core/board/gquintic.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | #target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | target extended-remote :2331 5 | 6 | # Setup for non-wrapped lines and non-pages prints 7 | set width 0 8 | set height 0 9 | 10 | # Turn on history saving 11 | set history save on 12 | set history expansion on 13 | 14 | set print pretty on 15 | 16 | define reset_deep 17 | monitor reset 18 | 19 | # Reset peripheral (RSTC_CR) 20 | set *0x400E1800 = 0xA5000004 21 | 22 | # # Initializing PC and stack pointer 23 | # mon reg sp = (0x20400000) 24 | # set *0x20400004 = *0x20400004 & 0xFFFFFFFE 25 | # mon reg pc=(0x20400004) 26 | info reg 27 | end 28 | 29 | define flash 30 | make 31 | load 32 | reset 33 | end 34 | 35 | define dump_mb 36 | source ../Resources/debug/mb.gdb 37 | end 38 | 39 | define boot_from_flash 40 | #monitor atsamv gpnvm set 1 41 | end 42 | 43 | source -s arm.gdb 44 | -------------------------------------------------------------------------------- /g2core/board/gquintic.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=gquintic-a 7 | 8 | # You can also choose a CONFIG from boards.mk: 9 | # make CONFIG=PrintrbotPlus BOARD=gquintic-b 10 | 11 | 12 | ########## 13 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 14 | 15 | ifeq ("$(BOARD)","gquintic-b") 16 | BASE_BOARD=gquintic 17 | DEVICE_DEFINES += MOTATE_BOARD="gquintic-b" 18 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 19 | endif 20 | 21 | ifeq ("$(BOARD)","gquintic-c") 22 | BASE_BOARD=gquintic 23 | DEVICE_DEFINES += MOTATE_BOARD="gquintic-c" 24 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 25 | endif 26 | 27 | ifeq ("$(BOARD)","gquintic-d") 28 | BASE_BOARD=gquintic 29 | DEVICE_DEFINES += MOTATE_BOARD="gquintic-d" 30 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 31 | endif 32 | 33 | ifeq ("$(BOARD)","gquintic-g") 34 | BASE_BOARD=gquintic 35 | QUINTIC_N20=1 36 | DEVICE_DEFINES += MOTATE_BOARD="gquintic-d" 37 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 38 | endif 39 | 40 | ########## 41 | # The general gquintic BASE_BOARD. 42 | # NOTE: rev a is no longer supported! 43 | 44 | ifeq ("$(BASE_BOARD)","gquintic") 45 | _BOARD_FOUND = 1 46 | 47 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 ENABLE_TCM=1 48 | 49 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sams70/*.cpp) $(wildcard ${BOARD_PATH}/*.cpp)) 50 | 51 | ifeq ("$(QUINTIC_N20)","1") 52 | CHIP = SAMS70N20 53 | export CHIP 54 | CHIP_LOWERCASE = sams70n20 55 | DEVICE_DEFINES += QUINTIC_N20=1 56 | else 57 | CHIP = SAMS70N19 58 | export CHIP 59 | CHIP_LOWERCASE = sams70n19 60 | endif 61 | 62 | BOARD_PATH = ./board/gquintic 63 | SOURCE_DIRS += ${BOARD_PATH} device/trinamic device/step_dir_hobbyservo device/max31865 device/i2c_eeprom device/i2c_multiplexer device/i2c_as5601 device/esc_spindle device/laser_toolhead device/bme280 device/honeywell-trustability-ssc 64 | 65 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 66 | include $(PLATFORM_BASE).mk 67 | endif 68 | -------------------------------------------------------------------------------- /g2core/board/gquintic/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/gQuintic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | HOT_DATA XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | //******** SPI ******** 60 | #if XIO_HAS_SPI 61 | HOT_DATA Motate::SPI spi; 62 | #endif 63 | 64 | 65 | //******** UART ******** 66 | #if XIO_HAS_UART 67 | HOT_DATA Motate::UART Serial {115200, Motate::UARTMode::RTSCTSFlowControl}; 68 | #endif 69 | 70 | void board_hardware_init(void) // called 1st 71 | { 72 | #if XIO_HAS_USB 73 | // Init USB 74 | usb.attach(); 75 | usb.handleVbusChange(true); 76 | #endif // XIO_HAS_USB 77 | } 78 | 79 | 80 | void board_xio_init(void) // called later than board_hardware_init (there are things in between) 81 | { 82 | // Init SPI 83 | #if XIO_HAS_SPI 84 | // handled internally for now 85 | #endif 86 | 87 | // Init UART 88 | #if XIO_HAS_UART 89 | Serial.init(); 90 | #endif 91 | } 92 | -------------------------------------------------------------------------------- /g2core/board/gquintic/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/gQuintic 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | typedef Motate::USBDeviceHardwareVBus> USBDeviceHardware_t; 41 | 42 | #if USB_SERIAL_PORTS_EXPOSED == 1 43 | typedef Motate::USBDevice< USBDeviceHardware_t, Motate::USBCDC > XIOUSBDevice_t; 44 | #endif 45 | #if USB_SERIAL_PORTS_EXPOSED == 2 46 | typedef Motate::USBDevice< USBDeviceHardware_t, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 47 | #endif 48 | 49 | extern XIOUSBDevice_t usb; 50 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 51 | #if USB_SERIAL_PORTS_EXPOSED == 2 52 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 53 | #endif 54 | #endif // XIO_HAS_USB 55 | 56 | 57 | //******** SPI ******** 58 | #if XIO_HAS_SPI 59 | #include "MotateSPI.h" 60 | extern Motate::SPI spi; 61 | #endif 62 | 63 | //******** UART ******** 64 | #if XIO_HAS_UART 65 | #include "MotateUART.h" 66 | extern Motate::UART Serial; 67 | #endif 68 | 69 | //******* Generic Functions ******* 70 | void board_hardware_init(void); // called 1st 71 | void board_xio_init(void); // called later 72 | 73 | #endif // board_xio_h 74 | -------------------------------------------------------------------------------- /g2core/board/printrboardg2.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | #target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | target extended-remote :2331 5 | 6 | source ./board/g2_default.gdb 7 | 8 | define boot_from_flash 9 | monitor at91sam3 gpnvm set 1 10 | end 11 | 12 | source -s arm.gdb 13 | -------------------------------------------------------------------------------- /g2core/board/printrboardg2.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=printrboardG2v3 7 | 8 | # You can also choose a CONFIG from boards.mk: 9 | # make CONFIG=PrintrbotPlus BOARD=printrboardG2v3 10 | 11 | 12 | ########## 13 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 14 | 15 | ifeq ("$(BOARD)","printrboardG2v3") 16 | BASE_BOARD=printrboardg2 17 | DEVICE_DEFINES += MOTATE_BOARD="printrboardG2v3" 18 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 19 | endif 20 | 21 | ########## 22 | # The general pboard-a BASE_BOARD. 23 | 24 | ifeq ("$(BASE_BOARD)","printrboardg2") 25 | _BOARD_FOUND = 1 26 | 27 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 28 | 29 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) 30 | 31 | CHIP = SAM3X8C 32 | export CHIP 33 | CHIP_LOWERCASE = sam3x8c 34 | 35 | BOARD_PATH = ./board/printrboardg2 36 | SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver device/neopixel 37 | 38 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 39 | include $(PLATFORM_BASE).mk 40 | endif 41 | -------------------------------------------------------------------------------- /g2core/board/printrboardg2/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/printrboardg2 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | //******** SPI ******** 60 | #if XIO_HAS_SPI 61 | Motate::SPI spi; 62 | #endif 63 | 64 | 65 | //******** UART ******** 66 | #if XIO_HAS_UART 67 | Motate::UART Serial {115200, Motate::UARTMode::RTSCTSFlowControl}; 68 | #endif 69 | 70 | void board_hardware_init(void) // called 1st 71 | { 72 | #if XIO_HAS_USB 73 | // Init USB 74 | usb.attach(); 75 | #endif // XIO_HAS_USB 76 | } 77 | 78 | 79 | auto startup_file = make_xio_flash_file(""); 80 | 81 | void board_xio_init(void) // called later than board_hardware_init (there are things in between) 82 | { 83 | // Init SPI 84 | #if XIO_HAS_SPI 85 | // handled internally for now 86 | #endif 87 | 88 | // Init UART 89 | #if XIO_HAS_UART 90 | Serial.init(); 91 | #endif 92 | 93 | xio_send_file(startup_file); 94 | } 95 | -------------------------------------------------------------------------------- /g2core/board/printrboardg2/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/printrboardg2 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | #include "xio.h" 35 | 36 | //******** USB ******** 37 | #if XIO_HAS_USB 38 | #include "MotateUSB.h" 39 | #include "MotateUSBCDC.h" 40 | 41 | #if USB_SERIAL_PORTS_EXPOSED == 1 42 | typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC > XIOUSBDevice_t; 43 | #endif 44 | #if USB_SERIAL_PORTS_EXPOSED == 2 45 | typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 46 | #endif 47 | 48 | extern XIOUSBDevice_t usb; 49 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 50 | #if USB_SERIAL_PORTS_EXPOSED == 2 51 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 52 | #endif 53 | #endif // XIO_HAS_USB 54 | 55 | //******** SPI ******** 56 | #if XIO_HAS_SPI 57 | #include "MotateSPI.h" 58 | extern Motate::SPI spi; 59 | #endif 60 | 61 | //******** UART ******** 62 | #if XIO_HAS_UART 63 | #include "MotateUART.h" 64 | extern Motate::UART Serial; 65 | #endif 66 | 67 | //******* Generic Functions ******* 68 | void board_hardware_init(void); // called 1st 69 | void board_xio_init(void); // called later 70 | 71 | #endif // board_xio_h 72 | -------------------------------------------------------------------------------- /g2core/board/sbv300.gdb: -------------------------------------------------------------------------------- 1 | # Open and connect to openocd with the ATMEL-ICE 2 | target remote | /usr/local/bin/openocd -c "set CHIPNAME ${CHIP}" -f ${MOTATE_PATH}/openocd.cfg -f ${MOTATE_PATH}/platform/atmel_sam/atmel_sam.cfg -c "gdb_port pipe; log_output openocd.log" 3 | 4 | source ./board/g2_default.gdb 5 | 6 | define boot_from_flash 7 | monitor at91sam3 gpnvm set 1 8 | end 9 | 10 | source -s arm.gdb 11 | -------------------------------------------------------------------------------- /g2core/board/sbv300.mk: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # This file is part of the Synthetos g2core project 3 | 4 | 5 | # To compile: 6 | # make BOARD=sbv300 7 | 8 | # You can also choose a CONFIG from boards.mk: 9 | # make CONFIG=sbv300 10 | 11 | 12 | 13 | # Backward compatibility with old projects that use PLATFORM instead, but with a warning: 14 | ifneq ("$(PLATFORM:-)","") 15 | $(warning Using PLATFORM value of $(PLATFORM) as BOARD.) 16 | $(warning Please swich to using BOARD on the command line.) 17 | BOARD = $(PLATFORM) 18 | endif 19 | 20 | 21 | ########## 22 | # BOARDs for use directly from the make command line (with default settings) or by CONFIGs. 23 | 24 | ifeq ("$(BOARD)","sbv300") 25 | BASE_BOARD = sbv300 26 | DEVICE_DEFINES += MOTATE_BOARD="sbv300" 27 | DEVICE_DEFINES += SETTINGS_FILE=${SETTINGS_FILE} 28 | endif 29 | 30 | 31 | 32 | ########## 33 | # The general g2core-due BASE_BOARD. 34 | 35 | ifeq ("$(BASE_BOARD)","sbv300") 36 | _BOARD_FOUND = 1 37 | 38 | DEVICE_DEFINES += MOTATE_CONFIG_HAS_USBSERIAL=1 39 | 40 | FIRST_LINK_SOURCES += $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam_common/*.cpp)) $(sort $(wildcard ${MOTATE_PATH}/Atmel_sam3x/*.cpp)) 41 | 42 | CHIP = SAM3X8E 43 | export CHIP 44 | CHIP_LOWERCASE = sam3x8e 45 | 46 | BOARD_PATH = ./board/sbv300 47 | SOURCE_DIRS += ${BOARD_PATH} device/step_dir_driver 48 | 49 | PLATFORM_BASE = ${MOTATE_PATH}/platform/atmel_sam 50 | 51 | include $(PLATFORM_BASE).mk 52 | endif 53 | -------------------------------------------------------------------------------- /g2core/board/sbv300/board_xio.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.cpp - extended IO functions that are board-specific 3 | * For: /board/sbv300 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #include "g2core.h" 31 | #include "config.h" 32 | #include "hardware.h" 33 | #include "board_xio.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | const Motate::USBSettings_t Motate::USBSettings = { 38 | /*gVendorID = */ 0x1d50, 39 | /*gProductID = */ 0x606d, 40 | /*gProductVersion = */ G2CORE_FIRMWARE_VERSION, 41 | /*gAttributes = */ kUSBConfigAttributeSelfPowered, 42 | /*gPowerConsumption = */ 500 43 | }; 44 | /*gProductVersion = */ //0.1, 45 | 46 | XIOUSBDevice_t usb; 47 | 48 | decltype(usb.mixin<0>::Serial) &SerialUSB = usb.mixin<0>::Serial; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | decltype(usb.mixin<1>::Serial) &SerialUSB1 = usb.mixin<1>::Serial; 51 | #endif 52 | 53 | MOTATE_SET_USB_VENDOR_STRING( u"Synthetos" ) 54 | MOTATE_SET_USB_PRODUCT_STRING( u"TinyG v2" ) 55 | MOTATE_SET_USB_SERIAL_NUMBER_STRING_FROM_CHIPID() 56 | #endif // XIO_HAS_USB 57 | 58 | 59 | //******** SPI ******** 60 | #if XIO_HAS_SPI 61 | Motate::SPI spi; 62 | #endif 63 | 64 | 65 | //******** UART ******** 66 | #if XIO_HAS_UART 67 | Motate::UART Serial {115200, Motate::UARTMode::RTSCTSFlowControl}; 68 | #endif 69 | 70 | void board_hardware_init(void) // called 1st 71 | { 72 | #if XIO_HAS_USB 73 | // Init USB 74 | usb.attach(); 75 | #endif // XIO_HAS_USB 76 | } 77 | 78 | 79 | void board_xio_init(void) // called later than board_hardware_init (there are thing in between) 80 | { 81 | // Init SPI 82 | #if XIO_HAS_SPI 83 | // handled internally for now 84 | #endif 85 | 86 | // Init UART 87 | #if XIO_HAS_UART 88 | Serial.init(); 89 | #endif 90 | } 91 | -------------------------------------------------------------------------------- /g2core/board/sbv300/board_xio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * board_xio.h - extended IO functions that are board-specific 3 | * For: /board/sbv300 4 | * This file is part of the g2core project 5 | * 6 | * Copyright (c) 2016 Alden S. Hart Jr. 7 | * Copyright (c) 2016 Robert Giseburt 8 | * 9 | * This file ("the software") is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License, version 2 as published by the 11 | * Free Software Foundation. You should have received a copy of the GNU General Public 12 | * License, version 2 along with the software. If not, see . 13 | * 14 | * As a special exception, you may use this file as part of a software library without 15 | * restriction. Specifically, if other files instantiate templates or use macros or 16 | * inline functions from this file, or you compile this file and link it with other 17 | * files to produce an executable, this file does not by itself cause the resulting 18 | * executable to be covered by the GNU General Public License. This exception does not 19 | * however invalidate any other reasons why the executable file might be covered by the 20 | * GNU General Public License. 21 | * 22 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 23 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 25 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 27 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #ifndef board_xio_h 31 | #define board_xio_h 32 | 33 | #include "settings.h" 34 | 35 | //******** USB ******** 36 | #if XIO_HAS_USB 37 | #include "MotateUSB.h" 38 | #include "MotateUSBCDC.h" 39 | 40 | #if USB_SERIAL_PORTS_EXPOSED == 1 41 | typedef Motate::USBDevice< USBDeviceHardware, , Motate::USBCDC > XIOUSBDevice_t; 42 | #endif 43 | #if USB_SERIAL_PORTS_EXPOSED == 2 44 | typedef Motate::USBDevice< USBDeviceHardware, Motate::USBCDC, Motate::USBCDC > XIOUSBDevice_t; 45 | #endif 46 | 47 | extern XIOUSBDevice_t usb; 48 | extern decltype(usb.mixin<0>::Serial)& SerialUSB; 49 | #if USB_SERIAL_PORTS_EXPOSED == 2 50 | extern decltype(usb.mixin<1>::Serial)& SerialUSB1; 51 | #endif 52 | #endif // XIO_HAS_USB 53 | 54 | //******** SPI ******** 55 | #if XIO_HAS_SPI 56 | #include "MotateSPI.h" 57 | extern Motate::SPI spi; 58 | #endif 59 | 60 | //******** UART ******** 61 | #if XIO_HAS_UART 62 | #include "MotateUART.h" 63 | extern Motate::UART Serial; 64 | #endif 65 | 66 | //******* Generic Functions ******* 67 | void board_hardware_init(void); // called 1st 68 | void board_xio_init(void); // called later 69 | 70 | #endif // board_xio_h 71 | -------------------------------------------------------------------------------- /g2core/config_app.h: -------------------------------------------------------------------------------- 1 | /* 2 | * config_app.h - application-specific part of configuration sub-system 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2018 Alden S. Hart, Jr. 6 | * Copyright (c) 2013 - 2018 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 14 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 16 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 18 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | */ 20 | 21 | #ifndef CONFIG_APP_H_ONCE 22 | #define CONFIG_APP_H_ONCE 23 | 24 | /*********************************************************************************** 25 | **** APPLICATION_SPECIFIC DEFINITIONS AND SETTINGS ******************************** 26 | ***********************************************************************************/ 27 | 28 | typedef enum { // classification of commands 29 | NV_TYPE_NULL = 0, 30 | NV_TYPE_CONFIG, // configuration commands 31 | NV_TYPE_GCODE, // gcode 32 | NV_TYPE_REPORT, // SR, QR and any other report 33 | NV_TYPE_MESSAGE, // nv object carries a message 34 | NV_TYPE_LINENUM // nv object carries a gcode line number 35 | } nvType; 36 | 37 | /*********************************************************************************** 38 | **** APPLICATION_SPECIFIC CONFIG STRUCTURE(S) ************************************* 39 | ***********************************************************************************/ 40 | 41 | typedef struct cfgParameters { // mostly communications variables at this point 42 | uint16_t magic_start; // magic number to test memory integrity 43 | 44 | // Job ID 45 | int32_t job_id[4]; // uuid to identify the job 46 | 47 | #ifdef __USER_DATA 48 | // user-defined data groups 49 | uint32_t user_data_a[4]; 50 | uint32_t user_data_b[4]; 51 | uint32_t user_data_c[4]; 52 | uint32_t user_data_d[4]; 53 | #endif 54 | 55 | // installed fixturing information 56 | float fx_coords_a[4][2]; // x/y coordinates of up to 4 points on fixturing object 57 | float fx_state_a; // state flag 58 | 59 | uint32_t mark; // just a rtransient value to return when asked 60 | 61 | uint16_t magic_end; 62 | } cfgParameters_t; 63 | extern cfgParameters_t cfg; 64 | 65 | /*********************************************************************************** 66 | * CONFIGURATION AND INTERFACE FUNCTIONS 67 | * Functions to get and set variables from the cfgArray table 68 | ***********************************************************************************/ 69 | 70 | stat_t set_baud_callback(void); 71 | 72 | // job config 73 | void job_print_job(nvObj_t* nv); 74 | stat_t job_get(nvObj_t* nv); 75 | stat_t job_set(nvObj_t* nv); 76 | uint8_t job_report_callback(); 77 | 78 | /*********************************************************************************** 79 | * TEXT MODE SUPPORT 80 | * Functions to print variables from the cfgArray table 81 | ***********************************************************************************/ 82 | 83 | #ifdef __TEXT_MODE 84 | 85 | void cfg_print_ec(nvObj_t* nv); 86 | void cfg_print_ee(nvObj_t* nv); 87 | void cfg_print_ex(nvObj_t* nv); 88 | void cfg_print_ew(nvObj_t* nv); 89 | void cfg_print_baud(nvObj_t* nv); 90 | void cfg_print_net(nvObj_t* nv); 91 | void cfg_print_rx(nvObj_t* nv); 92 | 93 | #else 94 | 95 | #define cfg_print_ec tx_print_stub 96 | #define cfg_print_ee tx_print_stub 97 | #define cfg_print_ex tx_print_stub 98 | #define cfg_print_ew tx_print_stub 99 | #define cfg_print_baud tx_print_stub 100 | #define cfg_print_net tx_print_stub 101 | #define cfg_print_rx tx_print_stub 102 | 103 | #endif // __TEXT_MODE 104 | 105 | #endif // End of include guard: CONFIG_APP_H_ONCE 106 | -------------------------------------------------------------------------------- /g2core/device/laser_toolhead/laser_toolhead.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * laser_toolhead.cpp - toolhead driver for a laser, controlled by spindle commands 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2020 Robert Giseburt 6 | * Copyright (c) 2020 Alden S. Hart, Jr. 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | // #include 30 | // #include "laser_toolhead.h" 31 | 32 | 33 | -------------------------------------------------------------------------------- /g2core/device/sd_card/sd_persistence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * sd_persistence.h - persistence code for SD cards 3 | * This file is part of the g2code project 4 | * 5 | * Copyright (c) 2019 Matt Staniszewski 6 | * Copyright (c) 2019 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef SD_PERSISTENCE_H_ONCE 30 | #define SD_PERSISTENCE_H_ONCE 31 | 32 | void setup_sd_persistence(); 33 | 34 | #endif // End of include guard: SD_PERSISTENCE_H_ONCE 35 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 G2V9k.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 V9 Shapeoko Dual-Y.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 gQuadratic AxiDrawv3.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 gQuadratic SMW3d r7.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 gQuadratic Test.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 gQuintic PrintrbotPlus.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 gShield.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 printrboardG2v3 PrintrbotPlus.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core.xcodeproj/xcshareddata/xcschemes/G2 sbv300.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 65 | 66 | 72 | 73 | 74 | 75 | 77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /g2core/g2core_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * g2core_info.h - g2core build information 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2018 Alden S. Hart, Jr. 6 | * Copyright (c) 2010 - 2018 Robert Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 14 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 16 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 18 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | */ 20 | 21 | #ifndef G2CORE_INFO_H_ONCE 22 | #define G2CORE_INFO_H_ONCE 23 | 24 | #define G2CORE_FIRMWARE_BUILD 101.06 // PRIVATE BUILD 25 | #define G2CORE_FIRMWARE_VERSION 0.99 26 | 27 | #ifdef GIT_VERSION 28 | #define G2CORE_FIRMWARE_BUILD_STRING GIT_VERSION 29 | #else 30 | #define G2CORE_FIRMWARE_BUILD_STRING "unknown" 31 | #endif 32 | 33 | #endif // G2CORE_INFO_H_ONCE 34 | -------------------------------------------------------------------------------- /g2core/gcode_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * gcode_parser.h - rs274/ngc Gcode parser 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2017 Alden S. Hart, Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 13 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 14 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 15 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 17 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #ifndef GCODE_H_ONCE 21 | #define GCODE_H_ONCE 22 | 23 | /* 24 | * Global Scope Functions 25 | */ 26 | stat_t gcode_parser(char* block); 27 | stat_t gc_get_gc(nvObj_t* nv); 28 | stat_t gc_run_gc(nvObj_t* nv); 29 | 30 | #endif // End of include guard: GCODE_H_ONCE 31 | -------------------------------------------------------------------------------- /g2core/help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * help.h - collected help and assorted display routines 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2018 Alden S. Hart, Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 13 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 14 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 15 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 17 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #ifndef HELP_H_ONCE 21 | #define HELP_H_ONCE 22 | 23 | #if defined(__TEXT_MODE) && defined(__HELP_SCREENS) 24 | 25 | stat_t help_general(nvObj_t* nv); 26 | stat_t help_config(nvObj_t* nv); 27 | stat_t help_test(nvObj_t* nv); 28 | stat_t help_defa(nvObj_t* nv); 29 | stat_t help_flash(nvObj_t* nv); 30 | 31 | #else 32 | 33 | stat_t help_stub(nvObj_t* nv); 34 | #define help_general help_stub 35 | #define help_config help_stub 36 | #define help_test help_stub 37 | #define help_defa help_stub 38 | #define help_flash help_stub 39 | 40 | #endif 41 | 42 | #endif // End of include guard: HELP_H_ONCE 43 | -------------------------------------------------------------------------------- /g2core/jlink.config: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | MonModeVTableAddr = 0xFFFFFFFF 11 | MonModeDebug = 0 12 | MaxNumAPs = 0 13 | LowPowerHandlingMode = 0 14 | OverrideMemMap = 0 15 | AllowSimulation = 1 16 | ScriptFile="" 17 | [FLASH] 18 | CacheExcludeSize = 0x00 19 | CacheExcludeAddr = 0x00 20 | MinNumBytesFlashDL = 0 21 | SkipProgOnCRCMatch = 1 22 | VerifyDownload = 1 23 | AllowCaching = 1 24 | EnableFlashDL = 2 25 | Override = 0 26 | Device="ARM7" 27 | [GENERAL] 28 | WorkRAMSize = 0x00 29 | WorkRAMAddr = 0x00 30 | RAMUsageLimit = 0x00 31 | [SWO] 32 | SWOLogFile="" 33 | [MEM] 34 | RdOverrideOrMask = 0x00 35 | RdOverrideAndMask = 0xFFFFFFFF 36 | RdOverrideAddr = 0xFFFFFFFF 37 | WrOverrideOrMask = 0x00 38 | WrOverrideAndMask = 0xFFFFFFFF 39 | WrOverrideAddr = 0xFFFFFFFF 40 | -------------------------------------------------------------------------------- /g2core/marlin_compatibility.h: -------------------------------------------------------------------------------- 1 | /* 2 | * marlin_compatibility.cpp - support for marlin protocol and gcode 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2017 - 2018 Alden S. Hart, Jr. 6 | * Copyright (c) 2017 - 2018 Rob Giseburt 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 14 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 16 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 18 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | */ 20 | 21 | #ifndef MARLIN_COMPAT_H_ONCE 22 | #define MARLIN_COMPAT_H_ONCE 23 | 24 | #include "g2core.h" // #1 25 | #include "config.h" // #2 26 | 27 | enum cmExtruderMode { 28 | EXTRUDER_MOVES_NORMAL = 0, // M82 29 | EXTRUDER_MOVES_RELATIVE, // M83 30 | EXTRUDER_MOVES_VOLUMETRIC // Ultimaker2Marlin 31 | }; 32 | 33 | typedef struct MarlinStateExtended { // Canonical machine extensions for Marlin 34 | bool marlin_flavor; // true if we are parsing gcode as Marlin-flavor 35 | cmExtruderMode extruder_mode; // Mode of the extruder - changes how "E" is interpreted 36 | } MarlinStateExtended_t; 37 | 38 | extern MarlinStateExtended_t mst; // Marlin state object 39 | 40 | /* 41 | * Global Scope Functions 42 | */ 43 | 44 | // *** gcode and Mcode handling *** 45 | 46 | stat_t marlin_start_tramming_bed(); // G29 47 | 48 | stat_t marlin_list_sd_response(); // M20 49 | stat_t marlin_select_sd_response(const char *file); // M23 50 | stat_t marlin_set_extruder_mode(const uint8_t mode); // M82, M82 51 | stat_t marlin_disable_motors(); // M84 52 | stat_t marlin_set_motor_timeout(float s); // M84 Sxxx, M85 Sxxx, M18 Sxxx 53 | 54 | stat_t marlin_set_temperature(uint8_t tool, float temperature, bool wait); // M104, M109, M140, M190 55 | stat_t marlin_request_temperature_report(); // M105 56 | stat_t marlin_set_fan_speed(const uint8_t fan, float speed); // M106, M107 57 | 58 | stat_t marlin_request_position_report(); // M114 59 | stat_t marlin_report_version(); // M115 60 | 61 | // *** Marlin internal functions *** 62 | 63 | stat_t marlin_callback(); // controller loop callback 64 | void marlin_response(const stat_t status, char *buf); // response handler (primarily just prints "ok") 65 | bool marlin_handle_fake_stk500(char *str); // fake stk500v2 66 | 67 | 68 | #endif // End of include guard: MARLIN_COMPAT_H_ONCE 69 | -------------------------------------------------------------------------------- /g2core/openocd.cfg.example: -------------------------------------------------------------------------------- 1 | # This file need modified in order to debug with OpenOCD 2 | 3 | # Keep the following two lines as-is for connection to GDB 4 | gdb_port pipe 5 | log_output openocd.log 6 | 7 | 8 | # Uncomment the correct interface below for your adapter: 9 | 10 | # For an Atmel ICE, or any other CMSIS-DAP device: 11 | #source [find interface/cmsis-dap.cfg] 12 | 13 | # For a JLink (or compatible) device: 14 | #source [find interface/jlink.cfg] 15 | -------------------------------------------------------------------------------- /g2core/persistence.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * persistence.cpp - persistence functions 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2013 - 2018 Alden S. Hart Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * As a special exception, you may use this file as part of a software library without 13 | * restriction. Specifically, if other files instantiate templates or use macros or 14 | * inline functions from this file, or you compile this file and link it with other 15 | * files to produce an executable, this file does not by itself cause the resulting 16 | * executable to be covered by the GNU General Public License. This exception does not 17 | * however invalidate any other reasons why the executable file might be covered by the 18 | * GNU General Public License. 19 | * 20 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 21 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | #include "g2core.h" 28 | #include "persistence.h" 29 | 30 | /*********************************************************************************** 31 | **** GENERIC STATIC FUNCTIONS AND VARIABLES *************************************** 32 | ***********************************************************************************/ 33 | 34 | Persistence *persistence = nullptr; 35 | 36 | void persistence_init() 37 | { 38 | if (persistence == nullptr) { 39 | return; 40 | } 41 | persistence->init(); 42 | } 43 | 44 | /* 45 | * read_persistent_value() - return value (as float) by index 46 | * 47 | * It's the responsibility of the caller to make sure the index does not exceed range 48 | */ 49 | 50 | stat_t read_persistent_value(nvObj_t *nv) 51 | { 52 | if (persistence == nullptr) { 53 | return (STAT_OK); // it worked! ;-) 54 | } 55 | 56 | return persistence->read(nv); 57 | } 58 | 59 | /* 60 | * write_persistent_value() - write to NVM by index, but only if the value has changed 61 | * 62 | * It's the responsibility of the caller to make sure the index does not exceed range 63 | * Note: Removed NAN and INF checks on floats - not needed 64 | */ 65 | 66 | stat_t write_persistent_value(nvObj_t *nv) 67 | { 68 | if (persistence == nullptr) { 69 | return (STAT_OK); // it worked! ;-) 70 | } 71 | 72 | return persistence->write(nv); 73 | } 74 | 75 | /* 76 | * write_persistent_values_callback() 77 | */ 78 | 79 | stat_t write_persistent_values_callback() 80 | { 81 | if (persistence == nullptr) { 82 | return (STAT_OK); // it worked! ;-) 83 | } 84 | 85 | return persistence->periodic(); 86 | 87 | } 88 | -------------------------------------------------------------------------------- /g2core/persistence.h: -------------------------------------------------------------------------------- 1 | /* 2 | * persistence.h - persistence code 3 | * This file is part of the g2code project 4 | * 5 | * Copyright (c) 2013 - 2018 Alden S. Hart Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * As a special exception, you may use this file as part of a software library without 13 | * restriction. Specifically, if other files instantiate templates or use macros or 14 | * inline functions from this file, or you compile this file and link it with other 15 | * files to produce an executable, this file does not by itself cause the resulting 16 | * executable to be covered by the GNU General Public License. This exception does not 17 | * however invalidate any other reasons why the executable file might be covered by the 18 | * GNU General Public License. 19 | * 20 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 21 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PERSISTENCE_H_ONCE 29 | #define PERSISTENCE_H_ONCE 30 | 31 | #include "config.h" // needed for nvObj_t definition 32 | 33 | //**** persistence function prototypes **** 34 | 35 | class Persistence { 36 | public: 37 | virtual void init(); 38 | virtual stat_t read(nvObj_t *nv); 39 | virtual stat_t write(nvObj_t *nv); 40 | virtual stat_t periodic(); 41 | }; 42 | 43 | extern Persistence *persistence; 44 | 45 | void persistence_init(void); 46 | stat_t read_persistent_value(nvObj_t *nv); 47 | stat_t write_persistent_value(nvObj_t *nv); 48 | stat_t write_persistent_values_callback(); 49 | 50 | #endif // End of include guard: PERSISTENCE_H_ONCE 51 | // 52 | -------------------------------------------------------------------------------- /g2core/plan_arc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * plan_arc.h - arc planning and motion execution 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2018 Alden S. Hart, Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 13 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 14 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 15 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 17 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | */ 19 | 20 | #ifndef PLAN_ARC_H_ONCE 21 | #define PLAN_ARC_H_ONCE 22 | 23 | #define MIN_ARC_RADIUS ((float)0.1) // min radius that can be executed 24 | #define MIN_ARC_SEGMENT_LENGTH ((float)0.05) // Arc segment size (mm).(0.03) 25 | #define MIN_ARC_SEGMENT_USEC ((float)10000) // minimum arc segment time 26 | 27 | // Arc radius tests. See http://linuxcnc.org/docs/html/gcode/gcode.html#sec:G2-G3-Arc 28 | //#define ARC_RADIUS_ERROR_MAX ((float)0.5) // max allowable mm between start and end radius 29 | #define ARC_RADIUS_ERROR_MAX ((float)1.0) // max allowable mm between start and end radius 30 | #define ARC_RADIUS_ERROR_MIN ((float)0.005) // min mm where 1% rule applies 31 | #define ARC_RADIUS_TOLERANCE ((float)0.001) // 0.1% radius variance test 32 | 33 | #define CHORDAL_TOLERANCE_MIN (0.001) // values below this are not accepted 34 | 35 | /* arc function prototypes */ 36 | 37 | void cm_arc_init(cmMachine_t *_cm); 38 | void cm_abort_arc(cmMachine_t *_cm); 39 | stat_t cm_arc_callback(cmMachine_t *_cm); 40 | 41 | #endif // End of include guard: PLAN_ARC_H_ONCE 42 | -------------------------------------------------------------------------------- /g2core/pwm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pwm.h - pulse width modulation drivers 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2012 - 2018 Alden S. Hart, Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * As a special exception, you may use this file as part of a software library without 13 | * restriction. Specifically, if other files instantiate templates or use macros or 14 | * inline functions from this file, or you compile this file and link it with other 15 | * files to produce an executable, this file does not by itself cause the resulting 16 | * executable to be covered by the GNU General Public License. This exception does not 17 | * however invalidate any other reasons why the executable file might be covered by the 18 | * GNU General Public License. 19 | * 20 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 21 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PWM_H_ONCE 29 | #define PWM_H_ONCE 30 | #if 0 31 | typedef struct pwmConfigChannel { 32 | float frequency; // base frequency for PWM driver, in Hz 33 | float cw_speed_lo; // minimum clockwise spindle speed [0..N] 34 | float cw_speed_hi; // maximum clockwise spindle speed 35 | float cw_phase_lo; // pwm phase at minimum CW spindle speed, clamped [0..1] 36 | float cw_phase_hi; // pwm phase at maximum CW spindle speed, clamped [0..1] 37 | float ccw_speed_lo; // minimum counter-clockwise spindle speed [0..N] 38 | float ccw_speed_hi; // maximum counter-clockwise spindle speed 39 | float ccw_phase_lo; // pwm phase at minimum CCW spindle speed, clamped [0..1] 40 | float ccw_phase_hi; // pwm phase at maximum CCW spindle speed, clamped 41 | float phase_off; // pwm phase when spindle is disabled 42 | } pwmConfigChannel_t; 43 | 44 | typedef struct pwmChannel { 45 | // no data required in ARM 46 | } pwmChannel_t; 47 | 48 | typedef struct pwmControl { 49 | pwmConfigChannel_t c[PWMS]; // array of channel configs 50 | pwmChannel_t p[PWMS]; // array of PWM channels 51 | } pwmControl_t; 52 | 53 | extern pwmControl_t pwm; 54 | 55 | /*** function prototypes ***/ 56 | 57 | void pwm_init(void); 58 | stat_t pwm_set_freq(uint8_t channel, float freq); 59 | stat_t pwm_set_duty(uint8_t channel, float duty); 60 | 61 | stat_t pwm_set_pwm(nvObj_t *nv); 62 | 63 | #ifdef __TEXT_MODE 64 | 65 | void pwm_print_p1frq(nvObj_t *nv); 66 | void pwm_print_p1csl(nvObj_t *nv); 67 | void pwm_print_p1csh(nvObj_t *nv); 68 | void pwm_print_p1cpl(nvObj_t *nv); 69 | void pwm_print_p1cph(nvObj_t *nv); 70 | void pwm_print_p1wsl(nvObj_t *nv); 71 | void pwm_print_p1wsh(nvObj_t *nv); 72 | void pwm_print_p1wpl(nvObj_t *nv); 73 | void pwm_print_p1wph(nvObj_t *nv); 74 | void pwm_print_p1pof(nvObj_t *nv); 75 | 76 | #else 77 | 78 | #define pwm_print_p1frq tx_print_stub 79 | #define pwm_print_p1csl tx_print_stub 80 | #define pwm_print_p1csh tx_print_stub 81 | #define pwm_print_p1cpl tx_print_stub 82 | #define pwm_print_p1cph tx_print_stub 83 | #define pwm_print_p1wsl tx_print_stub 84 | #define pwm_print_p1wsh tx_print_stub 85 | #define pwm_print_p1wpl tx_print_stub 86 | #define pwm_print_p1wph tx_print_stub 87 | #define pwm_print_p1pof tx_print_stub 88 | 89 | #endif // __TEXT_MODE 90 | #endif // 0 91 | #endif // End of include guard: PWM_H_ONCE 92 | -------------------------------------------------------------------------------- /g2core/safety_manager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * safety_manager.cpp - The safety manager handles interlock and spindle safety controls 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2019 Rob Giseburt 6 | * 7 | * This code is a loose implementation of Kramer, Proctor and Messina's 8 | * canonical machining functions as described in the NIST RS274/NGC v3 9 | */ 10 | /* This file ("the software") is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License, version 2 as published by the 12 | * Free Software Foundation. You should have received a copy of the GNU General Public 13 | * License, version 2 along with the software. If not, see . 14 | * 15 | * As a special exception, you may use this file as part of a software library without 16 | * restriction. Specifically, if other files instantiate templates or use macros or 17 | * inline functions from this file, or you compile this file and link it with other 18 | * files to produce an executable, this file does not by itself cause the resulting 19 | * executable to be covered by the GNU General Public License. This exception does not 20 | * however invalidate any other reasons why the executable file might be covered by the 21 | * GNU General Public License. 22 | * 23 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 24 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 25 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 26 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 28 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | 31 | #include "safety_manager.h" 32 | 33 | stat_t cm_get_saf(nvObj_t *nv) { return(get_integer(nv, safety_manager->get_interlock_enable())); } 34 | stat_t cm_set_saf(nvObj_t *nv) { 35 | safety_manager->set_interlock_enable((bool)nv->value_int); 36 | return (STAT_OK); 37 | } 38 | -------------------------------------------------------------------------------- /g2core/settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * settings.h - default runtime settings 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2010 - 2018 Alden S. Hart Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * As a special exception, you may use this file as part of a software library without 13 | * restriction. Specifically, if other files instantiate templates or use macros or 14 | * inline functions from this file, or you compile this file and link it with other 15 | * files to produce an executable, this file does not by itself cause the resulting 16 | * executable to be covered by the GNU General Public License. This exception does not 17 | * however invalidate any other reasons why the executable file might be covered by the 18 | * GNU General Public License. 19 | * 20 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 21 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | /* The values in this file are the default settings that are loaded into a virgin EEPROM, 28 | * and can be changed using the config commands. After initial load the EEPROM values 29 | * (or changed values) are used. 30 | * 31 | * System and hardware settings that you shouldn't need to change are in hardware.h 32 | * Application settings that also shouldn't need to be changed are in g2core.h 33 | */ 34 | 35 | #ifndef SETTINGS_H_ONCE 36 | #define SETTINGS_H_ONCE 37 | 38 | // Defines that need to be here instead of a more logical place like canonical_machine.h 39 | 40 | #define RADIUS_MIN (0.0001) // minimum value for ABC radius settings 41 | 42 | /**** MACHINE PROFILES ****************************************************** 43 | * 44 | * Provide an optional SETTINGS_FILE in the makefile or compiler command line: 45 | * SETTINGS_FILE="settings_shopbot_test.h" 46 | * 47 | * settings_default.h provides values if no SETTINGS_FILE is selected, 48 | * or if any values are missing from the SETTINGS_FILE file. 49 | */ 50 | 51 | // This file sets up the compile-time defaults 52 | #ifdef SETTINGS_FILE 53 | #define SETTINGS_FILE_PATH 54 | #include SETTINGS_FILE_PATH 55 | #endif 56 | 57 | // Anything not set by the above file is set by this one... 58 | // The defaults below generally disable that function 59 | #include "settings/settings_default.h" 60 | 61 | // compile-time assertions - mostly checking the settings are not impossible 62 | 63 | #define stringify2(a) #a 64 | #define stringify(a) stringify2(a) 65 | 66 | //static_assert ( bool_constexpr , message ) // bool_constexpr must be true or assertion will fail 67 | static_assert ( (A_RADIUS > RADIUS_MIN), "A axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(A_RADIUS) ); 68 | static_assert ( (B_RADIUS > RADIUS_MIN), "B axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(B_RADIUS) ); 69 | static_assert ( (C_RADIUS > RADIUS_MIN), "C axis radius must be more than " stringify(RADIUS_MIN) ", but is " stringify(C_RADIUS) ); 70 | 71 | #undef stringify 72 | #undef stringify2 73 | 74 | #endif // End of include guard: SETTINGS_H_ONCE 75 | -------------------------------------------------------------------------------- /g2core/settings/settings_othermill_pro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * settings_othermill_pro.h - Other Machine Company Othermill Pro 3 | * This file is part of the TinyG project 4 | * 5 | * This file ("the software") is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License, version 2 as published by the 7 | * Free Software Foundation. You should have received a copy of the GNU General Public 8 | * License, version 2 along with the software. If not, see . 9 | * 10 | * As a special exception, you may use this file as part of a software library without 11 | * restriction. Specifically, if other files instantiate templates or use macros or 12 | * inline functions from this file, or you compile this file and link it with other 13 | * files to produce an executable, this file does not by itself cause the resulting 14 | * executable to be covered by the GNU General Public License. This exception does not 15 | * however invalidate any other reasons why the executable file might be covered by the 16 | * GNU General Public License. 17 | * 18 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 19 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 23 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | /* Note: The values in this file are the default settings that are loaded 26 | * into a virgin EEPROM, and can be changed using the config commands. 27 | * After initial load the EEPROM values (or changed values) are used. 28 | * 29 | * System and hardware settings that you shouldn't need to change 30 | * are in hardware.h Application settings that also shouldn't need 31 | * to be changed are in tinyg.h 32 | */ 33 | 34 | #ifndef SETTINGS_OTHERMILL_PRO_H_ONCE 35 | #define SETTINGS_OTHERMILL_PRO_H_ONCE 36 | 37 | /***********************************************************************/ 38 | /**** OtherMill Pro profile ***************************************/ 39 | /***********************************************************************/ 40 | 41 | // default to same settings as standard Othermill, unless they are overridden in this file 42 | #include "settings_othermill.h" 43 | 44 | // interim max values for testing 45 | #undef X_VELOCITY_MAX 46 | #undef X_FEEDRATE_MAX 47 | #undef Y_VELOCITY_MAX 48 | #undef Y_FEEDRATE_MAX 49 | #define X_VELOCITY_MAX 2600 50 | #define X_FEEDRATE_MAX X_VELOCITY_MAX 51 | #define Y_VELOCITY_MAX 2600 52 | #define Y_FEEDRATE_MAX Y_VELOCITY_MAX 53 | 54 | #undef P1_CW_SPEED_HI 55 | #undef P1_CW_SPEED_LO 56 | #undef P1_CW_PHASE_HI 57 | #undef P1_CW_PHASE_LO 58 | #define P1_CW_SPEED_HI 26000 59 | #define P1_CW_SPEED_LO 8000 60 | #define P1_CW_PHASE_HI 0.19 61 | #define P1_CW_PHASE_LO 0.135 62 | 63 | #undef PAUSE_DWELL_TIME 64 | #define PAUSE_DWELL_TIME 4.0 65 | 66 | #undef MOTOR_POWER_LEVEL_XY 67 | #undef MOTOR_POWER_LEVEL_Z 68 | #define MOTOR_POWER_LEVEL_XY 0.275 69 | #define MOTOR_POWER_LEVEL_Z 0.375 70 | 71 | #endif // SETTINGS_OTHERMILL_PRO_H_ONCE 72 | -------------------------------------------------------------------------------- /g2core/temperature.h: -------------------------------------------------------------------------------- 1 | /* 2 | * temperature.h - temperature control module - drives heaters or coolers 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2016 Robert Giseburt 6 | * Copyright (c) 2016 Alden S. Hart, Jr. 7 | * 8 | * This file ("the software") is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License, version 2 as published by the 10 | * Free Software Foundation. You should have received a copy of the GNU General Public 11 | * License, version 2 along with the software. If not, see . 12 | * 13 | * As a special exception, you may use this file as part of a software library without 14 | * restriction. Specifically, if other files instantiate templates or use macros or 15 | * inline functions from this file, or you compile this file and link it with other 16 | * files to produce an executable, this file does not by itself cause the resulting 17 | * executable to be covered by the GNU General Public License. This exception does not 18 | * however invalidate any other reasons why the executable file might be covered by the 19 | * GNU General Public License. 20 | * 21 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 22 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 24 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 26 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef TEMPERATURE_H_ONCE 30 | #define TEMPERATURE_H_ONCE 31 | 32 | /* 33 | * Global Scope Functions 34 | */ 35 | 36 | void temperature_init(); 37 | void temperature_reset(); 38 | stat_t temperature_callback(); 39 | 40 | stat_t cm_get_heater_enable(nvObj_t *nv); 41 | stat_t cm_set_heater_enable(nvObj_t *nv); 42 | 43 | stat_t cm_get_heater_p(nvObj_t* nv); 44 | stat_t cm_set_heater_p(nvObj_t* nv); 45 | stat_t cm_get_heater_i(nvObj_t* nv); 46 | stat_t cm_set_heater_i(nvObj_t* nv); 47 | stat_t cm_get_heater_d(nvObj_t* nv); 48 | stat_t cm_set_heater_d(nvObj_t* nv); 49 | stat_t cm_get_heater_f(nvObj_t* nv); 50 | stat_t cm_set_heater_f(nvObj_t* nv); 51 | stat_t cm_get_pid_p(nvObj_t* nv); 52 | stat_t cm_get_pid_i(nvObj_t* nv); 53 | stat_t cm_get_pid_d(nvObj_t* nv); 54 | stat_t cm_get_pid_f(nvObj_t* nv); 55 | 56 | float cm_get_set_temperature(const uint8_t heater); 57 | stat_t cm_get_set_temperature(nvObj_t *nv); 58 | 59 | void cm_set_set_temperature(const uint8_t heater, const float value); 60 | stat_t cm_set_set_temperature(nvObj_t* nv); 61 | 62 | float cm_get_fan_power(const uint8_t heater); 63 | stat_t cm_get_fan_power(nvObj_t* nv); 64 | 65 | void cm_set_fan_power(const uint8_t heater, const float value); 66 | stat_t cm_set_fan_power(nvObj_t* nv); 67 | 68 | stat_t cm_get_fan_min_power(nvObj_t* nv); 69 | stat_t cm_set_fan_min_power(nvObj_t* nv); 70 | stat_t cm_get_fan_low_temp(nvObj_t* nv); 71 | stat_t cm_set_fan_low_temp(nvObj_t* nv); 72 | stat_t cm_get_fan_high_temp(nvObj_t* nv); 73 | stat_t cm_set_fan_high_temp(nvObj_t* nv); 74 | 75 | bool cm_get_at_temperature(const uint8_t heater); 76 | stat_t cm_get_at_temperature(nvObj_t* nv); 77 | 78 | float cm_get_heater_output(const uint8_t heater); 79 | stat_t cm_get_heater_output(nvObj_t* nv); 80 | 81 | stat_t cm_get_heater_adc(nvObj_t* nv); 82 | 83 | float cm_get_temperature(const uint8_t heater); 84 | stat_t cm_get_temperature(nvObj_t* nv); 85 | 86 | stat_t cm_get_thermistor_resistance(nvObj_t* nv); 87 | stat_t cm_get_thermistor_voltage(nvObj_t* nv); 88 | 89 | 90 | /*--- text_mode support functions ---*/ 91 | 92 | #ifdef __TEXT_MODE 93 | 94 | #else 95 | 96 | #endif // __TEXT_MODE 97 | 98 | #endif // End of include guard: TEMPERATURE_H_ONCE 99 | -------------------------------------------------------------------------------- /g2core/text_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * text_parser.h - text parser and text mode support 3 | * This file is part of the g2core project 4 | * 5 | * Copyright (c) 2013 - 2018 Alden S. Hart, Jr. 6 | * 7 | * This file ("the software") is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License, version 2 as published by the 9 | * Free Software Foundation. You should have received a copy of the GNU General Public 10 | * License, version 2 along with the software. If not, see . 11 | * 12 | * As a special exception, you may use this file as part of a software library without 13 | * restriction. Specifically, if other files instantiate templates or use macros or 14 | * inline functions from this file, or you compile this file and link it with other 15 | * files to produce an executable, this file does not by itself cause the resulting 16 | * executable to be covered by the GNU General Public License. This exception does not 17 | * however invalidate any other reasons why the executable file might be covered by the 18 | * GNU General Public License. 19 | * 20 | * THE SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY 21 | * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 23 | * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 25 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef TEXT_PARSER_H_ONCE 29 | #define TEXT_PARSER_H_ONCE 30 | 31 | enum textVerbosity { 32 | TV_SILENT = 0, // no response is provided 33 | TV_VERBOSE // response is provided. Error responses ech message and failed commands 34 | }; 35 | 36 | enum textFormats { // text output print modes 37 | TEXT_NO_PRINT = 0, // don't print anything if you find yourself in TEXT mode 38 | TEXT_MULTILINE_FORMATTED // print formatted values on separate lines with formatted print per line 39 | }; 40 | 41 | typedef struct txtSingleton { // text mode data 42 | 43 | char format[NV_FORMAT_LEN + 1]; 44 | uint8_t text_verbosity; // see enum in this file for settings 45 | 46 | } txtSingleton_t; 47 | extern txtSingleton_t txt; 48 | 49 | /**** Global Scope Functions ****/ 50 | 51 | #ifdef __TEXT_MODE 52 | 53 | stat_t text_parser(char* str); 54 | void text_response(const stat_t status, char* buf); 55 | void text_print_list(stat_t status, uint8_t flags); 56 | // void text_print_inline_pairs(nvObj_t *nv); 57 | // void text_print_inline_values(nvObj_t *nv); 58 | void text_print_multiline_formatted(nvObj_t* nv); 59 | 60 | void tx_print(nvObj_t* nv); // does all formats 61 | void tx_print_nul(nvObj_t* nv); 62 | void tx_print_str(nvObj_t* nv); 63 | void tx_print_ui8(nvObj_t* nv); 64 | void tx_print_int(nvObj_t* nv); 65 | void tx_print_flt(nvObj_t* nv); 66 | 67 | void text_print(nvObj_t* nv, const char* format); // does all formats except units 68 | void text_print_nul(nvObj_t* nv, const char* format); 69 | void text_print_str(nvObj_t* nv, const char* format); 70 | void text_print_int(nvObj_t* nv, const char* format); 71 | void text_print_flt(nvObj_t* nv, const char* format); 72 | void text_print_flt_units(nvObj_t* nv, const char* format, const char* units); 73 | void text_print_bool(nvObj_t* nv, const char* format); 74 | void tx_print_tv(nvObj_t* nv); 75 | 76 | #else 77 | 78 | #define text_parser text_parser_stub 79 | #define text_response text_response_stub 80 | #define text_print text_print_stub 81 | #define text_print_list text_print_list_stub 82 | #define tx_print_nul tx_print_stub 83 | #define tx_print_int tx_print_stub 84 | #define tx_print_flt tx_print_stub 85 | #define tx_print_str tx_print_stub 86 | #define tx_print_tv tx_print_stub 87 | #define text_print_bool tx_print_stub 88 | 89 | void tx_print_stub(nvObj_t* nv); 90 | void text_print_stub(nvObj_t* nv, const char* format); 91 | 92 | #endif 93 | 94 | stat_t text_parser_stub(char* str); 95 | void text_response_stub(const stat_t status, char* buf); 96 | void text_print_list_stub(stat_t status, uint8_t flags); 97 | 98 | stat_t txt_get_tv(nvObj_t *nv); 99 | stat_t txt_set_tv(nvObj_t *nv); 100 | 101 | #endif // End of include guard: TEXT_PARSER_H_ONCE 102 | -------------------------------------------------------------------------------- /g2core/utils/enter_bootloader.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Define function to print colored text 4 | print_message () { 5 | if [ $# -eq 2 ]; then 6 | color=$1 7 | message=$2 8 | else 9 | color="default" 10 | message=$1 11 | fi 12 | 13 | case $color in 14 | "red") 15 | echo -e "\033[0;31m$message\033[0m" 16 | ;; 17 | "green") 18 | echo -e "\033[0;32m$message\033[0m" 19 | ;; 20 | *) 21 | echo $message 22 | ;; 23 | esac 24 | } 25 | 26 | # Print message to indicate entering bootloader mode 27 | print_message "green" "Entering G2Core into bootloader mode..." 28 | 29 | # List available serial ports and prompt user to select a port 30 | serial_ports=($(ls /dev/ttyACM*)) 31 | if [ ${#serial_ports[@]} -eq 0 ]; then 32 | print_message "red" "No serial ports found. Make sure your device is connected and try again." 33 | exit 1 34 | fi 35 | 36 | while true; do 37 | print_message "default" "Select the serial port to use:" 38 | for i in "${!serial_ports[@]}"; do 39 | echo "$((i+1)). ${serial_ports[$i]}" 40 | done 41 | echo -n "Enter the number of the serial port to use: " 42 | read port_number 43 | 44 | # Check that the user entered a valid number 45 | if [[ ! "$port_number" =~ ^[0-9]+$ ]]; then 46 | print_message "red" "Invalid port number: $port_number" 47 | elif [ $port_number -lt 1 ] || [ $port_number -gt ${#serial_ports[@]} ]; then 48 | print_message "red" "Invalid port number: $port_number" 49 | else 50 | break 51 | fi 52 | done 53 | 54 | # Construct the serial port path from the selected number 55 | serial_port=${serial_ports[$((port_number-1))]} 56 | 57 | # Set the baud rate on the selected serial port 58 | stty -F "$serial_port" 1200 hup 59 | stty -F "$serial_port" 9600 60 | 61 | # Print message to flash the board 62 | print_message "green" "G2core on port $serial_port should now be in bootloader mode. Execute this command:" 63 | print_message "green" "bossac --port=$serial_port -u=true -e -w -v -i -b -R /g2core.bin" 64 | print_message "green" "to flash your g2core board." 65 | --------------------------------------------------------------------------------