Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:brown-ccv/task-resting-state int…
Browse files Browse the repository at this point in the history
…o develop
  • Loading branch information
fernandogelin committed Nov 12, 2019
2 parents 0b7b02e + e285535 commit de0c3bd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ The `package-lock.json` contains metadata about the package installation. It sho

The `public` directory contains files that are used as assets in the built app. The `favicon.ico` is the small icon you can see in the browser tab (on Chrome) - it is set to Brown's logo in the project. The `index.html` contains the shell of your website - the name displayed on the tab can be changed here, otherwise it shouldn't need to be edited. The scripts included in the file are for `psiturk` as are the files in the `lib/` directory.

#### `electron.js`

This file contains all of the code relating to the electron app. This includes the event-marker, throwing errors via dialog windows, saving data, and reading files.

#### `config/`

The `config` directory contains the config files needed for the electron app. This includes the event-marker details and event codes.

Note: the productId can be overwritten by the environment variable EVENT_MARKER_PRODUCT_ID

### `src/`

This folder contains the code for the app, the vast majority of changes and code should go here.
Expand Down
2 changes: 2 additions & 0 deletions public/config/trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const productId = '0487'
// Make sure the 'open_resting_task' value doesn't conflict with any value sent
// by any other task, since we use it to uniquely identify this task. It's ok
// for other values to be re-used in other tasks.

// NOTE - these must match the codes in src/config/trigger.js
const eventCodes = {
'test_connect': 32,
'open_task': 12,
Expand Down
6 changes: 5 additions & 1 deletion public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const { eventCodes, manufacturer, vendorId, productId } = require('./config/trig
const { isPort, getPort, sendToPort } = require('event-marker')
log.info(AT_HOME)

// Override product ID if environment variable set
const activeProductId = process.env.EVENT_MARKER_PRODUCT_ID || productId
log.info("Active product ID", activeProductId)

// Data Saving
const { dataDir } = require('./config/saveData')

Expand Down Expand Up @@ -80,7 +84,7 @@ let portAvailable
let SKIP_SENDING_DEV = false

const setUpPort = async () => {
p = await getPort(vendorId, productId)
p = await getPort(vendorId, activeProductId)
if (p) {
triggerPort = p
portAvailable = true
Expand Down
7 changes: 1 addition & 6 deletions src/config/trigger.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Event trigger settings - used in both the react app (renderer) and the electron app (main)
const manufacturer = 'Teensyduino'
const vendorId = '16c0'
const productId = '0483'

// NOTE - these must match the codes in public/config/trigger.js
const eventCodes = {
'test_connect': 32,
'open_task': 12,
Expand All @@ -27,8 +25,5 @@ const eventCodes = {

// this is module.exports isntead of just exports as it is also imported into the electron app
module.exports = {
manufacturer,
vendorId,
productId,
eventCodes
}

0 comments on commit de0c3bd

Please sign in to comment.