diff --git a/.gitignore b/.gitignore index c8ff8260..6bb9e21b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -Utils/Serial/* -!Utils/Serial/include -!Utils/Serial/src -!voice-command/build/build-release.js +utils/serial/* +!utils/serial/include +!utils/serial/src +!utils/serial/binding.gyp +!utils/voiceCommand/build/build-release.js build/ node_modules/ package-lock.json @@ -25,8 +26,8 @@ src/osx/voice-command/build *.sln.docstates *.plist *.xccheckout -!voice-command/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/xcuserdata/baluubas.xcuserdatad -!voice-command/src/osx/voice-command/voice-command.xcodeproj/xcuserdata/baluubas.xcuserdatad +!utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/xcuserdata/baluubas.xcuserdatad +!utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/xcuserdata/baluubas.xcuserdatad *.xcuserdatad # User-specific files (MonoDevelop/Xamarin Studio) diff --git a/binding.gyp b/binding.gyp deleted file mode 100644 index 69faf664..00000000 --- a/binding.gyp +++ /dev/null @@ -1,35 +0,0 @@ -{ - "variables": { - "cppdefs": "NODE_GYP", - }, - "targets": [{ - "target_name": "serial", - "sources": [ - "./Utils/Serial/src/node/main.cpp", - "./Utils/Serial/src/node/setup.cpp", - "./Utils/Serial/src/node/poll.cpp", - "./Utils/Serial/src/node/send.cpp", - "./Utils/Serial/src/node/receiveHelpers.cpp", - "./Utils/Serial/src/node/sendHelpers.cpp", - "./Utils/Serial/src/serial/shared.cpp", - "./Utils/Serial/src/crashAnalyzer/buffer.cpp", - "./Utils/Serial/src/crashAnalyzer/analyze.cpp", - "./Protocol/src/protocol/protocol.cpp" - ], - "conditions": [ - ["OS=='win'", { - "sources": ["./Utils/Serial/src/serial/win.cpp"] - }], - ["OS!='win'", { - "sources": ["./Utils/Serial/src/serial/unix.cpp"] - }], - ], - "include_dirs": [ - "./Utils/Serial/include", - "./Protocol/include" - ], - "defines": [ - "<@(cppdefs)" - ] - }] -} diff --git a/Firmware/.gitignore b/firmware/.gitignore similarity index 100% rename from Firmware/.gitignore rename to firmware/.gitignore diff --git a/Firmware/include/hardware/angleAccessor.hpp b/firmware/include/hardware/angleAccessor.hpp similarity index 100% rename from Firmware/include/hardware/angleAccessor.hpp rename to firmware/include/hardware/angleAccessor.hpp diff --git a/Firmware/include/hardware/panto.hpp b/firmware/include/hardware/panto.hpp similarity index 100% rename from Firmware/include/hardware/panto.hpp rename to firmware/include/hardware/panto.hpp diff --git a/Firmware/include/hardware/spiCommands.hpp b/firmware/include/hardware/spiCommands.hpp similarity index 100% rename from Firmware/include/hardware/spiCommands.hpp rename to firmware/include/hardware/spiCommands.hpp diff --git a/Firmware/include/hardware/spiEncoder.hpp b/firmware/include/hardware/spiEncoder.hpp similarity index 100% rename from Firmware/include/hardware/spiEncoder.hpp rename to firmware/include/hardware/spiEncoder.hpp diff --git a/Firmware/include/hardware/spiEncoderChain.hpp b/firmware/include/hardware/spiEncoderChain.hpp similarity index 100% rename from Firmware/include/hardware/spiEncoderChain.hpp rename to firmware/include/hardware/spiEncoderChain.hpp diff --git a/Firmware/include/hardware/spiPacket.hpp b/firmware/include/hardware/spiPacket.hpp similarity index 100% rename from Firmware/include/hardware/spiPacket.hpp rename to firmware/include/hardware/spiPacket.hpp diff --git a/Firmware/include/ioMain.hpp b/firmware/include/ioMain.hpp similarity index 100% rename from Firmware/include/ioMain.hpp rename to firmware/include/ioMain.hpp diff --git a/Firmware/include/physics/annotatedEdge.hpp b/firmware/include/physics/annotatedEdge.hpp similarity index 100% rename from Firmware/include/physics/annotatedEdge.hpp rename to firmware/include/physics/annotatedEdge.hpp diff --git a/Firmware/include/physics/collider.hpp b/firmware/include/physics/collider.hpp similarity index 100% rename from Firmware/include/physics/collider.hpp rename to firmware/include/physics/collider.hpp diff --git a/Firmware/include/physics/edge.hpp b/firmware/include/physics/edge.hpp similarity index 100% rename from Firmware/include/physics/edge.hpp rename to firmware/include/physics/edge.hpp diff --git a/Firmware/include/physics/godObject.hpp b/firmware/include/physics/godObject.hpp similarity index 100% rename from Firmware/include/physics/godObject.hpp rename to firmware/include/physics/godObject.hpp diff --git a/Firmware/include/physics/godObjectAction.hpp b/firmware/include/physics/godObjectAction.hpp similarity index 100% rename from Firmware/include/physics/godObjectAction.hpp rename to firmware/include/physics/godObjectAction.hpp diff --git a/Firmware/include/physics/godObjectActionData.hpp b/firmware/include/physics/godObjectActionData.hpp similarity index 100% rename from Firmware/include/physics/godObjectActionData.hpp rename to firmware/include/physics/godObjectActionData.hpp diff --git a/Firmware/include/physics/godObjectActionType.hpp b/firmware/include/physics/godObjectActionType.hpp similarity index 100% rename from Firmware/include/physics/godObjectActionType.hpp rename to firmware/include/physics/godObjectActionType.hpp diff --git a/Firmware/include/physics/hashtable.hpp b/firmware/include/physics/hashtable.hpp similarity index 100% rename from Firmware/include/physics/hashtable.hpp rename to firmware/include/physics/hashtable.hpp diff --git a/Firmware/include/physics/indexedEdge.hpp b/firmware/include/physics/indexedEdge.hpp similarity index 100% rename from Firmware/include/physics/indexedEdge.hpp rename to firmware/include/physics/indexedEdge.hpp diff --git a/Firmware/include/physics/obstacle.hpp b/firmware/include/physics/obstacle.hpp similarity index 100% rename from Firmware/include/physics/obstacle.hpp rename to firmware/include/physics/obstacle.hpp diff --git a/Firmware/include/physics/pantoPhysics.hpp b/firmware/include/physics/pantoPhysics.hpp similarity index 100% rename from Firmware/include/physics/pantoPhysics.hpp rename to firmware/include/physics/pantoPhysics.hpp diff --git a/Firmware/include/physicsMain.hpp b/firmware/include/physicsMain.hpp similarity index 100% rename from Firmware/include/physicsMain.hpp rename to firmware/include/physicsMain.hpp diff --git a/Firmware/include/tasks/task.hpp b/firmware/include/tasks/task.hpp similarity index 100% rename from Firmware/include/tasks/task.hpp rename to firmware/include/tasks/task.hpp diff --git a/Firmware/include/tasks/taskFunction.hpp b/firmware/include/tasks/taskFunction.hpp similarity index 100% rename from Firmware/include/tasks/taskFunction.hpp rename to firmware/include/tasks/taskFunction.hpp diff --git a/Firmware/include/tasks/taskRegistry.hpp b/firmware/include/tasks/taskRegistry.hpp similarity index 100% rename from Firmware/include/tasks/taskRegistry.hpp rename to firmware/include/tasks/taskRegistry.hpp diff --git a/Firmware/include/utils/assert.hpp b/firmware/include/utils/assert.hpp similarity index 100% rename from Firmware/include/utils/assert.hpp rename to firmware/include/utils/assert.hpp diff --git a/Firmware/include/utils/crashDump.hpp b/firmware/include/utils/crashDump.hpp similarity index 100% rename from Firmware/include/utils/crashDump.hpp rename to firmware/include/utils/crashDump.hpp diff --git a/Firmware/include/utils/framerateLimiter.hpp b/firmware/include/utils/framerateLimiter.hpp similarity index 100% rename from Firmware/include/utils/framerateLimiter.hpp rename to firmware/include/utils/framerateLimiter.hpp diff --git a/Firmware/include/utils/performanceMonitor.hpp b/firmware/include/utils/performanceMonitor.hpp similarity index 100% rename from Firmware/include/utils/performanceMonitor.hpp rename to firmware/include/utils/performanceMonitor.hpp diff --git a/Firmware/include/utils/receiveHandler.hpp b/firmware/include/utils/receiveHandler.hpp similarity index 100% rename from Firmware/include/utils/receiveHandler.hpp rename to firmware/include/utils/receiveHandler.hpp diff --git a/Firmware/include/utils/receiveState.hpp b/firmware/include/utils/receiveState.hpp similarity index 100% rename from Firmware/include/utils/receiveState.hpp rename to firmware/include/utils/receiveState.hpp diff --git a/Firmware/include/utils/serial.hpp b/firmware/include/utils/serial.hpp similarity index 100% rename from Firmware/include/utils/serial.hpp rename to firmware/include/utils/serial.hpp diff --git a/Firmware/include/utils/utils.hpp b/firmware/include/utils/utils.hpp similarity index 100% rename from Firmware/include/utils/utils.hpp rename to firmware/include/utils/utils.hpp diff --git a/Firmware/include/utils/vector.hpp b/firmware/include/utils/vector.hpp similarity index 100% rename from Firmware/include/utils/vector.hpp rename to firmware/include/utils/vector.hpp diff --git a/Firmware/platformio.ini b/firmware/platformio.ini similarity index 95% rename from Firmware/platformio.ini rename to firmware/platformio.ini index 96b6c482..2eefd36e 100644 --- a/Firmware/platformio.ini +++ b/firmware/platformio.ini @@ -2,7 +2,7 @@ description = Dualpanto firmware [protocol] -base_dir = ../Protocol +base_dir = ../utils/protocol include_dir = ${protocol.base_dir}/include src_dir = ${protocol.base_dir}/src src_filter = +<../${protocol.src_dir}> diff --git a/Firmware/src/hardware/panto.cpp b/firmware/src/hardware/panto.cpp similarity index 100% rename from Firmware/src/hardware/panto.cpp rename to firmware/src/hardware/panto.cpp diff --git a/Firmware/src/hardware/spiCommands.cpp b/firmware/src/hardware/spiCommands.cpp similarity index 100% rename from Firmware/src/hardware/spiCommands.cpp rename to firmware/src/hardware/spiCommands.cpp diff --git a/Firmware/src/hardware/spiEncoder.cpp b/firmware/src/hardware/spiEncoder.cpp similarity index 100% rename from Firmware/src/hardware/spiEncoder.cpp rename to firmware/src/hardware/spiEncoder.cpp diff --git a/Firmware/src/hardware/spiEncoderChain.cpp b/firmware/src/hardware/spiEncoderChain.cpp similarity index 100% rename from Firmware/src/hardware/spiEncoderChain.cpp rename to firmware/src/hardware/spiEncoderChain.cpp diff --git a/Firmware/src/hardware/spiPacket.cpp b/firmware/src/hardware/spiPacket.cpp similarity index 100% rename from Firmware/src/hardware/spiPacket.cpp rename to firmware/src/hardware/spiPacket.cpp diff --git a/Firmware/src/ioMain.cpp b/firmware/src/ioMain.cpp similarity index 100% rename from Firmware/src/ioMain.cpp rename to firmware/src/ioMain.cpp diff --git a/Firmware/src/main.cpp b/firmware/src/main.cpp similarity index 100% rename from Firmware/src/main.cpp rename to firmware/src/main.cpp diff --git a/Firmware/src/physics/annotatedEdge.cpp b/firmware/src/physics/annotatedEdge.cpp similarity index 100% rename from Firmware/src/physics/annotatedEdge.cpp rename to firmware/src/physics/annotatedEdge.cpp diff --git a/Firmware/src/physics/collider.cpp b/firmware/src/physics/collider.cpp similarity index 100% rename from Firmware/src/physics/collider.cpp rename to firmware/src/physics/collider.cpp diff --git a/Firmware/src/physics/godObject.cpp b/firmware/src/physics/godObject.cpp similarity index 100% rename from Firmware/src/physics/godObject.cpp rename to firmware/src/physics/godObject.cpp diff --git a/Firmware/src/physics/hashtable.cpp b/firmware/src/physics/hashtable.cpp similarity index 100% rename from Firmware/src/physics/hashtable.cpp rename to firmware/src/physics/hashtable.cpp diff --git a/Firmware/src/physics/indexedEdge.cpp b/firmware/src/physics/indexedEdge.cpp similarity index 100% rename from Firmware/src/physics/indexedEdge.cpp rename to firmware/src/physics/indexedEdge.cpp diff --git a/Firmware/src/physics/obstacle.cpp b/firmware/src/physics/obstacle.cpp similarity index 100% rename from Firmware/src/physics/obstacle.cpp rename to firmware/src/physics/obstacle.cpp diff --git a/Firmware/src/physics/pantoPhysics.cpp b/firmware/src/physics/pantoPhysics.cpp similarity index 100% rename from Firmware/src/physics/pantoPhysics.cpp rename to firmware/src/physics/pantoPhysics.cpp diff --git a/Firmware/src/physicsMain.cpp b/firmware/src/physicsMain.cpp similarity index 100% rename from Firmware/src/physicsMain.cpp rename to firmware/src/physicsMain.cpp diff --git a/Firmware/src/tasks/task.cpp b/firmware/src/tasks/task.cpp similarity index 100% rename from Firmware/src/tasks/task.cpp rename to firmware/src/tasks/task.cpp diff --git a/Firmware/src/tasks/taskRegistry.cpp b/firmware/src/tasks/taskRegistry.cpp similarity index 100% rename from Firmware/src/tasks/taskRegistry.cpp rename to firmware/src/tasks/taskRegistry.cpp diff --git a/Firmware/src/utils/crashDump.cpp b/firmware/src/utils/crashDump.cpp similarity index 100% rename from Firmware/src/utils/crashDump.cpp rename to firmware/src/utils/crashDump.cpp diff --git a/Firmware/src/utils/framerateLimiter.cpp b/firmware/src/utils/framerateLimiter.cpp similarity index 100% rename from Firmware/src/utils/framerateLimiter.cpp rename to firmware/src/utils/framerateLimiter.cpp diff --git a/Firmware/src/utils/performanceMonitor.cpp b/firmware/src/utils/performanceMonitor.cpp similarity index 100% rename from Firmware/src/utils/performanceMonitor.cpp rename to firmware/src/utils/performanceMonitor.cpp diff --git a/Firmware/src/utils/serial.cpp b/firmware/src/utils/serial.cpp similarity index 100% rename from Firmware/src/utils/serial.cpp rename to firmware/src/utils/serial.cpp diff --git a/Firmware/src/utils/vector.cpp b/firmware/src/utils/vector.cpp similarity index 100% rename from Firmware/src/utils/vector.cpp rename to firmware/src/utils/vector.cpp diff --git a/Hardware/BP1.json b/hardware/BP1.json similarity index 100% rename from Hardware/BP1.json rename to hardware/BP1.json diff --git a/Hardware/LP1.json b/hardware/LP1.json similarity index 100% rename from Hardware/LP1.json rename to hardware/LP1.json diff --git a/Hardware/LP_PCB.json b/hardware/LP_PCB.json similarity index 100% rename from Hardware/LP_PCB.json rename to hardware/LP_PCB.json diff --git a/Hardware/LP_PCB_ESP32.json b/hardware/LP_PCB_ESP32.json similarity index 100% rename from Hardware/LP_PCB_ESP32.json rename to hardware/LP_PCB_ESP32.json diff --git a/Hardware/angie.json b/hardware/angie.json similarity index 100% rename from Hardware/angie.json rename to hardware/angie.json diff --git a/Hardware/barbie.json b/hardware/barbie.json similarity index 100% rename from Hardware/barbie.json rename to hardware/barbie.json diff --git a/Hardware/chantalle.json b/hardware/chantalle.json similarity index 100% rename from Hardware/chantalle.json rename to hardware/chantalle.json diff --git a/Hardware/doerte.json b/hardware/doerte.json similarity index 100% rename from Hardware/doerte.json rename to hardware/doerte.json diff --git a/Hardware/mab_opt2k4_dir_esp32.json b/hardware/mab_opt2k4_dir_esp32.json similarity index 100% rename from Hardware/mab_opt2k4_dir_esp32.json rename to hardware/mab_opt2k4_dir_esp32.json diff --git a/lib/device.js b/lib/device.js index 17f20635..2e0340af 100644 --- a/lib/device.js +++ b/lib/device.js @@ -1,6 +1,6 @@ 'use strict'; -const serial = require('../build/Release/serial'); +const serial = require('../utils/serial/build/Release/serial'); const Vector = require('./vector'); const HapticObject = require('./hapticObject'); const HandleMovement = require('./handleMovement'); diff --git a/lib/dualpantoframework.js b/lib/dualpantoframework.js index 899e4301..8a542ce0 100644 --- a/lib/dualpantoframework.js +++ b/lib/dualpantoframework.js @@ -22,7 +22,7 @@ module.exports = { // require async to dirty fix cyclic dependency process.nextTick(() => { - require('../Utils/ViDeb/index'); + require('../utils/viDeb/index'); }); // @TODO: move the following stuff into the correct files diff --git a/lib/voice-interaction.js b/lib/voice-interaction.js index 43e9fb69..dcbd946e 100644 --- a/lib/voice-interaction.js +++ b/lib/voice-interaction.js @@ -2,7 +2,7 @@ const EventEmitter = require('events').EventEmitter; const say = require('say'); -const VoiceCommand = require('../voice-command'); +const VoiceCommand = require('../utils/voiceCommand'); const Player = require('./player'); /** diff --git a/package.json b/package.json index 0c598c59..5550ecac 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "config": "npm run script config", "plotter": "npm run script plotter", "docs": "npm run script docs", - "script": "node ./Utils/Scripts/run.js", - "svgToJs": "node ./Utils/svgConverter/svgToJs.js", - "setup-commit-hook": "if-env NODE_ENV=production && echo \" production mode \" || node ./Utils/Scripts/createJsCommitHook.js" + "script": "node ./utils/scripts/run.js", + "svgToJs": "node ./utils/svgConverter/svgToJs.js", + "setup-commit-hook": "if-env NODE_ENV=production && echo \" production mode \" || node ./utils/scripts/createJsCommitHook.js" }, "repository": { "type": "git", diff --git a/README.md b/readme.md similarity index 65% rename from README.md rename to readme.md index 9a474ae4..626cf0ca 100644 --- a/README.md +++ b/readme.md @@ -74,3 +74,24 @@ The `examples` dir contains multiple example programs, as well as programs for c - `speakText.js` - Uses the voice output. - `wall` - Obstacle testing. - `wallGenerator.js` - generates a circle obstacle, subdivided into a given number of edges. + +## Repository Overview + +- `documentation` - \[Markdown\] Contains the documentation about interfaces and setup. + - `classes` - Documentaion for the classes exported by the framework. Build this using `npm run docs`. + - `protocol` - Definition of the serial communication protocol. The shared source files implementing this can be found in `./utils/protocol/`. The serial implementations are stored in `./firmware/utils/` (firmware side) and `./utils/serial/` (framework side). + - `setup` - Instuctions on how to set up the framework for different operating systems. +- `examples` - \[JavaScript\] Example scripts on how to use the framework. See [example section](#Examples). +- `firmware` - \[C++\] The firmware for the ESP32 built into the device. Build using the [platformio command](#Available-Scripts). +- `hardware` - \[JSON\] Config files for different hardware iterations. These are used with the [configure command](#Available-Scripts) to generate source files which are then compiled into the firmware. +- `lib` - \[JavaScript\] The dualpantoframework library. Refer the [docs](documentation/classes/index.md) for more info about the files. +- `utils` - Mixed helpers for building and debugging. + - `backtrace` - \[sh\] Bash script vor decoding the ESP32's crash backtrace. Functionality is built into the framework's serial plugin now, but this script may be used without a platformio installation. + - `geogebra` - Geometric representations of forward and inverse kinematics. Contains both complete websites for easy use, as well as the scripts used to create those websites. + - `plotter` - \[JavaScript\] Visualization of the panto's available space and the resolution. Use the [plotter command](#Available-Scripts) to start a server, open the page (note: due to a bug in a dependency, go directly to `[...]/index.html`) and upload one of the hardware config files. + - `protocol` - \[C++\] Serial protocol base files, shared between firmware and framework. Based on the specification stored in `./documentation/protocol/`. + - `scripts` - \[JavaScript\] The scripts behind the [commands](#Available-Scripts). Check out `./package.json` and `./utils/scripts/run.js` if you want to add functionality. + - `serial` - \[C++\] The serial plugin for the framework. Uses the shared protocol files (`./utils/protocol/`) to implement the specification (`./documentation/protocol/`). + - `svgConverter` - \[JavaScript\] Converts a `svg` file of a level into a `prototype.js` script. Use the [svgToJs command](#Available-Scripts). + - `viDeb` - \[JavaScript\] Implements a emulated device. + - `voiceCommand` - \[JavaScript\] Voice input plugin used by the framework. \ No newline at end of file diff --git a/Utils/Backtrace/backtrace.sh b/utils/backtrace/backtrace.sh similarity index 81% rename from Utils/Backtrace/backtrace.sh rename to utils/backtrace/backtrace.sh index e7e4475f..4b75654b 100644 --- a/Utils/Backtrace/backtrace.sh +++ b/utils/backtrace/backtrace.sh @@ -4,11 +4,11 @@ # In order to find line numbers, add -g3 to the PlatformIO build flags. # The default target is set for running this script from the base framework dir. # Alternatively, you may pass an path to the elf as the first argument. -# Default usage: ./Utils/Backtrace/backtrace.sh "0x40085698:0x3ffb5e80 [...]" -# Alternative usage example for running from this dir: ./backtrace.sh ./../../Firmware/.pioenvs/esp32dev/firmware.elf "0x40085698:0x3ffb5e80 [...]" +# Default usage: ./utils/backtrace/backtrace.sh "0x40085698:0x3ffb5e80 [...]" +# Alternative usage example for running from this dir: ./backtrace.sh ./../../firmware/.pioenvs/esp32dev/firmware.elf "0x40085698:0x3ffb5e80 [...]" if [ "$#" -eq 1 ]; then - target=./Firmware/.pioenvs/esp32dev/firmware.elf + target=./firmware/.pioenvs/esp32dev/firmware.elf backtrace=$1 echo "Using default target $target" else diff --git a/Utils/GeoGebra/forwardKinematics.html b/utils/geogebra/forwardKinematics.html similarity index 100% rename from Utils/GeoGebra/forwardKinematics.html rename to utils/geogebra/forwardKinematics.html diff --git a/Utils/GeoGebra/forwardKinematics.txt b/utils/geogebra/forwardKinematics.txt similarity index 100% rename from Utils/GeoGebra/forwardKinematics.txt rename to utils/geogebra/forwardKinematics.txt diff --git a/Utils/GeoGebra/inverseKinematics.html b/utils/geogebra/inverseKinematics.html similarity index 100% rename from Utils/GeoGebra/inverseKinematics.html rename to utils/geogebra/inverseKinematics.html diff --git a/Utils/GeoGebra/inverseKinematics.txt b/utils/geogebra/inverseKinematics.txt similarity index 100% rename from Utils/GeoGebra/inverseKinematics.txt rename to utils/geogebra/inverseKinematics.txt diff --git a/Utils/GeoGebra/readme.md b/utils/geogebra/readme.md similarity index 100% rename from Utils/GeoGebra/readme.md rename to utils/geogebra/readme.md diff --git a/Utils/plotter/index.html b/utils/plotter/index.html similarity index 100% rename from Utils/plotter/index.html rename to utils/plotter/index.html diff --git a/Utils/plotter/panto.js b/utils/plotter/panto.js similarity index 100% rename from Utils/plotter/panto.js rename to utils/plotter/panto.js diff --git a/Utils/plotter/plotter.js b/utils/plotter/plotter.js similarity index 100% rename from Utils/plotter/plotter.js rename to utils/plotter/plotter.js diff --git a/Protocol/include/protocol/header.hpp b/utils/protocol/include/protocol/header.hpp similarity index 100% rename from Protocol/include/protocol/header.hpp rename to utils/protocol/include/protocol/header.hpp diff --git a/Protocol/include/protocol/messageType.hpp b/utils/protocol/include/protocol/messageType.hpp similarity index 100% rename from Protocol/include/protocol/messageType.hpp rename to utils/protocol/include/protocol/messageType.hpp diff --git a/Protocol/include/protocol/protocol.hpp b/utils/protocol/include/protocol/protocol.hpp similarity index 100% rename from Protocol/include/protocol/protocol.hpp rename to utils/protocol/include/protocol/protocol.hpp diff --git a/Protocol/src/protocol/protocol.cpp b/utils/protocol/src/protocol/protocol.cpp similarity index 100% rename from Protocol/src/protocol/protocol.cpp rename to utils/protocol/src/protocol/protocol.cpp diff --git a/Utils/Scripts/createJsCommitHook.js b/utils/scripts/createJsCommitHook.js similarity index 100% rename from Utils/Scripts/createJsCommitHook.js rename to utils/scripts/createJsCommitHook.js diff --git a/Utils/Scripts/docs.js b/utils/scripts/docs.js similarity index 100% rename from Utils/Scripts/docs.js rename to utils/scripts/docs.js diff --git a/Utils/Scripts/generateHardwareConfig.js b/utils/scripts/generateHardwareConfig.js similarity index 98% rename from Utils/Scripts/generateHardwareConfig.js rename to utils/scripts/generateHardwareConfig.js index ed3469e8..cf2f415a 100644 --- a/Utils/Scripts/generateHardwareConfig.js +++ b/utils/scripts/generateHardwareConfig.js @@ -4,7 +4,7 @@ /* eslint-disable require-jsdoc */ // the template strings can't ne broken into multiple lines /* eslint-disable max-len */ -const input = require('../../Hardware/'+process.argv[2]+'.json'); +const input = require('../../hardware/'+process.argv[2]+'.json'); const fs = require('fs'); const crypto = require('crypto'); const hash = crypto.createHash('md5').update(JSON.stringify(input)).digest(); @@ -232,7 +232,7 @@ constexpr double hashtableStepSizeY = ${hashtable.stepSizeY}; const uint32_t obstacleChangesPerFrame = ${input.obstacleChangesPerFrame};`; console.log(headerOutput); -const headerDir = 'Firmware/include/config/'; +const headerDir = 'firmware/include/config/'; if (!fs.existsSync(headerDir)) { fs.mkdirSync(headerDir, {recursive: true}); } @@ -253,7 +253,7 @@ float pidFactor[${pantoCount*3}][3] = { };`; console.log(sourceOutput); -const sourceDir = 'Firmware/src/config/'; +const sourceDir = 'firmware/src/config/'; if (!fs.existsSync(sourceDir)) { fs.mkdirSync(sourceDir, {recursive: true}); } diff --git a/Utils/Scripts/run.js b/utils/scripts/run.js similarity index 77% rename from Utils/Scripts/run.js rename to utils/scripts/run.js index f33d9b7e..1b44b9d3 100644 --- a/Utils/Scripts/run.js +++ b/utils/scripts/run.js @@ -16,29 +16,29 @@ const buildHandlers = { & build('serial-standalone'); }, 'voice-command': () => { - return exec('node', ['./voice-command/build/build-release.js']); + return exec('node', ['./utils/voiceCommand/build/build-release.js']); }, 'serial-plugin': () => { const gypDef = '--cppdefs="NODE_GYP ' + escape(cppDefines.join(' ')) + '"'; - return exec('node-gyp', ['configure', gypDef]) - & exec('node-gyp', ['build']); + return exec('node-gyp', ['configure', '-C utils/serial', gypDef]) + & exec('node-gyp', ['build', '-C utils/serial']); }, 'serial-standalone': () => { return exec( cppExec, cppArgs.concat(cppDefines.map((d) => cppDefinePrefix + d)).concat([ - 'Utils/Serial/src/standalone/main.cpp', - 'Utils/Serial/src/standalone/standalone.cpp', - 'Utils/Serial/src/serial/shared.cpp', - 'Utils/Serial/src/crashAnalyzer/analyze.cpp', - 'Utils/Serial/src/crashAnalyzer/buffer.cpp', + 'utils/serial/src/standalone/main.cpp', + 'utils/serial/src/standalone/standalone.cpp', + 'utils/serial/src/serial/shared.cpp', + 'utils/serial/src/crashAnalyzer/analyze.cpp', + 'utils/serial/src/crashAnalyzer/buffer.cpp', process.platform == 'win32' ? - 'Utils/Serial/src/serial/win.cpp' : - 'Utils/Serial/src/serial/unix.cpp', - 'Protocol/src/protocol/protocol.cpp', - '-IUtils/Serial/include', - '-IProtocol/include', - '-o Utils/Serial/serial'])); + 'utils/serial/src/serial/win.cpp' : + 'utils/serial/src/serial/unix.cpp', + 'utils/protocol/src/protocol/protocol.cpp', + '-Iutils/serial/include', + '-Iutils/protocol/include', + '-o utils/serial/serial'])); }, 'firmware': () => { return config(process.argv[4]) @@ -74,18 +74,18 @@ const cleanHandlers = { & clean('serial-standalone'); }, 'voice-command': () => { - return remove('./voice-command/.bin'); + return remove('./utils/voiceCommand/.bin'); }, 'serial-plugin': () => { - return remove('./build'); + return remove('./utils/serial/build'); }, 'serial-standalone': () => { log('Clean serial-standalone not implemented yet', color.yellow); return true; }, 'firmware': () => { - return remove('./Firmware/src/config/config.cpp') - & remove('./Firmware/include/config/config.hpp') + return remove('./firmware/src/config/config.cpp') + & remove('./firmware/include/config/config.hpp') & platformio('clean'); } }; @@ -116,7 +116,7 @@ function config(target) { target = 'doerte'; } log(`Generating config ${target}`, color.green); - return exec('node', ['Utils/Scripts/generateHardwareConfig.js', target]); + return exec('node', ['utils/scripts/generateHardwareConfig.js', target]); } function platformio(command) { @@ -124,16 +124,16 @@ function platformio(command) { command = '.'; } log(`Running platformio ${command}`, color.green); - return exec(platformioExec, ['run', '-d Firmware', `-t ${command}`]); + return exec(platformioExec, ['run', '-d firmware', `-t ${command}`]); } function plotter() { - return exec('http-server', ['Utils/plotter/']); + return exec('http-server', ['utils/plotter/']); } function docs() { log(`Building docs`, color.green); - return exec('node', ['Utils/Scripts/docs.js']); + return exec('node', ['utils/scripts/docs.js']); } const handlers = { diff --git a/Utils/Scripts/tools.js b/utils/scripts/tools.js similarity index 100% rename from Utils/Scripts/tools.js rename to utils/scripts/tools.js diff --git a/utils/serial/binding.gyp b/utils/serial/binding.gyp new file mode 100644 index 00000000..1d00d648 --- /dev/null +++ b/utils/serial/binding.gyp @@ -0,0 +1,35 @@ +{ + "variables": { + "cppdefs": "NODE_GYP", + }, + "targets": [{ + "target_name": "serial", + "sources": [ + "./src/node/main.cpp", + "./src/node/setup.cpp", + "./src/node/poll.cpp", + "./src/node/send.cpp", + "./src/node/receiveHelpers.cpp", + "./src/node/sendHelpers.cpp", + "./src/serial/shared.cpp", + "./src/crashAnalyzer/buffer.cpp", + "./src/crashAnalyzer/analyze.cpp", + "../protocol/src/protocol/protocol.cpp" + ], + "conditions": [ + ["OS=='win'", { + "sources": ["./src/serial/win.cpp"] + }], + ["OS!='win'", { + "sources": ["./src/serial/unix.cpp"] + }], + ], + "include_dirs": [ + "./include", + "../protocol/include" + ], + "defines": [ + "<@(cppdefs)" + ] + }] +} diff --git a/Utils/Serial/include/crashAnalyzer.hpp b/utils/serial/include/crashAnalyzer.hpp similarity index 100% rename from Utils/Serial/include/crashAnalyzer.hpp rename to utils/serial/include/crashAnalyzer.hpp diff --git a/Utils/Serial/include/node.hpp b/utils/serial/include/node.hpp similarity index 100% rename from Utils/Serial/include/node.hpp rename to utils/serial/include/node.hpp diff --git a/Utils/Serial/include/serial.hpp b/utils/serial/include/serial.hpp similarity index 100% rename from Utils/Serial/include/serial.hpp rename to utils/serial/include/serial.hpp diff --git a/Utils/Serial/include/standalone.hpp b/utils/serial/include/standalone.hpp similarity index 100% rename from Utils/Serial/include/standalone.hpp rename to utils/serial/include/standalone.hpp diff --git a/Utils/Serial/src/crashAnalyzer/analyze.cpp b/utils/serial/src/crashAnalyzer/analyze.cpp similarity index 100% rename from Utils/Serial/src/crashAnalyzer/analyze.cpp rename to utils/serial/src/crashAnalyzer/analyze.cpp diff --git a/Utils/Serial/src/crashAnalyzer/buffer.cpp b/utils/serial/src/crashAnalyzer/buffer.cpp similarity index 100% rename from Utils/Serial/src/crashAnalyzer/buffer.cpp rename to utils/serial/src/crashAnalyzer/buffer.cpp diff --git a/Utils/Serial/src/node/main.cpp b/utils/serial/src/node/main.cpp similarity index 100% rename from Utils/Serial/src/node/main.cpp rename to utils/serial/src/node/main.cpp diff --git a/Utils/Serial/src/node/poll.cpp b/utils/serial/src/node/poll.cpp similarity index 100% rename from Utils/Serial/src/node/poll.cpp rename to utils/serial/src/node/poll.cpp diff --git a/Utils/Serial/src/node/receiveHelpers.cpp b/utils/serial/src/node/receiveHelpers.cpp similarity index 100% rename from Utils/Serial/src/node/receiveHelpers.cpp rename to utils/serial/src/node/receiveHelpers.cpp diff --git a/Utils/Serial/src/node/send.cpp b/utils/serial/src/node/send.cpp similarity index 100% rename from Utils/Serial/src/node/send.cpp rename to utils/serial/src/node/send.cpp diff --git a/Utils/Serial/src/node/sendHelpers.cpp b/utils/serial/src/node/sendHelpers.cpp similarity index 100% rename from Utils/Serial/src/node/sendHelpers.cpp rename to utils/serial/src/node/sendHelpers.cpp diff --git a/Utils/Serial/src/node/setup.cpp b/utils/serial/src/node/setup.cpp similarity index 100% rename from Utils/Serial/src/node/setup.cpp rename to utils/serial/src/node/setup.cpp diff --git a/Utils/Serial/src/serial/shared.cpp b/utils/serial/src/serial/shared.cpp similarity index 100% rename from Utils/Serial/src/serial/shared.cpp rename to utils/serial/src/serial/shared.cpp diff --git a/Utils/Serial/src/serial/unix.cpp b/utils/serial/src/serial/unix.cpp similarity index 100% rename from Utils/Serial/src/serial/unix.cpp rename to utils/serial/src/serial/unix.cpp diff --git a/Utils/Serial/src/serial/win.cpp b/utils/serial/src/serial/win.cpp similarity index 100% rename from Utils/Serial/src/serial/win.cpp rename to utils/serial/src/serial/win.cpp diff --git a/Utils/Serial/src/standalone/main.cpp b/utils/serial/src/standalone/main.cpp similarity index 100% rename from Utils/Serial/src/standalone/main.cpp rename to utils/serial/src/standalone/main.cpp diff --git a/Utils/Serial/src/standalone/standalone.cpp b/utils/serial/src/standalone/standalone.cpp similarity index 100% rename from Utils/Serial/src/standalone/standalone.cpp rename to utils/serial/src/standalone/standalone.cpp diff --git a/Utils/svgConverter/fileCreator.js b/utils/svgConverter/fileCreator.js similarity index 100% rename from Utils/svgConverter/fileCreator.js rename to utils/svgConverter/fileCreator.js diff --git a/Utils/svgConverter/svgConverter.js b/utils/svgConverter/svgConverter.js similarity index 100% rename from Utils/svgConverter/svgConverter.js rename to utils/svgConverter/svgConverter.js diff --git a/Utils/svgConverter/svgToJs.js b/utils/svgConverter/svgToJs.js similarity index 100% rename from Utils/svgConverter/svgToJs.js rename to utils/svgConverter/svgToJs.js diff --git a/Utils/svgConverter/utils.js b/utils/svgConverter/utils.js similarity index 100% rename from Utils/svgConverter/utils.js rename to utils/svgConverter/utils.js diff --git a/Utils/ViDeb/index.html b/utils/viDeb/index.html similarity index 100% rename from Utils/ViDeb/index.html rename to utils/viDeb/index.html diff --git a/Utils/ViDeb/index.js b/utils/viDeb/index.js similarity index 100% rename from Utils/ViDeb/index.js rename to utils/viDeb/index.js diff --git a/Utils/ViDeb/static/css/bootstrap.min.css b/utils/viDeb/static/css/bootstrap.min.css similarity index 100% rename from Utils/ViDeb/static/css/bootstrap.min.css rename to utils/viDeb/static/css/bootstrap.min.css diff --git a/Utils/ViDeb/static/js/LP_PCB.json b/utils/viDeb/static/js/LP_PCB.json similarity index 100% rename from Utils/ViDeb/static/js/LP_PCB.json rename to utils/viDeb/static/js/LP_PCB.json diff --git a/Utils/ViDeb/static/js/Vector.js b/utils/viDeb/static/js/Vector.js similarity index 100% rename from Utils/ViDeb/static/js/Vector.js rename to utils/viDeb/static/js/Vector.js diff --git a/Utils/ViDeb/static/js/bootstrap.min.js b/utils/viDeb/static/js/bootstrap.min.js similarity index 100% rename from Utils/ViDeb/static/js/bootstrap.min.js rename to utils/viDeb/static/js/bootstrap.min.js diff --git a/Utils/ViDeb/static/js/graphics.js b/utils/viDeb/static/js/graphics.js similarity index 100% rename from Utils/ViDeb/static/js/graphics.js rename to utils/viDeb/static/js/graphics.js diff --git a/Utils/ViDeb/static/js/jquery.min.js b/utils/viDeb/static/js/jquery.min.js similarity index 100% rename from Utils/ViDeb/static/js/jquery.min.js rename to utils/viDeb/static/js/jquery.min.js diff --git a/Utils/ViDeb/static/js/map.js b/utils/viDeb/static/js/map.js similarity index 100% rename from Utils/ViDeb/static/js/map.js rename to utils/viDeb/static/js/map.js diff --git a/Utils/ViDeb/static/map.html b/utils/viDeb/static/map.html similarity index 100% rename from Utils/ViDeb/static/map.html rename to utils/viDeb/static/map.html diff --git a/voice-command/LICENSE.md b/utils/voiceCommand/LICENSE.md similarity index 100% rename from voice-command/LICENSE.md rename to utils/voiceCommand/LICENSE.md diff --git a/voice-command/README.md b/utils/voiceCommand/README.md similarity index 100% rename from voice-command/README.md rename to utils/voiceCommand/README.md diff --git a/voice-command/build/build-release.js b/utils/voiceCommand/build/build-release.js similarity index 86% rename from voice-command/build/build-release.js rename to utils/voiceCommand/build/build-release.js index cad054ba..b74e698a 100644 --- a/voice-command/build/build-release.js +++ b/utils/voiceCommand/build/build-release.js @@ -1,3 +1,4 @@ +/* eslint-disable */ var os = require('os'), fs = require('fs'), spawn = require('child_process').spawn; @@ -7,13 +8,13 @@ var platform = os.platform(); console.log(platform); if(platform === 'darwin') { var child = spawn('xcodebuild', { - cwd: './voice-command/src/osx/voice-command/' + cwd: './utils/voiceCommand/src/osx/voice-command/' }); } else if (platform == "win32") { var msbuild = 'C:/Windows/Microsoft.NET/Framework64/v4.0.30319/msbuild.exe'; var child = spawn(msbuild, ['/p:Configuration=Release', 'voice-command.csproj', '/p:Platform=AnyCPU'], { - cwd: './voice-command/src/win/voice-command/' + cwd: './utils/voiceCommand/src/win/voice-command/' }); child.stdout.on('data', function (data) { console.log('' + data); }); child.stderr.on('data', function (data) { console.log('' + data); }); diff --git a/voice-command/index.js b/utils/voiceCommand/index.js similarity index 100% rename from voice-command/index.js rename to utils/voiceCommand/index.js diff --git a/voice-command/package.json b/utils/voiceCommand/package.json similarity index 100% rename from voice-command/package.json rename to utils/voiceCommand/package.json diff --git a/voice-command/src/linux/voice-command/build.sh b/utils/voiceCommand/src/linux/voice-command/build.sh similarity index 100% rename from voice-command/src/linux/voice-command/build.sh rename to utils/voiceCommand/src/linux/voice-command/build.sh diff --git a/voice-command/src/linux/voice-command/voice-command.c b/utils/voiceCommand/src/linux/voice-command/voice-command.c similarity index 100% rename from voice-command/src/linux/voice-command/voice-command.c rename to utils/voiceCommand/src/linux/voice-command/voice-command.c diff --git a/voice-command/src/osx/voice-command/voice-command.xcodeproj/project.pbxproj b/utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/project.pbxproj similarity index 100% rename from voice-command/src/osx/voice-command/voice-command.xcodeproj/project.pbxproj rename to utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/project.pbxproj diff --git a/voice-command/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from voice-command/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to utils/voiceCommand/src/osx/voice-command/voice-command.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/voice-command/src/osx/voice-command/voice-command/CommandListener.h b/utils/voiceCommand/src/osx/voice-command/voice-command/CommandListener.h similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/CommandListener.h rename to utils/voiceCommand/src/osx/voice-command/voice-command/CommandListener.h diff --git a/voice-command/src/osx/voice-command/voice-command/CommandListener.m b/utils/voiceCommand/src/osx/voice-command/voice-command/CommandListener.m similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/CommandListener.m rename to utils/voiceCommand/src/osx/voice-command/voice-command/CommandListener.m diff --git a/voice-command/src/osx/voice-command/voice-command/CommandReporter.h b/utils/voiceCommand/src/osx/voice-command/voice-command/CommandReporter.h similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/CommandReporter.h rename to utils/voiceCommand/src/osx/voice-command/voice-command/CommandReporter.h diff --git a/voice-command/src/osx/voice-command/voice-command/Speech.h b/utils/voiceCommand/src/osx/voice-command/voice-command/Speech.h similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/Speech.h rename to utils/voiceCommand/src/osx/voice-command/voice-command/Speech.h diff --git a/voice-command/src/osx/voice-command/voice-command/StandardOutputInterop.h b/utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputInterop.h similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/StandardOutputInterop.h rename to utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputInterop.h diff --git a/voice-command/src/osx/voice-command/voice-command/StandardOutputReporter.h b/utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputReporter.h similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/StandardOutputReporter.h rename to utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputReporter.h diff --git a/voice-command/src/osx/voice-command/voice-command/StandardOutputReporter.m b/utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputReporter.m similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/StandardOutputReporter.m rename to utils/voiceCommand/src/osx/voice-command/voice-command/StandardOutputReporter.m diff --git a/voice-command/src/osx/voice-command/voice-command/main.m b/utils/voiceCommand/src/osx/voice-command/voice-command/main.m similarity index 100% rename from voice-command/src/osx/voice-command/voice-command/main.m rename to utils/voiceCommand/src/osx/voice-command/voice-command/main.m diff --git a/voice-command/src/win/voice-command/App.config b/utils/voiceCommand/src/win/voice-command/App.config similarity index 100% rename from voice-command/src/win/voice-command/App.config rename to utils/voiceCommand/src/win/voice-command/App.config diff --git a/voice-command/src/win/voice-command/CommandListener.cs b/utils/voiceCommand/src/win/voice-command/CommandListener.cs similarity index 100% rename from voice-command/src/win/voice-command/CommandListener.cs rename to utils/voiceCommand/src/win/voice-command/CommandListener.cs diff --git a/voice-command/src/win/voice-command/ICommandReporter.cs b/utils/voiceCommand/src/win/voice-command/ICommandReporter.cs similarity index 100% rename from voice-command/src/win/voice-command/ICommandReporter.cs rename to utils/voiceCommand/src/win/voice-command/ICommandReporter.cs diff --git a/voice-command/src/win/voice-command/Program.cs b/utils/voiceCommand/src/win/voice-command/Program.cs similarity index 100% rename from voice-command/src/win/voice-command/Program.cs rename to utils/voiceCommand/src/win/voice-command/Program.cs diff --git a/voice-command/src/win/voice-command/Properties/AssemblyInfo.cs b/utils/voiceCommand/src/win/voice-command/Properties/AssemblyInfo.cs similarity index 100% rename from voice-command/src/win/voice-command/Properties/AssemblyInfo.cs rename to utils/voiceCommand/src/win/voice-command/Properties/AssemblyInfo.cs diff --git a/voice-command/src/win/voice-command/StandardOutputReporter.cs b/utils/voiceCommand/src/win/voice-command/StandardOutputReporter.cs similarity index 100% rename from voice-command/src/win/voice-command/StandardOutputReporter.cs rename to utils/voiceCommand/src/win/voice-command/StandardOutputReporter.cs diff --git a/voice-command/src/win/voice-command/voice-command.csproj b/utils/voiceCommand/src/win/voice-command/voice-command.csproj similarity index 100% rename from voice-command/src/win/voice-command/voice-command.csproj rename to utils/voiceCommand/src/win/voice-command/voice-command.csproj diff --git a/voice-command/src/win/voice-command/voice-command.sln b/utils/voiceCommand/src/win/voice-command/voice-command.sln similarity index 100% rename from voice-command/src/win/voice-command/voice-command.sln rename to utils/voiceCommand/src/win/voice-command/voice-command.sln diff --git a/voice-command/test/run.js b/utils/voiceCommand/test/run.js similarity index 100% rename from voice-command/test/run.js rename to utils/voiceCommand/test/run.js